@debridge-finance/intents-client 1.3.0-dev.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -437,6 +437,7 @@ type IntentsProgram = {
437
437
  },
438
438
  {
439
439
  name: "maker";
440
+ writable: true;
440
441
  relations: ["intentStorage"];
441
442
  },
442
443
  {
@@ -582,59 +583,6 @@ type IntentsProgram = {
582
583
  {
583
584
  name: "receiverTakeToken";
584
585
  writable: true;
585
- pda: {
586
- seeds: [
587
- {
588
- kind: "account";
589
- path: "receiver";
590
- },
591
- {
592
- kind: "account";
593
- path: "tokenProgram";
594
- },
595
- {
596
- kind: "account";
597
- path: "tokenMint";
598
- }
599
- ];
600
- program: {
601
- kind: "const";
602
- value: [
603
- 140,
604
- 151,
605
- 37,
606
- 143,
607
- 78,
608
- 36,
609
- 137,
610
- 241,
611
- 187,
612
- 61,
613
- 16,
614
- 41,
615
- 20,
616
- 142,
617
- 13,
618
- 131,
619
- 11,
620
- 90,
621
- 19,
622
- 153,
623
- 218,
624
- 255,
625
- 16,
626
- 132,
627
- 4,
628
- 142,
629
- 123,
630
- 216,
631
- 219,
632
- 233,
633
- 248,
634
- 89
635
- ];
636
- };
637
- };
638
586
  },
639
587
  {
640
588
  name: "tokenMint";
@@ -2538,6 +2486,14 @@ type IntentsProgram = {
2538
2486
  code: 9683;
2539
2487
  name: "invalidReceiver";
2540
2488
  },
2489
+ {
2490
+ code: 9684;
2491
+ name: "readonlyReceiver";
2492
+ },
2493
+ {
2494
+ code: 6101;
2495
+ name: "missedNativeUnwrapFlag";
2496
+ },
2541
2497
  {
2542
2498
  code: 9793;
2543
2499
  name: "invalidDlnOrderTakeAmount";
@@ -3403,6 +3359,16 @@ type IntentsProgram = {
3403
3359
  name: "stateSeed";
3404
3360
  type: "bytes";
3405
3361
  value: "[115, 116, 97, 116, 101]";
3362
+ },
3363
+ {
3364
+ name: "unwrapNativePseudoMint";
3365
+ type: "pubkey";
3366
+ value: "11111111111111111111111111111111";
3367
+ },
3368
+ {
3369
+ name: "unwrapNativeReceiverSeed";
3370
+ type: "bytes";
3371
+ value: "[117, 110, 119, 114, 97, 112, 95, 110, 97, 116, 105, 118, 101, 95, 114, 101, 99, 101, 105, 118, 101, 114]";
3406
3372
  }
3407
3373
  ];
3408
3374
  };
@@ -3558,12 +3524,23 @@ interface UpdateRecordParams {
3558
3524
  buffer: Buffer;
3559
3525
  offset: number;
3560
3526
  }
3527
+ interface CancelIntentParams {
3528
+ maker: PublicKey;
3529
+ payer?: PublicKey;
3530
+ id: Buffer;
3531
+ tokenMint?: PublicKey;
3532
+ tokenProgram?: PublicKey;
3533
+ blockhash: Blockhash;
3534
+ ALTs?: Array<AddressLookupTableAccount>;
3535
+ computeBudget?: ComputeBudget;
3536
+ }
3561
3537
  interface CloseIntentParams {
3562
- authority: PublicKey;
3538
+ maker: PublicKey;
3563
3539
  payer?: PublicKey;
3564
- record?: PublicKey;
3565
3540
  receiver?: PublicKey;
3566
3541
  id: Buffer;
3542
+ tokenMint?: PublicKey;
3543
+ tokenProgram?: PublicKey;
3567
3544
  blockhash: Blockhash;
3568
3545
  ALTs?: Array<AddressLookupTableAccount>;
3569
3546
  computeBudget?: ComputeBudget;
@@ -3584,6 +3561,12 @@ interface DelegateApprovedBudgetsParams {
3584
3561
  } | {
3585
3562
  revoke: {};
3586
3563
  };
3564
+ signature?: Buffer;
3565
+ }
3566
+ interface SetMakerCancelUntilTimestampParams {
3567
+ maker: PublicKey;
3568
+ payer: PublicKey;
3569
+ timestamp: bigint;
3587
3570
  }
3588
3571
  interface SwapBeginParams {
3589
3572
  taker: PublicKey;
@@ -3648,6 +3631,7 @@ interface ExecuteIntentSameChainParams {
3648
3631
  receiver: PublicKey;
3649
3632
  amount: bigint;
3650
3633
  tokenProgram?: PublicKey;
3634
+ unwrapTakeToken?: boolean;
3651
3635
  }
3652
3636
  interface SwapParams extends SwapBeginParams, SwapEndParams {
3653
3637
  payer?: PublicKey;
@@ -3657,6 +3641,14 @@ interface SwapParams extends SwapBeginParams, SwapEndParams {
3657
3641
  lastInstructions?: TransactionInstruction[];
3658
3642
  computeBudget?: ComputeBudget;
3659
3643
  }
3644
+ interface WithdrawClosedIntentTokenAccountParams {
3645
+ id: Buffer;
3646
+ tokenMint: PublicKey;
3647
+ tokenProgram?: PublicKey;
3648
+ }
3649
+ interface WithdrawCancelledIntentTokenAccountParams extends WithdrawClosedIntentTokenAccountParams {
3650
+ maker: PublicKey;
3651
+ }
3660
3652
 
3661
3653
  declare const DEFAULT_RECORD_OFFSET = 33;
3662
3654
  declare class IntentsClient {
@@ -3674,17 +3666,20 @@ declare class IntentsClient {
3674
3666
  getState(connection: Connection): Promise<State | null>;
3675
3667
  getIntentStorage(connection: Connection, intentId: Buffer$1): Promise<IntentStorage | null>;
3676
3668
  approveProtocolTransfersIxs({ maker, tokens, tokenProgram, }: ApproveProtocolTransfersParams): Promise<TransactionInstruction[]>;
3669
+ private cancelIntentIxs;
3677
3670
  private closeIntentIxs;
3678
3671
  executeIntentIxs({ tradeId, intentId, taker, maker, tokenMint, dlnOrder, dlnMetadata, dlnSrc, tokenProgram, }: ExecuteIntentParams): Promise<TransactionInstruction[]>;
3679
- executeSameChainIntentIxs({ tradeId, intentId, taker, maker, tokenMint, receiver, amount, tokenProgram, }: ExecuteIntentSameChainParams): Promise<TransactionInstruction[]>;
3680
- initIntentIxs(maker: PublicKey, payer: PublicKey, id: Buffer$1, encodedIntentHash: Buffer$1, encodedIntentLength: number, inputTokensAmount: number): Promise<TransactionInstruction[]>;
3681
- initIntentUsingSigIxs(maker: PublicKey, payer: PublicKey, delegate: (PublicKey | null) | undefined, // TODO
3682
- id: Buffer$1, encodedIntentHash: Buffer$1, encodedIntentLength: number, inputTokensAmount: number, signature: Buffer$1): Promise<TransactionInstruction[]>;
3683
- setDelegateApprovedBudgetsIxs({ maker, payer, delegate, nonce, tokens, }: DelegateApprovedBudgetsParams): Promise<TransactionInstruction[]>;
3672
+ executeSameChainIntentIxs({ tradeId, intentId, taker, maker, tokenMint, receiver, amount, tokenProgram, unwrapTakeToken, }: ExecuteIntentSameChainParams): Promise<TransactionInstruction[]>;
3673
+ initIntentIxs(maker: PublicKey, payer: PublicKey, delegate: (PublicKey | null) | undefined, id: Buffer$1, encodedIntentHash: Buffer$1, encodedIntentLength: number, inputTokensAmount: number): Promise<TransactionInstruction[]>;
3674
+ initIntentUsingSigIxs(maker: PublicKey, payer: PublicKey, delegate: (PublicKey | null) | undefined, id: Buffer$1, encodedIntentHash: Buffer$1, encodedIntentLength: number, inputTokensAmount: number, signature: Buffer$1): Promise<TransactionInstruction[]>;
3675
+ setDelegateApprovedBudgetsIxs({ maker, payer, delegate, nonce, tokens, signature, }: DelegateApprovedBudgetsParams): Promise<TransactionInstruction[]>;
3676
+ setMakerCancelUntilTimestampIxs({ maker, payer, timestamp, }: SetMakerCancelUntilTimestampParams): Promise<TransactionInstruction[]>;
3684
3677
  swapBeginIxs({ taker, maker, intentId, tradeId, beginAmount, // 0 for tests // transfer from random wallet to taker output amount, input / output = intent price
3685
3678
  target, inputMint, outputMint, inputTokenProgram, outputTokenProgram, }: SwapBeginParams): Promise<TransactionInstruction[]>;
3686
3679
  swapEndIxs({ taker, intentId, endAmount, bps, inputMint, outputMint, outputTokenProgram, }: SwapEndParams): Promise<TransactionInstruction[]>;
3687
3680
  updateIntentIxs({ payer, record, id, offset, length, data, }: UpdateIntentParams): Promise<TransactionInstruction[]>;
3681
+ withdrawCancelledIntentTokenAccountIxs({ maker, id, tokenMint, tokenProgram, }: WithdrawCancelledIntentTokenAccountParams): Promise<TransactionInstruction[]>;
3682
+ withdrawClosedIntentTokenAccount({ id, tokenMint, tokenProgram, }: WithdrawClosedIntentTokenAccountParams): Promise<TransactionInstruction[]>;
3688
3683
  closeRecordIxs({ record, authority, receiver, }: CloseRecordParams): TransactionInstruction[];
3689
3684
  writeRecordIxs({ authority, record, buffer, offset, }: WriteRecordParams): TransactionInstruction[];
3690
3685
  reallocRecordIxs({ authority, payer, record, buffer, offset, }: UpdateRecordParams): Promise<TransactionInstruction[]>;
@@ -3700,13 +3695,15 @@ declare class IntentsClient {
3700
3695
  }>;
3701
3696
  createAndUpdateIntentTxs({ authority, payer, delegate, intent, signature, blockhash, ALTs, computeBudget, }: CreateAndUpdateIntentParams): Promise<VersionedTransaction[]>;
3702
3697
  updateRecordTxs({ authority, payer, record, serializedIntent, offset, blockhash, ALTs, computeBudget, }: UpdateRecordTxsParams): Promise<VersionedTransaction[]>;
3703
- closeIntentTxs({ authority, payer, record, receiver, id, blockhash, ALTs, computeBudget, }: CloseIntentParams): Promise<VersionedTransaction[]>;
3698
+ cancelIntentTxs({ maker, payer, id, tokenMint, tokenProgram, blockhash, ALTs, computeBudget, }: CancelIntentParams): Promise<VersionedTransaction[]>;
3699
+ closeIntentTxs({ maker, payer, receiver, id, tokenMint, tokenProgram, blockhash, ALTs, computeBudget, }: CloseIntentParams): Promise<VersionedTransaction[]>;
3704
3700
  swapTxs({ taker, maker, intentId, tradeId, inputMint, outputMint, beginAmount, endAmount, bps, target, inputTokenProgram, outputTokenProgram, instructions, lastInstructions, computeBudget, payer, blockhash, ALTs, }: SwapParams): Promise<VersionedTransaction[]>;
3705
3701
  static getStatePda(programId: PublicKey): PublicKey;
3706
3702
  static getIntentStoragePda(programId: PublicKey, intentId: Buffer$1): PublicKey;
3707
3703
  static getMakerInfoPda(programId: PublicKey, maker: PublicKey): PublicKey;
3708
3704
  static getDelegatesPda(programId: PublicKey, user: PublicKey): PublicKey;
3709
3705
  static getEventAuthorityPda(programId: PublicKey): PublicKey;
3706
+ static getNativePda(programId: PublicKey): PublicKey;
3710
3707
  }
3711
3708
 
3712
3709
  declare class Intent implements Serializable {
@@ -3727,6 +3724,7 @@ declare class Intent implements Serializable {
3727
3724
  static getId(serializedIntent: Buffer, maker: PublicKey, programId: PublicKey): {
3728
3725
  hex: string;
3729
3726
  buffer: Buffer;
3727
+ rawHash: Buffer;
3730
3728
  };
3731
3729
  }
3732
3730
 
package/dist/index.d.ts CHANGED
@@ -437,6 +437,7 @@ type IntentsProgram = {
437
437
  },
438
438
  {
439
439
  name: "maker";
440
+ writable: true;
440
441
  relations: ["intentStorage"];
441
442
  },
442
443
  {
@@ -582,59 +583,6 @@ type IntentsProgram = {
582
583
  {
583
584
  name: "receiverTakeToken";
584
585
  writable: true;
585
- pda: {
586
- seeds: [
587
- {
588
- kind: "account";
589
- path: "receiver";
590
- },
591
- {
592
- kind: "account";
593
- path: "tokenProgram";
594
- },
595
- {
596
- kind: "account";
597
- path: "tokenMint";
598
- }
599
- ];
600
- program: {
601
- kind: "const";
602
- value: [
603
- 140,
604
- 151,
605
- 37,
606
- 143,
607
- 78,
608
- 36,
609
- 137,
610
- 241,
611
- 187,
612
- 61,
613
- 16,
614
- 41,
615
- 20,
616
- 142,
617
- 13,
618
- 131,
619
- 11,
620
- 90,
621
- 19,
622
- 153,
623
- 218,
624
- 255,
625
- 16,
626
- 132,
627
- 4,
628
- 142,
629
- 123,
630
- 216,
631
- 219,
632
- 233,
633
- 248,
634
- 89
635
- ];
636
- };
637
- };
638
586
  },
639
587
  {
640
588
  name: "tokenMint";
@@ -2538,6 +2486,14 @@ type IntentsProgram = {
2538
2486
  code: 9683;
2539
2487
  name: "invalidReceiver";
2540
2488
  },
2489
+ {
2490
+ code: 9684;
2491
+ name: "readonlyReceiver";
2492
+ },
2493
+ {
2494
+ code: 6101;
2495
+ name: "missedNativeUnwrapFlag";
2496
+ },
2541
2497
  {
2542
2498
  code: 9793;
2543
2499
  name: "invalidDlnOrderTakeAmount";
@@ -3403,6 +3359,16 @@ type IntentsProgram = {
3403
3359
  name: "stateSeed";
3404
3360
  type: "bytes";
3405
3361
  value: "[115, 116, 97, 116, 101]";
3362
+ },
3363
+ {
3364
+ name: "unwrapNativePseudoMint";
3365
+ type: "pubkey";
3366
+ value: "11111111111111111111111111111111";
3367
+ },
3368
+ {
3369
+ name: "unwrapNativeReceiverSeed";
3370
+ type: "bytes";
3371
+ value: "[117, 110, 119, 114, 97, 112, 95, 110, 97, 116, 105, 118, 101, 95, 114, 101, 99, 101, 105, 118, 101, 114]";
3406
3372
  }
3407
3373
  ];
3408
3374
  };
@@ -3558,12 +3524,23 @@ interface UpdateRecordParams {
3558
3524
  buffer: Buffer;
3559
3525
  offset: number;
3560
3526
  }
3527
+ interface CancelIntentParams {
3528
+ maker: PublicKey;
3529
+ payer?: PublicKey;
3530
+ id: Buffer;
3531
+ tokenMint?: PublicKey;
3532
+ tokenProgram?: PublicKey;
3533
+ blockhash: Blockhash;
3534
+ ALTs?: Array<AddressLookupTableAccount>;
3535
+ computeBudget?: ComputeBudget;
3536
+ }
3561
3537
  interface CloseIntentParams {
3562
- authority: PublicKey;
3538
+ maker: PublicKey;
3563
3539
  payer?: PublicKey;
3564
- record?: PublicKey;
3565
3540
  receiver?: PublicKey;
3566
3541
  id: Buffer;
3542
+ tokenMint?: PublicKey;
3543
+ tokenProgram?: PublicKey;
3567
3544
  blockhash: Blockhash;
3568
3545
  ALTs?: Array<AddressLookupTableAccount>;
3569
3546
  computeBudget?: ComputeBudget;
@@ -3584,6 +3561,12 @@ interface DelegateApprovedBudgetsParams {
3584
3561
  } | {
3585
3562
  revoke: {};
3586
3563
  };
3564
+ signature?: Buffer;
3565
+ }
3566
+ interface SetMakerCancelUntilTimestampParams {
3567
+ maker: PublicKey;
3568
+ payer: PublicKey;
3569
+ timestamp: bigint;
3587
3570
  }
3588
3571
  interface SwapBeginParams {
3589
3572
  taker: PublicKey;
@@ -3648,6 +3631,7 @@ interface ExecuteIntentSameChainParams {
3648
3631
  receiver: PublicKey;
3649
3632
  amount: bigint;
3650
3633
  tokenProgram?: PublicKey;
3634
+ unwrapTakeToken?: boolean;
3651
3635
  }
3652
3636
  interface SwapParams extends SwapBeginParams, SwapEndParams {
3653
3637
  payer?: PublicKey;
@@ -3657,6 +3641,14 @@ interface SwapParams extends SwapBeginParams, SwapEndParams {
3657
3641
  lastInstructions?: TransactionInstruction[];
3658
3642
  computeBudget?: ComputeBudget;
3659
3643
  }
3644
+ interface WithdrawClosedIntentTokenAccountParams {
3645
+ id: Buffer;
3646
+ tokenMint: PublicKey;
3647
+ tokenProgram?: PublicKey;
3648
+ }
3649
+ interface WithdrawCancelledIntentTokenAccountParams extends WithdrawClosedIntentTokenAccountParams {
3650
+ maker: PublicKey;
3651
+ }
3660
3652
 
3661
3653
  declare const DEFAULT_RECORD_OFFSET = 33;
3662
3654
  declare class IntentsClient {
@@ -3674,17 +3666,20 @@ declare class IntentsClient {
3674
3666
  getState(connection: Connection): Promise<State | null>;
3675
3667
  getIntentStorage(connection: Connection, intentId: Buffer$1): Promise<IntentStorage | null>;
3676
3668
  approveProtocolTransfersIxs({ maker, tokens, tokenProgram, }: ApproveProtocolTransfersParams): Promise<TransactionInstruction[]>;
3669
+ private cancelIntentIxs;
3677
3670
  private closeIntentIxs;
3678
3671
  executeIntentIxs({ tradeId, intentId, taker, maker, tokenMint, dlnOrder, dlnMetadata, dlnSrc, tokenProgram, }: ExecuteIntentParams): Promise<TransactionInstruction[]>;
3679
- executeSameChainIntentIxs({ tradeId, intentId, taker, maker, tokenMint, receiver, amount, tokenProgram, }: ExecuteIntentSameChainParams): Promise<TransactionInstruction[]>;
3680
- initIntentIxs(maker: PublicKey, payer: PublicKey, id: Buffer$1, encodedIntentHash: Buffer$1, encodedIntentLength: number, inputTokensAmount: number): Promise<TransactionInstruction[]>;
3681
- initIntentUsingSigIxs(maker: PublicKey, payer: PublicKey, delegate: (PublicKey | null) | undefined, // TODO
3682
- id: Buffer$1, encodedIntentHash: Buffer$1, encodedIntentLength: number, inputTokensAmount: number, signature: Buffer$1): Promise<TransactionInstruction[]>;
3683
- setDelegateApprovedBudgetsIxs({ maker, payer, delegate, nonce, tokens, }: DelegateApprovedBudgetsParams): Promise<TransactionInstruction[]>;
3672
+ executeSameChainIntentIxs({ tradeId, intentId, taker, maker, tokenMint, receiver, amount, tokenProgram, unwrapTakeToken, }: ExecuteIntentSameChainParams): Promise<TransactionInstruction[]>;
3673
+ initIntentIxs(maker: PublicKey, payer: PublicKey, delegate: (PublicKey | null) | undefined, id: Buffer$1, encodedIntentHash: Buffer$1, encodedIntentLength: number, inputTokensAmount: number): Promise<TransactionInstruction[]>;
3674
+ initIntentUsingSigIxs(maker: PublicKey, payer: PublicKey, delegate: (PublicKey | null) | undefined, id: Buffer$1, encodedIntentHash: Buffer$1, encodedIntentLength: number, inputTokensAmount: number, signature: Buffer$1): Promise<TransactionInstruction[]>;
3675
+ setDelegateApprovedBudgetsIxs({ maker, payer, delegate, nonce, tokens, signature, }: DelegateApprovedBudgetsParams): Promise<TransactionInstruction[]>;
3676
+ setMakerCancelUntilTimestampIxs({ maker, payer, timestamp, }: SetMakerCancelUntilTimestampParams): Promise<TransactionInstruction[]>;
3684
3677
  swapBeginIxs({ taker, maker, intentId, tradeId, beginAmount, // 0 for tests // transfer from random wallet to taker output amount, input / output = intent price
3685
3678
  target, inputMint, outputMint, inputTokenProgram, outputTokenProgram, }: SwapBeginParams): Promise<TransactionInstruction[]>;
3686
3679
  swapEndIxs({ taker, intentId, endAmount, bps, inputMint, outputMint, outputTokenProgram, }: SwapEndParams): Promise<TransactionInstruction[]>;
3687
3680
  updateIntentIxs({ payer, record, id, offset, length, data, }: UpdateIntentParams): Promise<TransactionInstruction[]>;
3681
+ withdrawCancelledIntentTokenAccountIxs({ maker, id, tokenMint, tokenProgram, }: WithdrawCancelledIntentTokenAccountParams): Promise<TransactionInstruction[]>;
3682
+ withdrawClosedIntentTokenAccount({ id, tokenMint, tokenProgram, }: WithdrawClosedIntentTokenAccountParams): Promise<TransactionInstruction[]>;
3688
3683
  closeRecordIxs({ record, authority, receiver, }: CloseRecordParams): TransactionInstruction[];
3689
3684
  writeRecordIxs({ authority, record, buffer, offset, }: WriteRecordParams): TransactionInstruction[];
3690
3685
  reallocRecordIxs({ authority, payer, record, buffer, offset, }: UpdateRecordParams): Promise<TransactionInstruction[]>;
@@ -3700,13 +3695,15 @@ declare class IntentsClient {
3700
3695
  }>;
3701
3696
  createAndUpdateIntentTxs({ authority, payer, delegate, intent, signature, blockhash, ALTs, computeBudget, }: CreateAndUpdateIntentParams): Promise<VersionedTransaction[]>;
3702
3697
  updateRecordTxs({ authority, payer, record, serializedIntent, offset, blockhash, ALTs, computeBudget, }: UpdateRecordTxsParams): Promise<VersionedTransaction[]>;
3703
- closeIntentTxs({ authority, payer, record, receiver, id, blockhash, ALTs, computeBudget, }: CloseIntentParams): Promise<VersionedTransaction[]>;
3698
+ cancelIntentTxs({ maker, payer, id, tokenMint, tokenProgram, blockhash, ALTs, computeBudget, }: CancelIntentParams): Promise<VersionedTransaction[]>;
3699
+ closeIntentTxs({ maker, payer, receiver, id, tokenMint, tokenProgram, blockhash, ALTs, computeBudget, }: CloseIntentParams): Promise<VersionedTransaction[]>;
3704
3700
  swapTxs({ taker, maker, intentId, tradeId, inputMint, outputMint, beginAmount, endAmount, bps, target, inputTokenProgram, outputTokenProgram, instructions, lastInstructions, computeBudget, payer, blockhash, ALTs, }: SwapParams): Promise<VersionedTransaction[]>;
3705
3701
  static getStatePda(programId: PublicKey): PublicKey;
3706
3702
  static getIntentStoragePda(programId: PublicKey, intentId: Buffer$1): PublicKey;
3707
3703
  static getMakerInfoPda(programId: PublicKey, maker: PublicKey): PublicKey;
3708
3704
  static getDelegatesPda(programId: PublicKey, user: PublicKey): PublicKey;
3709
3705
  static getEventAuthorityPda(programId: PublicKey): PublicKey;
3706
+ static getNativePda(programId: PublicKey): PublicKey;
3710
3707
  }
3711
3708
 
3712
3709
  declare class Intent implements Serializable {
@@ -3727,6 +3724,7 @@ declare class Intent implements Serializable {
3727
3724
  static getId(serializedIntent: Buffer, maker: PublicKey, programId: PublicKey): {
3728
3725
  hex: string;
3729
3726
  buffer: Buffer;
3727
+ rawHash: Buffer;
3730
3728
  };
3731
3729
  }
3732
3730