@debridge-finance/intents-client 1.1.0 → 1.2.1

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
@@ -9,7 +9,7 @@ import { Buffer as Buffer$1 } from 'buffer';
9
9
  * IDL can be found at `target/idl/intents_program.json`.
10
10
  */
11
11
  type IntentsProgram = {
12
- address: "intV2u5xDE8T2ZMFP3W3X6sVqGHBT7zvYtTW3rRLmvE";
12
+ address: "intueneJjzHttKp83gWH3GX1h1Uwuixuusj4T8vGDzk";
13
13
  metadata: {
14
14
  name: "intentsProgram";
15
15
  version: "0.0.0";
@@ -89,6 +89,26 @@ type IntentsProgram = {
89
89
  }
90
90
  ];
91
91
  },
92
+ {
93
+ name: "closeAccount";
94
+ discriminator: [125, 255, 149, 14, 110, 34, 72, 24];
95
+ accounts: [
96
+ {
97
+ name: "programAuthority";
98
+ signer: true;
99
+ address: "intueneJjzHttKp83gWH3GX1h1Uwuixuusj4T8vGDzk";
100
+ },
101
+ {
102
+ name: "target";
103
+ writable: true;
104
+ },
105
+ {
106
+ name: "rentReceiver";
107
+ writable: true;
108
+ }
109
+ ];
110
+ args: [];
111
+ },
92
112
  {
93
113
  name: "closeIntent";
94
114
  discriminator: [112, 245, 154, 249, 57, 126, 54, 122];
@@ -391,6 +411,12 @@ type IntentsProgram = {
391
411
  {
392
412
  name: "dlnOrderNonce";
393
413
  type: "u64";
414
+ },
415
+ {
416
+ name: "tradeId";
417
+ type: {
418
+ array: ["u8", 32];
419
+ };
394
420
  }
395
421
  ];
396
422
  },
@@ -662,6 +688,12 @@ type IntentsProgram = {
662
688
  {
663
689
  name: "amount";
664
690
  type: "u64";
691
+ },
692
+ {
693
+ name: "tradeId";
694
+ type: {
695
+ array: ["u8", 32];
696
+ };
665
697
  }
666
698
  ];
667
699
  },
@@ -778,7 +810,7 @@ type IntentsProgram = {
778
810
  {
779
811
  name: "programAuthority";
780
812
  signer: true;
781
- address: "intV2u5xDE8T2ZMFP3W3X6sVqGHBT7zvYtTW3rRLmvE";
813
+ address: "intueneJjzHttKp83gWH3GX1h1Uwuixuusj4T8vGDzk";
782
814
  },
783
815
  {
784
816
  name: "rentPayer";
@@ -1156,6 +1188,25 @@ type IntentsProgram = {
1156
1188
  ];
1157
1189
  };
1158
1190
  },
1191
+ {
1192
+ name: "maker";
1193
+ },
1194
+ {
1195
+ name: "makerInfo";
1196
+ writable: true;
1197
+ pda: {
1198
+ seeds: [
1199
+ {
1200
+ kind: "const";
1201
+ value: [109, 97, 107, 101, 114, 95, 105, 110, 102, 111];
1202
+ },
1203
+ {
1204
+ kind: "account";
1205
+ path: "maker";
1206
+ }
1207
+ ];
1208
+ };
1209
+ },
1159
1210
  {
1160
1211
  name: "intentStorage";
1161
1212
  writable: true;
@@ -1358,6 +1409,38 @@ type IntentsProgram = {
1358
1409
  {
1359
1410
  name: "associatedTokenProgram";
1360
1411
  address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1412
+ },
1413
+ {
1414
+ name: "eventAuthority";
1415
+ pda: {
1416
+ seeds: [
1417
+ {
1418
+ kind: "const";
1419
+ value: [
1420
+ 95,
1421
+ 95,
1422
+ 101,
1423
+ 118,
1424
+ 101,
1425
+ 110,
1426
+ 116,
1427
+ 95,
1428
+ 97,
1429
+ 117,
1430
+ 116,
1431
+ 104,
1432
+ 111,
1433
+ 114,
1434
+ 105,
1435
+ 116,
1436
+ 121
1437
+ ];
1438
+ }
1439
+ ];
1440
+ };
1441
+ },
1442
+ {
1443
+ name: "program";
1361
1444
  }
1362
1445
  ];
1363
1446
  args: [
@@ -1366,12 +1449,18 @@ type IntentsProgram = {
1366
1449
  type: "u64";
1367
1450
  },
1368
1451
  {
1369
- name: "target";
1452
+ name: "expectedCreditedAccount";
1370
1453
  type: {
1371
1454
  defined: {
1372
1455
  name: "targetTokenAccount";
1373
1456
  };
1374
1457
  };
1458
+ },
1459
+ {
1460
+ name: "tradeId";
1461
+ type: {
1462
+ array: ["u8", 32];
1463
+ };
1375
1464
  }
1376
1465
  ];
1377
1466
  },
@@ -1530,9 +1619,50 @@ type IntentsProgram = {
1530
1619
  {
1531
1620
  name: "associatedTokenProgram";
1532
1621
  address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1622
+ },
1623
+ {
1624
+ name: "eventAuthority";
1625
+ pda: {
1626
+ seeds: [
1627
+ {
1628
+ kind: "const";
1629
+ value: [
1630
+ 95,
1631
+ 95,
1632
+ 101,
1633
+ 118,
1634
+ 101,
1635
+ 110,
1636
+ 116,
1637
+ 95,
1638
+ 97,
1639
+ 117,
1640
+ 116,
1641
+ 104,
1642
+ 111,
1643
+ 114,
1644
+ 105,
1645
+ 116,
1646
+ 121
1647
+ ];
1648
+ }
1649
+ ];
1650
+ };
1651
+ },
1652
+ {
1653
+ name: "program";
1654
+ }
1655
+ ];
1656
+ args: [
1657
+ {
1658
+ name: "expectedOutcomeAmount";
1659
+ type: "u64";
1660
+ },
1661
+ {
1662
+ name: "takerSurplusShareBps";
1663
+ type: "u32";
1533
1664
  }
1534
1665
  ];
1535
- args: [];
1536
1666
  },
1537
1667
  {
1538
1668
  name: "updateIntent";
@@ -1590,6 +1720,14 @@ type IntentsProgram = {
1590
1720
  name: "fulfilled";
1591
1721
  discriminator: [210, 174, 131, 213, 40, 182, 83, 110];
1592
1722
  },
1723
+ {
1724
+ name: "fulfilledDln";
1725
+ discriminator: [42, 231, 52, 35, 155, 251, 144, 108];
1726
+ },
1727
+ {
1728
+ name: "intentBudgetSpent";
1729
+ discriminator: [106, 148, 20, 168, 115, 89, 145, 56];
1730
+ },
1593
1731
  {
1594
1732
  name: "swapped";
1595
1733
  discriminator: [217, 52, 52, 83, 147, 135, 96, 109];
@@ -1694,6 +1832,10 @@ type IntentsProgram = {
1694
1832
  {
1695
1833
  code: 6022;
1696
1834
  name: "crossProgramInvokeIsRestricted";
1835
+ },
1836
+ {
1837
+ code: 6023;
1838
+ name: "invalidDlnOrderTargetTokenOrPrice";
1697
1839
  }
1698
1840
  ];
1699
1841
  types: [
@@ -1925,16 +2067,112 @@ type IntentsProgram = {
1925
2067
  kind: "struct";
1926
2068
  fields: [
1927
2069
  {
1928
- name: "amount";
2070
+ name: "intentId";
2071
+ type: {
2072
+ defined: {
2073
+ name: "intentId";
2074
+ };
2075
+ };
2076
+ },
2077
+ {
2078
+ name: "tradeId";
2079
+ type: {
2080
+ array: ["u8", 32];
2081
+ };
2082
+ },
2083
+ {
2084
+ name: "executionMetadata";
2085
+ type: {
2086
+ option: "bytes";
2087
+ };
2088
+ },
2089
+ {
2090
+ name: "takeToken";
2091
+ type: "pubkey";
2092
+ },
2093
+ {
2094
+ name: "takeTokenAmount";
1929
2095
  type: "u64";
1930
2096
  },
1931
2097
  {
1932
- name: "fee";
2098
+ name: "takeTokenFeeAmount";
1933
2099
  type: "u64";
1934
2100
  }
1935
2101
  ];
1936
2102
  };
1937
2103
  },
2104
+ {
2105
+ name: "fulfilledDln";
2106
+ type: {
2107
+ kind: "struct";
2108
+ fields: [
2109
+ {
2110
+ name: "intentId";
2111
+ type: {
2112
+ defined: {
2113
+ name: "intentId";
2114
+ };
2115
+ };
2116
+ },
2117
+ {
2118
+ name: "tradeId";
2119
+ type: {
2120
+ array: ["u8", 32];
2121
+ };
2122
+ },
2123
+ {
2124
+ name: "executionMetadata";
2125
+ type: {
2126
+ option: "bytes";
2127
+ };
2128
+ },
2129
+ {
2130
+ name: "orderId";
2131
+ type: {
2132
+ defined: {
2133
+ name: "u256";
2134
+ };
2135
+ };
2136
+ },
2137
+ {
2138
+ name: "giveToken";
2139
+ type: "pubkey";
2140
+ },
2141
+ {
2142
+ name: "giveTokenAmount";
2143
+ type: "pubkey";
2144
+ },
2145
+ {
2146
+ name: "giveTokenFeeAmount";
2147
+ type: "pubkey";
2148
+ },
2149
+ {
2150
+ name: "takeToken";
2151
+ type: {
2152
+ defined: {
2153
+ name: "address";
2154
+ };
2155
+ };
2156
+ },
2157
+ {
2158
+ name: "takeTokenAmount";
2159
+ type: {
2160
+ defined: {
2161
+ name: "u256";
2162
+ };
2163
+ };
2164
+ },
2165
+ {
2166
+ name: "takeTokenRecipient";
2167
+ type: {
2168
+ defined: {
2169
+ name: "address";
2170
+ };
2171
+ };
2172
+ }
2173
+ ];
2174
+ };
2175
+ },
1938
2176
  {
1939
2177
  name: "intentBudget";
1940
2178
  type: {
@@ -1951,6 +2189,42 @@ type IntentsProgram = {
1951
2189
  ];
1952
2190
  };
1953
2191
  },
2192
+ {
2193
+ name: "intentBudgetSpent";
2194
+ type: {
2195
+ kind: "struct";
2196
+ fields: [
2197
+ {
2198
+ name: "intentId";
2199
+ type: {
2200
+ defined: {
2201
+ name: "intentId";
2202
+ };
2203
+ };
2204
+ },
2205
+ {
2206
+ name: "tradeId";
2207
+ type: {
2208
+ array: ["u8", 32];
2209
+ };
2210
+ },
2211
+ {
2212
+ name: "executionMetadata";
2213
+ type: {
2214
+ option: "bytes";
2215
+ };
2216
+ },
2217
+ {
2218
+ name: "inputToken";
2219
+ type: "pubkey";
2220
+ },
2221
+ {
2222
+ name: "inputTokenSpentAmount";
2223
+ type: "u64";
2224
+ }
2225
+ ];
2226
+ };
2227
+ },
1954
2228
  {
1955
2229
  name: "intentBudgets";
1956
2230
  type: {
@@ -2189,11 +2463,43 @@ type IntentsProgram = {
2189
2463
  kind: "struct";
2190
2464
  fields: [
2191
2465
  {
2192
- name: "inputAmount";
2466
+ name: "intentId";
2467
+ type: {
2468
+ defined: {
2469
+ name: "intentId";
2470
+ };
2471
+ };
2472
+ },
2473
+ {
2474
+ name: "tradeId";
2475
+ type: {
2476
+ array: ["u8", 32];
2477
+ };
2478
+ },
2479
+ {
2480
+ name: "executionMetadata";
2481
+ type: {
2482
+ option: "bytes";
2483
+ };
2484
+ },
2485
+ {
2486
+ name: "inputToken";
2487
+ type: "pubkey";
2488
+ },
2489
+ {
2490
+ name: "inputTokenAmount";
2491
+ type: "u64";
2492
+ },
2493
+ {
2494
+ name: "outputToken";
2495
+ type: "pubkey";
2496
+ },
2497
+ {
2498
+ name: "outputTokenAmount";
2193
2499
  type: "u64";
2194
2500
  },
2195
2501
  {
2196
- name: "outputAmount";
2502
+ name: "takerOutputTokenShareAmount";
2197
2503
  type: "u64";
2198
2504
  }
2199
2505
  ];
@@ -2428,9 +2734,10 @@ interface SwapBeginParams {
2428
2734
  taker: PublicKey;
2429
2735
  maker: PublicKey;
2430
2736
  intentId: Buffer;
2737
+ tradeId: Buffer;
2431
2738
  inputMint: PublicKey;
2432
2739
  outputMint: PublicKey;
2433
- amount: bigint;
2740
+ beginAmount: bigint;
2434
2741
  target?: "taker" | "intent";
2435
2742
  inputTokenProgram?: PublicKey;
2436
2743
  outputTokenProgram?: PublicKey;
@@ -2438,6 +2745,8 @@ interface SwapBeginParams {
2438
2745
  interface SwapEndParams {
2439
2746
  taker: PublicKey;
2440
2747
  intentId: Buffer;
2748
+ endAmount: bigint;
2749
+ bps: number;
2441
2750
  outputMint: PublicKey;
2442
2751
  outputTokenProgram?: PublicKey;
2443
2752
  }
@@ -2445,6 +2754,7 @@ interface ExecuteIntentParams {
2445
2754
  taker: PublicKey;
2446
2755
  maker: PublicKey;
2447
2756
  intentId: Buffer;
2757
+ tradeId: Buffer;
2448
2758
  tokenMint: PublicKey;
2449
2759
  dlnOrder: {
2450
2760
  id: Buffer;
@@ -2475,13 +2785,14 @@ interface ExternalCallParams {
2475
2785
  interface ExecuteIntentSameChainParams {
2476
2786
  taker: PublicKey;
2477
2787
  maker: PublicKey;
2788
+ tradeId: Buffer;
2478
2789
  intentId: Buffer;
2479
2790
  tokenMint: PublicKey;
2480
2791
  receiver: PublicKey;
2481
2792
  amount: bigint;
2482
2793
  tokenProgram?: PublicKey;
2483
2794
  }
2484
- interface SwapParams extends SwapBeginParams {
2795
+ interface SwapParams extends SwapBeginParams, SwapEndParams {
2485
2796
  payer?: PublicKey;
2486
2797
  blockhash: Blockhash;
2487
2798
  ALTs?: Array<AddressLookupTableAccount>;
@@ -2505,14 +2816,14 @@ declare class IntentsClient {
2505
2816
  getIntentStorage(connection: Connection, intentId: Buffer$1): Promise<IntentStorage | null>;
2506
2817
  approveProtocolTransfersIxs({ owner, tokens, tokenProgram, }: ApproveProtocolTransfersParams): Promise<TransactionInstruction[]>;
2507
2818
  private closeIntentIxs;
2508
- executeIntentIxs({ intentId, taker, maker, tokenMint, dlnOrder, dlnSrc, tokenProgram, }: ExecuteIntentParams): Promise<TransactionInstruction[]>;
2509
- executeSameChainIntentIxs({ intentId, taker, maker, tokenMint, receiver, amount, tokenProgram, }: ExecuteIntentSameChainParams): Promise<TransactionInstruction[]>;
2819
+ executeIntentIxs({ tradeId, intentId, taker, maker, tokenMint, dlnOrder, dlnSrc, tokenProgram, }: ExecuteIntentParams): Promise<TransactionInstruction[]>;
2820
+ executeSameChainIntentIxs({ tradeId, intentId, taker, maker, tokenMint, receiver, amount, tokenProgram, }: ExecuteIntentSameChainParams): Promise<TransactionInstruction[]>;
2510
2821
  initIntentIxs(maker: PublicKey, payer: PublicKey, id: Buffer$1, encodedIntentLength: number, inputTokensAmount: number): Promise<TransactionInstruction[]>;
2511
2822
  initIntentUsingSigIxs(maker: PublicKey, payer: PublicKey, id: Buffer$1, encodedIntentLength: number, inputTokensAmount: number, signature: Buffer$1): Promise<TransactionInstruction[]>;
2512
2823
  setDelegateApprovedBudgetsIxs({ maker, payer, delegate, nonce, tokens, }: DelegateApprovedBudgetsParams): Promise<TransactionInstruction[]>;
2513
- swapBeginIxs({ taker, maker, intentId, amount, // 0 for tests // transfer from random wallet to taker output amount, input / output = intent price
2824
+ swapBeginIxs({ taker, maker, intentId, tradeId, beginAmount, // 0 for tests // transfer from random wallet to taker output amount, input / output = intent price
2514
2825
  target, inputMint, outputMint, inputTokenProgram, outputTokenProgram, }: SwapBeginParams): Promise<TransactionInstruction[]>;
2515
- swapEndIxs({ taker, intentId, outputMint, outputTokenProgram, }: SwapEndParams): Promise<TransactionInstruction[]>;
2826
+ swapEndIxs({ taker, intentId, endAmount, bps, outputMint, outputTokenProgram, }: SwapEndParams): Promise<TransactionInstruction[]>;
2516
2827
  updateIntentIxs({ payer, record, id, offset, length, data, }: UpdateIntentParams): Promise<TransactionInstruction[]>;
2517
2828
  closeRecordIxs({ record, authority, receiver, }: CloseRecordParams): TransactionInstruction[];
2518
2829
  writeRecordIxs({ authority, record, buffer, offset, }: WriteRecordParams): TransactionInstruction[];
@@ -2530,7 +2841,7 @@ declare class IntentsClient {
2530
2841
  createAndUpdateIntentTxs({ authority, payer, intent, signature, blockhash, ALTs, computeBudget, }: CreateAndUpdateIntentParams): Promise<VersionedTransaction[]>;
2531
2842
  updateRecordTxs({ authority, payer, record, serializedIntent, offset, blockhash, ALTs, computeBudget, }: UpdateRecordTxsParams): Promise<VersionedTransaction[]>;
2532
2843
  closeIntentTxs({ authority, payer, record, receiver, id, blockhash, ALTs, computeBudget, }: CloseIntentParams): Promise<VersionedTransaction[]>;
2533
- swapTxs({ taker, maker, intentId, inputMint, outputMint, amount, target, inputTokenProgram, outputTokenProgram, instructions, computeBudget, payer, blockhash, ALTs, }: SwapParams): Promise<VersionedTransaction[]>;
2844
+ swapTxs({ taker, maker, intentId, tradeId, inputMint, outputMint, beginAmount, endAmount, bps, target, inputTokenProgram, outputTokenProgram, instructions, computeBudget, payer, blockhash, ALTs, }: SwapParams): Promise<VersionedTransaction[]>;
2534
2845
  static getStatePda(programId: PublicKey): PublicKey;
2535
2846
  static getIntentStoragePda(programId: PublicKey, intentId: Buffer$1): PublicKey;
2536
2847
  static getMakerInfoPda(programId: PublicKey, maker: PublicKey): PublicKey;