@debridge-finance/intents-client 1.3.0 → 1.3.2

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
@@ -1,6 +1,5 @@
1
- import { PublicKey, Blockhash, AddressLookupTableAccount, TransactionInstruction, Connection, Keypair, VersionedTransaction } from '@solana/web3.js';
2
1
  import { IdlAccounts } from '@coral-xyz/anchor';
3
- import { Buffer as Buffer$1 } from 'buffer';
2
+ import { PublicKey, Blockhash, AddressLookupTableAccount, TransactionInstruction, Connection, Keypair, VersionedTransaction } from '@solana/web3.js';
4
3
 
5
4
  /**
6
5
  * Program IDL in camelCase format in order to be used in JS/TS.
@@ -17,6 +16,12 @@ type IntentsProgram = {
17
16
  description: "deBridge Intents Program";
18
17
  };
19
18
  instructions: [
19
+ {
20
+ name: "about";
21
+ discriminator: [62, 111, 52, 44, 118, 185, 179, 229];
22
+ accounts: [];
23
+ args: [];
24
+ },
20
25
  {
21
26
  name: "approveProtocolTransfers";
22
27
  discriminator: [17, 3, 184, 144, 112, 130, 116, 98];
@@ -576,9 +581,6 @@ type IntentsProgram = {
576
581
  },
577
582
  {
578
583
  name: "receiver";
579
- docs: [
580
- "TODO: may be optional if receiver_take_token is already initialized"
581
- ];
582
584
  },
583
585
  {
584
586
  name: "receiverTakeToken";
@@ -1988,8 +1990,8 @@ type IntentsProgram = {
1988
1990
  ];
1989
1991
  },
1990
1992
  {
1991
- name: "withdrawCancelledIntentTokenAccount";
1992
- discriminator: [174, 169, 179, 36, 13, 33, 88, 124];
1993
+ name: "withdrawIntentTokenAccount";
1994
+ discriminator: [188, 114, 123, 239, 223, 164, 242, 101];
1993
1995
  accounts: [
1994
1996
  {
1995
1997
  name: "state";
@@ -1997,11 +1999,9 @@ type IntentsProgram = {
1997
1999
  {
1998
2000
  name: "maker";
1999
2001
  docs: ["CHECK"];
2000
- relations: ["intentStorage"];
2001
2002
  },
2002
2003
  {
2003
2004
  name: "intentStorage";
2004
- writable: true;
2005
2005
  },
2006
2006
  {
2007
2007
  name: "intentTokenAccount";
@@ -2118,172 +2118,11 @@ type IntentsProgram = {
2118
2118
  };
2119
2119
  },
2120
2120
  {
2121
- name: "tokenMint";
2122
- },
2123
- {
2124
- name: "tokenProgram";
2125
- },
2126
- {
2127
- name: "associatedTokenProgram";
2128
- address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
2129
- }
2130
- ];
2131
- args: [];
2132
- },
2133
- {
2134
- name: "withdrawClosedIntentTokenAccount";
2135
- discriminator: [123, 141, 239, 126, 107, 232, 214, 120];
2136
- accounts: [
2137
- {
2138
- name: "state";
2139
- },
2140
- {
2141
- name: "intentStorage";
2142
- docs: ["TODO: custom Account<'info, Terminated>"];
2143
- pda: {
2144
- seeds: [
2145
- {
2146
- kind: "const";
2147
- value: [
2148
- 105,
2149
- 110,
2150
- 116,
2151
- 101,
2152
- 110,
2153
- 116,
2154
- 95,
2155
- 115,
2156
- 116,
2157
- 111,
2158
- 114,
2159
- 97,
2160
- 103,
2161
- 101
2162
- ];
2163
- },
2164
- {
2165
- kind: "arg";
2166
- path: "intentId";
2167
- }
2168
- ];
2169
- };
2170
- },
2171
- {
2172
- name: "intentTokenAccount";
2173
- writable: true;
2174
- pda: {
2175
- seeds: [
2176
- {
2177
- kind: "account";
2178
- path: "intentStorage";
2179
- },
2180
- {
2181
- kind: "account";
2182
- path: "tokenProgram";
2183
- },
2184
- {
2185
- kind: "account";
2186
- path: "mint";
2187
- }
2188
- ];
2189
- program: {
2190
- kind: "const";
2191
- value: [
2192
- 140,
2193
- 151,
2194
- 37,
2195
- 143,
2196
- 78,
2197
- 36,
2198
- 137,
2199
- 241,
2200
- 187,
2201
- 61,
2202
- 16,
2203
- 41,
2204
- 20,
2205
- 142,
2206
- 13,
2207
- 131,
2208
- 11,
2209
- 90,
2210
- 19,
2211
- 153,
2212
- 218,
2213
- 255,
2214
- 16,
2215
- 132,
2216
- 4,
2217
- 142,
2218
- 123,
2219
- 216,
2220
- 219,
2221
- 233,
2222
- 248,
2223
- 89
2224
- ];
2225
- };
2226
- };
2227
- },
2228
- {
2229
- name: "feeLedger";
2121
+ name: "rentReceiver";
2230
2122
  writable: true;
2231
- pda: {
2232
- seeds: [
2233
- {
2234
- kind: "account";
2235
- path: "state";
2236
- },
2237
- {
2238
- kind: "account";
2239
- path: "tokenProgram";
2240
- },
2241
- {
2242
- kind: "account";
2243
- path: "mint";
2244
- }
2245
- ];
2246
- program: {
2247
- kind: "const";
2248
- value: [
2249
- 140,
2250
- 151,
2251
- 37,
2252
- 143,
2253
- 78,
2254
- 36,
2255
- 137,
2256
- 241,
2257
- 187,
2258
- 61,
2259
- 16,
2260
- 41,
2261
- 20,
2262
- 142,
2263
- 13,
2264
- 131,
2265
- 11,
2266
- 90,
2267
- 19,
2268
- 153,
2269
- 218,
2270
- 255,
2271
- 16,
2272
- 132,
2273
- 4,
2274
- 142,
2275
- 123,
2276
- 216,
2277
- 219,
2278
- 233,
2279
- 248,
2280
- 89
2281
- ];
2282
- };
2283
- };
2284
2123
  },
2285
2124
  {
2286
- name: "mint";
2125
+ name: "tokenMint";
2287
2126
  },
2288
2127
  {
2289
2128
  name: "tokenProgram";
@@ -2295,10 +2134,12 @@ type IntentsProgram = {
2295
2134
  ];
2296
2135
  args: [
2297
2136
  {
2298
- name: "intentId";
2137
+ name: "encodedIntentHash";
2299
2138
  type: {
2300
- defined: {
2301
- name: "intentId";
2139
+ option: {
2140
+ defined: {
2141
+ name: "encodedIntentHash";
2142
+ };
2302
2143
  };
2303
2144
  };
2304
2145
  }
@@ -2454,6 +2295,10 @@ type IntentsProgram = {
2454
2295
  code: 6293;
2455
2296
  name: "expectedClosedIntent";
2456
2297
  },
2298
+ {
2299
+ code: 6294;
2300
+ name: "expectedCancelledIntent";
2301
+ },
2457
2302
  {
2458
2303
  code: 9664;
2459
2304
  name: "tokenAccountMissingProtocolDelegate";
@@ -2526,6 +2371,10 @@ type IntentsProgram = {
2526
2371
  code: 9788;
2527
2372
  name: "cantBeClosed";
2528
2373
  },
2374
+ {
2375
+ code: 9787;
2376
+ name: "invalidTokenAccountRentReceiver";
2377
+ },
2529
2378
  {
2530
2379
  code: 9839;
2531
2380
  name: "intentArbitraryDataOverflow";
@@ -2577,6 +2426,10 @@ type IntentsProgram = {
2577
2426
  {
2578
2427
  code: 16767137;
2579
2428
  name: "crossProgramInvokeRestricted";
2429
+ },
2430
+ {
2431
+ code: 16770159;
2432
+ name: "crossProgramInvokeHasIntentsProgramAccount";
2580
2433
  }
2581
2434
  ];
2582
2435
  types: [
@@ -3322,6 +3175,11 @@ type IntentsProgram = {
3322
3175
  }
3323
3176
  ];
3324
3177
  constants: [
3178
+ {
3179
+ name: "budgetsSigPrefix";
3180
+ type: "bytes";
3181
+ value: "[98, 117, 100, 103, 101, 116, 115]";
3182
+ },
3325
3183
  {
3326
3184
  name: "clockDriftToleranceSecs";
3327
3185
  type: "u64";
@@ -3340,6 +3198,16 @@ type IntentsProgram = {
3340
3198
  type: "bytes";
3341
3199
  value: "[105, 110, 116, 101, 110, 116, 95, 105, 100]";
3342
3200
  },
3201
+ {
3202
+ name: "intentProgramSigPrefix";
3203
+ type: "bytes";
3204
+ value: "[105, 110, 116, 101, 110, 116, 115, 95, 112, 114, 111, 103, 114, 97, 109]";
3205
+ },
3206
+ {
3207
+ name: "intentSigPrefix";
3208
+ type: "bytes";
3209
+ value: "[105, 110, 116, 101, 110, 116, 115]";
3210
+ },
3343
3211
  {
3344
3212
  name: "intentStorageBaseSeed";
3345
3213
  type: "bytes";
@@ -3390,7 +3258,7 @@ type TakeToken = {
3390
3258
  output: ({
3391
3259
  chainId: number;
3392
3260
  token: AddressType;
3393
- price: bigint;
3261
+ price: bigint | Any;
3394
3262
  } | {
3395
3263
  chainId: number;
3396
3264
  token: Any;
@@ -3528,6 +3396,7 @@ interface CancelIntentParams {
3528
3396
  maker: PublicKey;
3529
3397
  payer?: PublicKey;
3530
3398
  id: Buffer;
3399
+ encodedIntentHash: Buffer;
3531
3400
  tokenMint?: PublicKey;
3532
3401
  tokenProgram?: PublicKey;
3533
3402
  blockhash: Blockhash;
@@ -3545,22 +3414,23 @@ interface CloseIntentParams {
3545
3414
  ALTs?: Array<AddressLookupTableAccount>;
3546
3415
  computeBudget?: ComputeBudget;
3547
3416
  }
3417
+ type DelegateApprovedBudgetsArgs = {
3418
+ set: {
3419
+ tokenMint: PublicKey;
3420
+ approvedAmount: bigint;
3421
+ expiration: bigint;
3422
+ }[];
3423
+ } | {
3424
+ setAny: {};
3425
+ } | {
3426
+ revoke: {};
3427
+ };
3548
3428
  interface DelegateApprovedBudgetsParams {
3549
3429
  maker: PublicKey;
3550
3430
  payer: PublicKey;
3551
3431
  delegate: PublicKey;
3552
3432
  nonce: bigint;
3553
- tokens: {
3554
- set: {
3555
- tokenMint: PublicKey;
3556
- approvedAmount: bigint;
3557
- expiration: bigint;
3558
- }[];
3559
- } | {
3560
- setAny: {};
3561
- } | {
3562
- revoke: {};
3563
- };
3433
+ tokens: DelegateApprovedBudgetsArgs;
3564
3434
  signature?: Buffer;
3565
3435
  }
3566
3436
  interface SetMakerCancelUntilTimestampParams {
@@ -3646,10 +3516,18 @@ interface WithdrawClosedIntentTokenAccountParams {
3646
3516
  tokenMint: PublicKey;
3647
3517
  tokenProgram?: PublicKey;
3648
3518
  }
3649
- interface WithdrawCancelledIntentTokenAccountParams extends WithdrawClosedIntentTokenAccountParams {
3519
+ interface WithdrawIntentTokenAccountParams extends WithdrawClosedIntentTokenAccountParams {
3650
3520
  maker: PublicKey;
3521
+ receiver?: PublicKey;
3522
+ encodedIntentHash: Buffer;
3651
3523
  }
3652
3524
 
3525
+ declare enum IntentProgramSigPrefix {
3526
+ prod = "intents_program",
3527
+ dubai = "intents_program_dubai",
3528
+ hanoi = "intents_program_hanoi",
3529
+ devnet = "intents_program_devnet"
3530
+ }
3653
3531
  declare const DEFAULT_RECORD_OFFSET = 33;
3654
3532
  declare class IntentsClient {
3655
3533
  readonly programId: PublicKey;
@@ -3664,22 +3542,23 @@ declare class IntentsClient {
3664
3542
  });
3665
3543
  private getSpace;
3666
3544
  getState(connection: Connection): Promise<State | null>;
3667
- getIntentStorage(connection: Connection, intentId: Buffer$1): Promise<IntentStorage | null>;
3545
+ getIntentStorage(connection: Connection, intentId: Buffer): Promise<IntentStorage | null>;
3546
+ getMakerInfo(connection: Connection, maker: PublicKey): Promise<IdlAccounts<IntentsProgram>["makerInfo"] | null>;
3547
+ getNonceForDelegate(connection: Connection, maker: PublicKey, delegate: PublicKey): Promise<bigint>;
3668
3548
  approveProtocolTransfersIxs({ maker, tokens, tokenProgram, }: ApproveProtocolTransfersParams): Promise<TransactionInstruction[]>;
3669
3549
  private cancelIntentIxs;
3670
3550
  private closeIntentIxs;
3671
3551
  executeIntentIxs({ tradeId, intentId, taker, maker, tokenMint, dlnOrder, dlnMetadata, dlnSrc, tokenProgram, }: ExecuteIntentParams): Promise<TransactionInstruction[]>;
3672
3552
  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[]>;
3553
+ initIntentIxs(maker: PublicKey, payer: PublicKey, delegate: (PublicKey | null) | undefined, id: Buffer, encodedIntentHash: Buffer, encodedIntentLength: number, inputTokensAmount: number): Promise<TransactionInstruction[]>;
3554
+ initIntentUsingSigIxs(maker: PublicKey, payer: PublicKey, delegate: (PublicKey | null) | undefined, id: Buffer, encodedIntentHash: Buffer, encodedIntentLength: number, inputTokensAmount: number, signature: Buffer): Promise<TransactionInstruction[]>;
3675
3555
  setDelegateApprovedBudgetsIxs({ maker, payer, delegate, nonce, tokens, signature, }: DelegateApprovedBudgetsParams): Promise<TransactionInstruction[]>;
3676
3556
  setMakerCancelUntilTimestampIxs({ maker, payer, timestamp, }: SetMakerCancelUntilTimestampParams): Promise<TransactionInstruction[]>;
3677
3557
  swapBeginIxs({ taker, maker, intentId, tradeId, beginAmount, // 0 for tests // transfer from random wallet to taker output amount, input / output = intent price
3678
3558
  target, inputMint, outputMint, inputTokenProgram, outputTokenProgram, }: SwapBeginParams): Promise<TransactionInstruction[]>;
3679
3559
  swapEndIxs({ taker, intentId, endAmount, bps, inputMint, outputMint, outputTokenProgram, }: SwapEndParams): Promise<TransactionInstruction[]>;
3680
3560
  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[]>;
3561
+ withdrawIntentTokenAccountIxs({ maker, receiver, id, encodedIntentHash, tokenMint, tokenProgram, }: WithdrawIntentTokenAccountParams): Promise<TransactionInstruction[]>;
3683
3562
  closeRecordIxs({ record, authority, receiver, }: CloseRecordParams): TransactionInstruction[];
3684
3563
  writeRecordIxs({ authority, record, buffer, offset, }: WriteRecordParams): TransactionInstruction[];
3685
3564
  reallocRecordIxs({ authority, payer, record, buffer, offset, }: UpdateRecordParams): Promise<TransactionInstruction[]>;
@@ -3695,15 +3574,18 @@ declare class IntentsClient {
3695
3574
  }>;
3696
3575
  createAndUpdateIntentTxs({ authority, payer, delegate, intent, signature, blockhash, ALTs, computeBudget, }: CreateAndUpdateIntentParams): Promise<VersionedTransaction[]>;
3697
3576
  updateRecordTxs({ authority, payer, record, serializedIntent, offset, blockhash, ALTs, computeBudget, }: UpdateRecordTxsParams): Promise<VersionedTransaction[]>;
3698
- cancelIntentTxs({ maker, payer, id, tokenMint, tokenProgram, blockhash, ALTs, computeBudget, }: CancelIntentParams): Promise<VersionedTransaction[]>;
3577
+ cancelIntentTxs({ maker, payer, id, encodedIntentHash, tokenMint, tokenProgram, blockhash, ALTs, computeBudget, }: CancelIntentParams): Promise<VersionedTransaction[]>;
3699
3578
  closeIntentTxs({ maker, payer, receiver, id, tokenMint, tokenProgram, blockhash, ALTs, computeBudget, }: CloseIntentParams): Promise<VersionedTransaction[]>;
3700
3579
  swapTxs({ taker, maker, intentId, tradeId, inputMint, outputMint, beginAmount, endAmount, bps, target, inputTokenProgram, outputTokenProgram, instructions, lastInstructions, computeBudget, payer, blockhash, ALTs, }: SwapParams): Promise<VersionedTransaction[]>;
3701
3580
  static getStatePda(programId: PublicKey): PublicKey;
3702
- static getIntentStoragePda(programId: PublicKey, intentId: Buffer$1): PublicKey;
3581
+ static getIntentStoragePda(programId: PublicKey, intentId: Buffer): PublicKey;
3703
3582
  static getMakerInfoPda(programId: PublicKey, maker: PublicKey): PublicKey;
3704
3583
  static getDelegatesPda(programId: PublicKey, user: PublicKey): PublicKey;
3705
3584
  static getEventAuthorityPda(programId: PublicKey): PublicKey;
3706
3585
  static getNativePda(programId: PublicKey): PublicKey;
3586
+ static getBufferForIntentSignature(intentId: Buffer, intentProgramSigPrefix?: IntentProgramSigPrefix, chainId?: number): Buffer;
3587
+ static getDelegateApprovedBudgetsArgs(tokens: DelegateApprovedBudgetsArgs): any;
3588
+ static getBufferForBudgetSignature(delegate: PublicKey, nonce: bigint, tokens: DelegateApprovedBudgetsArgs, intentProgramSigPrefix?: IntentProgramSigPrefix, chainId?: number): Buffer;
3707
3589
  }
3708
3590
 
3709
3591
  declare class Intent implements Serializable {
@@ -3728,4 +3610,4 @@ declare class Intent implements Serializable {
3728
3610
  };
3729
3611
  }
3730
3612
 
3731
- export { DEFAULT_RECORD_OFFSET, IDL, Intent, IntentsClient };
3613
+ export { DEFAULT_RECORD_OFFSET, IDL, Intent, IntentProgramSigPrefix, IntentsClient };