Skip to content

Commit

Permalink
feat(quote): allow pass isPermit2 to order submission (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
vbrvk authored Apr 19, 2024
1 parent 8ce808f commit fbd29e7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/api/quoter/quote/order-params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export class FusionOrderParams {

public readonly delayAuctionStartTimeBy: bigint

public readonly isPermit2?: boolean

constructor(params: FusionOrderParamsData) {
if (params.preset) {
this.preset = params.preset
Expand All @@ -22,6 +24,7 @@ export class FusionOrderParams {
this.receiver = params.receiver
}

this.isPermit2 = params.isPermit2
this.nonce = params.nonce
this.permit = params.permit
this.delayAuctionStartTimeBy = params.delayAuctionStartTimeBy || 0n
Expand Down
6 changes: 4 additions & 2 deletions src/api/quoter/quote/quote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@ export class Quote {
}

createFusionOrder(
paramsData: Omit<FusionOrderParamsData, 'permit'>
paramsData: Omit<FusionOrderParamsData, 'permit' | 'isPermit2'>
): FusionOrder {
const params = FusionOrderParams.new({
preset: paramsData?.preset || this.recommendedPreset,
receiver: paramsData?.receiver,
permit: this.params.permit,
isPermit2: this.params.isPermit2,
nonce: paramsData?.nonce
})

Expand Down Expand Up @@ -120,7 +121,8 @@ export class Quote {
allowPartialFills,
allowMultipleFills,
orderExpirationDelay: paramsData?.orderExpirationDelay,
source: this.params.source
source: this.params.source,
enablePermit2: params.isPermit2
}
)
}
Expand Down
1 change: 1 addition & 0 deletions src/api/quoter/quote/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type FusionOrderParamsData = {
receiver?: Address
nonce?: bigint
permit?: string
isPermit2?: boolean
takingFeeReceiver?: string
allowPartialFills?: boolean
allowMultipleFills?: boolean
Expand Down
3 changes: 2 additions & 1 deletion src/sdk/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ export class FusionSDK {
permit: params.permit,
enableEstimate: true,
fee: params.fee?.takingFeeBps,
source: params.source
source: params.source,
isPermit2: params.isPermit2
})

if (!params.customPreset) {
Expand Down
1 change: 1 addition & 0 deletions src/sdk/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export type OrderParams = {
nonce?: bigint
fee?: TakingFeeInfo
source?: string
isPermit2?: boolean
customPreset?: CustomPreset
/**
* true by default
Expand Down

0 comments on commit fbd29e7

Please sign in to comment.