@loyal-labs/private-transactions 0.2.7 → 0.2.9
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/README.md +69 -35
- package/dist/index.d.ts +122 -14
- package/dist/index.js +2918 -20273
- package/dist/src/LoyalPrivateTransactionsClient.d.ts +40 -13
- package/dist/src/actions/shieldTokens.d.ts +69 -0
- package/dist/src/actions/undelegateDeposit.d.ts +25 -0
- package/dist/src/actions/unshieldTokens.d.ts +62 -0
- package/dist/src/checks/enshureChecks.d.ts +5 -0
- package/dist/src/constants.d.ts +17 -2
- package/dist/src/enumerate-deposits.d.ts +23 -0
- package/dist/src/fee-estimate.d.ts +25 -0
- package/dist/src/idl/telegram_private_transfer.d.ts +182 -121
- package/dist/src/instructions/closeDeposit.d.ts +4 -0
- package/dist/src/instructions/closePermission.d.ts +2 -0
- package/dist/src/instructions/closeUsernameDeposit.d.ts +4 -0
- package/dist/src/instructions/createPermission.d.ts +4 -0
- package/dist/src/instructions/delegateDeposit.d.ts +4 -0
- package/dist/src/instructions/initializeDeposit.d.ts +4 -0
- package/dist/src/instructions/initializeUsernameDeposit.d.ts +4 -0
- package/dist/src/instructions/modifyBalance.d.ts +4 -0
- package/dist/src/instructions/undelegateDeposit.d.ts +4 -0
- package/dist/src/instructions/undelegatePermission.d.ts +2 -0
- package/dist/src/kamino.d.ts +44 -0
- package/dist/src/pda.d.ts +1 -1
- package/dist/src/rent-estimate.d.ts +46 -0
- package/dist/src/transaction-debug.d.ts +40 -0
- package/dist/src/types.d.ts +224 -3
- package/dist/src/utils.d.ts +8 -0
- package/dist/src/webcrypto.d.ts +2 -0
- package/dist/src/wsol.d.ts +14 -0
- package/package.json +6 -6
- package/dist/src/idl.d.ts +0 -1751
|
@@ -38,44 +38,88 @@ export type TelegramPrivateTransfer = {
|
|
|
38
38
|
{
|
|
39
39
|
"name": "sourceUsernameDeposit";
|
|
40
40
|
"writable": true;
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "destinationDeposit";
|
|
44
|
+
"writable": true;
|
|
41
45
|
"pda": {
|
|
42
46
|
"seeds": [
|
|
43
47
|
{
|
|
44
48
|
"kind": "const";
|
|
45
49
|
"value": [
|
|
46
|
-
117,
|
|
47
|
-
115,
|
|
48
|
-
101,
|
|
49
|
-
114,
|
|
50
|
-
110,
|
|
51
|
-
97,
|
|
52
|
-
109,
|
|
53
|
-
101,
|
|
54
|
-
95,
|
|
55
50
|
100,
|
|
56
51
|
101,
|
|
57
52
|
112,
|
|
58
53
|
111,
|
|
59
54
|
115,
|
|
60
55
|
105,
|
|
61
|
-
116
|
|
56
|
+
116,
|
|
57
|
+
95,
|
|
58
|
+
118,
|
|
59
|
+
50
|
|
62
60
|
];
|
|
63
61
|
},
|
|
64
62
|
{
|
|
65
63
|
"kind": "account";
|
|
66
|
-
"path": "
|
|
67
|
-
"account": "
|
|
64
|
+
"path": "destination_deposit.user";
|
|
65
|
+
"account": "deposit";
|
|
68
66
|
},
|
|
69
67
|
{
|
|
70
68
|
"kind": "account";
|
|
71
|
-
"path": "
|
|
72
|
-
"account": "
|
|
69
|
+
"path": "destination_deposit.token_mint";
|
|
70
|
+
"account": "deposit";
|
|
73
71
|
}
|
|
74
72
|
];
|
|
75
73
|
};
|
|
76
74
|
},
|
|
77
75
|
{
|
|
78
|
-
"name": "
|
|
76
|
+
"name": "tokenMint";
|
|
77
|
+
"relations": [
|
|
78
|
+
"sourceUsernameDeposit",
|
|
79
|
+
"destinationDeposit"
|
|
80
|
+
];
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "session";
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "tokenProgram";
|
|
87
|
+
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
"args": [
|
|
91
|
+
{
|
|
92
|
+
"name": "amount";
|
|
93
|
+
"type": "u64";
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "closeDeposit";
|
|
99
|
+
"docs": [
|
|
100
|
+
"Closes an empty user deposit account and returns its rent to the deposit owner."
|
|
101
|
+
];
|
|
102
|
+
"discriminator": [
|
|
103
|
+
200,
|
|
104
|
+
19,
|
|
105
|
+
254,
|
|
106
|
+
192,
|
|
107
|
+
15,
|
|
108
|
+
110,
|
|
109
|
+
209,
|
|
110
|
+
179
|
|
111
|
+
];
|
|
112
|
+
"accounts": [
|
|
113
|
+
{
|
|
114
|
+
"name": "user";
|
|
115
|
+
"writable": true;
|
|
116
|
+
"signer": true;
|
|
117
|
+
"relations": [
|
|
118
|
+
"deposit"
|
|
119
|
+
];
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "deposit";
|
|
79
123
|
"writable": true;
|
|
80
124
|
"pda": {
|
|
81
125
|
"seeds": [
|
|
@@ -96,13 +140,11 @@ export type TelegramPrivateTransfer = {
|
|
|
96
140
|
},
|
|
97
141
|
{
|
|
98
142
|
"kind": "account";
|
|
99
|
-
"path": "
|
|
100
|
-
"account": "deposit";
|
|
143
|
+
"path": "user";
|
|
101
144
|
},
|
|
102
145
|
{
|
|
103
146
|
"kind": "account";
|
|
104
|
-
"path": "
|
|
105
|
-
"account": "deposit";
|
|
147
|
+
"path": "tokenMint";
|
|
106
148
|
}
|
|
107
149
|
];
|
|
108
150
|
};
|
|
@@ -110,24 +152,48 @@ export type TelegramPrivateTransfer = {
|
|
|
110
152
|
{
|
|
111
153
|
"name": "tokenMint";
|
|
112
154
|
"relations": [
|
|
113
|
-
"
|
|
114
|
-
"destinationDeposit"
|
|
155
|
+
"deposit"
|
|
115
156
|
];
|
|
157
|
+
}
|
|
158
|
+
];
|
|
159
|
+
"args": [];
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "closeUsernameDeposit";
|
|
163
|
+
"docs": [
|
|
164
|
+
"Closes an empty username deposit account after verified username ownership."
|
|
165
|
+
];
|
|
166
|
+
"discriminator": [
|
|
167
|
+
238,
|
|
168
|
+
181,
|
|
169
|
+
185,
|
|
170
|
+
209,
|
|
171
|
+
149,
|
|
172
|
+
161,
|
|
173
|
+
124,
|
|
174
|
+
79
|
|
175
|
+
];
|
|
176
|
+
"accounts": [
|
|
177
|
+
{
|
|
178
|
+
"name": "authority";
|
|
179
|
+
"writable": true;
|
|
180
|
+
"signer": true;
|
|
116
181
|
},
|
|
117
182
|
{
|
|
118
|
-
"name": "
|
|
183
|
+
"name": "deposit";
|
|
184
|
+
"writable": true;
|
|
119
185
|
},
|
|
120
186
|
{
|
|
121
|
-
"name": "
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
187
|
+
"name": "tokenMint";
|
|
188
|
+
"relations": [
|
|
189
|
+
"deposit"
|
|
190
|
+
];
|
|
191
|
+
},
|
|
126
192
|
{
|
|
127
|
-
"name": "
|
|
128
|
-
"type": "u64";
|
|
193
|
+
"name": "session";
|
|
129
194
|
}
|
|
130
195
|
];
|
|
196
|
+
"args": [];
|
|
131
197
|
},
|
|
132
198
|
{
|
|
133
199
|
"name": "createPermission";
|
|
@@ -228,41 +294,6 @@ export type TelegramPrivateTransfer = {
|
|
|
228
294
|
},
|
|
229
295
|
{
|
|
230
296
|
"name": "deposit";
|
|
231
|
-
"pda": {
|
|
232
|
-
"seeds": [
|
|
233
|
-
{
|
|
234
|
-
"kind": "const";
|
|
235
|
-
"value": [
|
|
236
|
-
117,
|
|
237
|
-
115,
|
|
238
|
-
101,
|
|
239
|
-
114,
|
|
240
|
-
110,
|
|
241
|
-
97,
|
|
242
|
-
109,
|
|
243
|
-
101,
|
|
244
|
-
95,
|
|
245
|
-
100,
|
|
246
|
-
101,
|
|
247
|
-
112,
|
|
248
|
-
111,
|
|
249
|
-
115,
|
|
250
|
-
105,
|
|
251
|
-
116
|
|
252
|
-
];
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
"kind": "account";
|
|
256
|
-
"path": "deposit.username";
|
|
257
|
-
"account": "usernameDeposit";
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
"kind": "account";
|
|
261
|
-
"path": "deposit.token_mint";
|
|
262
|
-
"account": "usernameDeposit";
|
|
263
|
-
}
|
|
264
|
-
];
|
|
265
|
-
};
|
|
266
297
|
},
|
|
267
298
|
{
|
|
268
299
|
"name": "session";
|
|
@@ -673,12 +704,15 @@ export type TelegramPrivateTransfer = {
|
|
|
673
704
|
111,
|
|
674
705
|
115,
|
|
675
706
|
105,
|
|
676
|
-
116
|
|
707
|
+
116,
|
|
708
|
+
95,
|
|
709
|
+
118,
|
|
710
|
+
50
|
|
677
711
|
];
|
|
678
712
|
},
|
|
679
713
|
{
|
|
680
714
|
"kind": "arg";
|
|
681
|
-
"path": "
|
|
715
|
+
"path": "usernameHash";
|
|
682
716
|
},
|
|
683
717
|
{
|
|
684
718
|
"kind": "arg";
|
|
@@ -702,8 +736,13 @@ export type TelegramPrivateTransfer = {
|
|
|
702
736
|
];
|
|
703
737
|
"args": [
|
|
704
738
|
{
|
|
705
|
-
"name": "
|
|
706
|
-
"type":
|
|
739
|
+
"name": "usernameHash";
|
|
740
|
+
"type": {
|
|
741
|
+
"array": [
|
|
742
|
+
"u8",
|
|
743
|
+
32
|
|
744
|
+
];
|
|
745
|
+
};
|
|
707
746
|
},
|
|
708
747
|
{
|
|
709
748
|
"name": "tokenMint";
|
|
@@ -824,12 +863,15 @@ export type TelegramPrivateTransfer = {
|
|
|
824
863
|
111,
|
|
825
864
|
115,
|
|
826
865
|
105,
|
|
827
|
-
116
|
|
866
|
+
116,
|
|
867
|
+
95,
|
|
868
|
+
118,
|
|
869
|
+
50
|
|
828
870
|
];
|
|
829
871
|
},
|
|
830
872
|
{
|
|
831
873
|
"kind": "arg";
|
|
832
|
-
"path": "
|
|
874
|
+
"path": "usernameHash";
|
|
833
875
|
},
|
|
834
876
|
{
|
|
835
877
|
"kind": "account";
|
|
@@ -852,18 +894,33 @@ export type TelegramPrivateTransfer = {
|
|
|
852
894
|
];
|
|
853
895
|
"args": [
|
|
854
896
|
{
|
|
855
|
-
"name": "
|
|
856
|
-
"type":
|
|
897
|
+
"name": "usernameHash";
|
|
898
|
+
"type": {
|
|
899
|
+
"array": [
|
|
900
|
+
"u8",
|
|
901
|
+
32
|
|
902
|
+
];
|
|
903
|
+
};
|
|
857
904
|
}
|
|
858
905
|
];
|
|
859
906
|
},
|
|
860
907
|
{
|
|
861
908
|
"name": "modifyBalance";
|
|
862
909
|
"docs": [
|
|
863
|
-
"Modifies
|
|
910
|
+
"Modifies a user's deposit balance and the backing vault position for the given mint.",
|
|
911
|
+
"",
|
|
912
|
+
"For non-USDC mints, this is a direct vault transfer: if `args.increase` is true, `args.amount`",
|
|
913
|
+
"is transferred from the user's token account to the vault token account and added to",
|
|
914
|
+
"`deposit.amount`. If false, `args.amount` is transferred from the vault token account back to",
|
|
915
|
+
"the user's token account and subtracted from `deposit.amount`.",
|
|
864
916
|
"",
|
|
865
|
-
"
|
|
866
|
-
"If
|
|
917
|
+
"For USDC, liquidity is routed through Kamino Lending instead of being left idle in the vault.",
|
|
918
|
+
"If `args.increase` is true, `args.amount` USDC is transferred into the vault token account,",
|
|
919
|
+
"supplied to the configured Kamino reserve, and `deposit.amount` is increased by the Kamino",
|
|
920
|
+
"reserve collateral shares (kTokens) minted to the vault. If false, `args.amount` is",
|
|
921
|
+
"interpreted as the Kamino share amount to redeem; the reserve returns the corresponding USDC",
|
|
922
|
+
"at the current exchange rate, that USDC is transferred from the vault token account to the",
|
|
923
|
+
"user's token account, and `deposit.amount` is decreased by the burned share amount."
|
|
867
924
|
];
|
|
868
925
|
"discriminator": [
|
|
869
926
|
148,
|
|
@@ -1378,41 +1435,6 @@ export type TelegramPrivateTransfer = {
|
|
|
1378
1435
|
{
|
|
1379
1436
|
"name": "destinationDeposit";
|
|
1380
1437
|
"writable": true;
|
|
1381
|
-
"pda": {
|
|
1382
|
-
"seeds": [
|
|
1383
|
-
{
|
|
1384
|
-
"kind": "const";
|
|
1385
|
-
"value": [
|
|
1386
|
-
117,
|
|
1387
|
-
115,
|
|
1388
|
-
101,
|
|
1389
|
-
114,
|
|
1390
|
-
110,
|
|
1391
|
-
97,
|
|
1392
|
-
109,
|
|
1393
|
-
101,
|
|
1394
|
-
95,
|
|
1395
|
-
100,
|
|
1396
|
-
101,
|
|
1397
|
-
112,
|
|
1398
|
-
111,
|
|
1399
|
-
115,
|
|
1400
|
-
105,
|
|
1401
|
-
116
|
|
1402
|
-
];
|
|
1403
|
-
},
|
|
1404
|
-
{
|
|
1405
|
-
"kind": "account";
|
|
1406
|
-
"path": "destination_deposit.username";
|
|
1407
|
-
"account": "usernameDeposit";
|
|
1408
|
-
},
|
|
1409
|
-
{
|
|
1410
|
-
"kind": "account";
|
|
1411
|
-
"path": "destination_deposit.token_mint";
|
|
1412
|
-
"account": "usernameDeposit";
|
|
1413
|
-
}
|
|
1414
|
-
];
|
|
1415
|
-
};
|
|
1416
1438
|
},
|
|
1417
1439
|
{
|
|
1418
1440
|
"name": "tokenMint";
|
|
@@ -1554,12 +1576,15 @@ export type TelegramPrivateTransfer = {
|
|
|
1554
1576
|
111,
|
|
1555
1577
|
115,
|
|
1556
1578
|
105,
|
|
1557
|
-
116
|
|
1579
|
+
116,
|
|
1580
|
+
95,
|
|
1581
|
+
118,
|
|
1582
|
+
50
|
|
1558
1583
|
];
|
|
1559
1584
|
},
|
|
1560
1585
|
{
|
|
1561
1586
|
"kind": "arg";
|
|
1562
|
-
"path": "
|
|
1587
|
+
"path": "usernameHash";
|
|
1563
1588
|
},
|
|
1564
1589
|
{
|
|
1565
1590
|
"kind": "arg";
|
|
@@ -1580,8 +1605,13 @@ export type TelegramPrivateTransfer = {
|
|
|
1580
1605
|
];
|
|
1581
1606
|
"args": [
|
|
1582
1607
|
{
|
|
1583
|
-
"name": "
|
|
1584
|
-
"type":
|
|
1608
|
+
"name": "usernameHash";
|
|
1609
|
+
"type": {
|
|
1610
|
+
"array": [
|
|
1611
|
+
"u8",
|
|
1612
|
+
32
|
|
1613
|
+
];
|
|
1614
|
+
};
|
|
1585
1615
|
},
|
|
1586
1616
|
{
|
|
1587
1617
|
"name": "tokenMint";
|
|
@@ -1717,6 +1747,21 @@ export type TelegramPrivateTransfer = {
|
|
|
1717
1747
|
"code": 6011;
|
|
1718
1748
|
"name": "invalidDepositor";
|
|
1719
1749
|
"msg": "Invalid Depositor";
|
|
1750
|
+
},
|
|
1751
|
+
{
|
|
1752
|
+
"code": 6012;
|
|
1753
|
+
"name": "invalidKaminoAccounts";
|
|
1754
|
+
"msg": "Invalid Kamino accounts";
|
|
1755
|
+
},
|
|
1756
|
+
{
|
|
1757
|
+
"code": 6013;
|
|
1758
|
+
"name": "invalidAmount";
|
|
1759
|
+
"msg": "Invalid amount";
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
"code": 6014;
|
|
1763
|
+
"name": "nonZeroDeposit";
|
|
1764
|
+
"msg": "Deposit account must have zero amount before it can be closed";
|
|
1720
1765
|
}
|
|
1721
1766
|
];
|
|
1722
1767
|
"types": [
|
|
@@ -1738,6 +1783,10 @@ export type TelegramPrivateTransfer = {
|
|
|
1738
1783
|
},
|
|
1739
1784
|
{
|
|
1740
1785
|
"name": "amount";
|
|
1786
|
+
"docs": [
|
|
1787
|
+
"For USDC deposits, this stores the Kamino share token amount.",
|
|
1788
|
+
"For all other mints, this stores the deposited liquidity token amount."
|
|
1789
|
+
];
|
|
1741
1790
|
"type": "u64";
|
|
1742
1791
|
}
|
|
1743
1792
|
];
|
|
@@ -1793,8 +1842,13 @@ export type TelegramPrivateTransfer = {
|
|
|
1793
1842
|
"type": "pubkey";
|
|
1794
1843
|
},
|
|
1795
1844
|
{
|
|
1796
|
-
"name": "
|
|
1797
|
-
"type":
|
|
1845
|
+
"name": "usernameHash";
|
|
1846
|
+
"type": {
|
|
1847
|
+
"array": [
|
|
1848
|
+
"u8",
|
|
1849
|
+
32
|
|
1850
|
+
];
|
|
1851
|
+
};
|
|
1798
1852
|
},
|
|
1799
1853
|
{
|
|
1800
1854
|
"name": "validationBytes";
|
|
@@ -1820,16 +1874,19 @@ export type TelegramPrivateTransfer = {
|
|
|
1820
1874
|
{
|
|
1821
1875
|
"name": "usernameDeposit";
|
|
1822
1876
|
"docs": [
|
|
1823
|
-
"A deposit account for a telegram username and token mint."
|
|
1824
|
-
"",
|
|
1825
|
-
"Telegram username is always lowercase (a-z, 0-9 and underscores)"
|
|
1877
|
+
"A deposit account for a telegram username sha256 hash and token mint."
|
|
1826
1878
|
];
|
|
1827
1879
|
"type": {
|
|
1828
1880
|
"kind": "struct";
|
|
1829
1881
|
"fields": [
|
|
1830
1882
|
{
|
|
1831
|
-
"name": "
|
|
1832
|
-
"type":
|
|
1883
|
+
"name": "usernameHash";
|
|
1884
|
+
"type": {
|
|
1885
|
+
"array": [
|
|
1886
|
+
"u8",
|
|
1887
|
+
32
|
|
1888
|
+
];
|
|
1889
|
+
};
|
|
1833
1890
|
},
|
|
1834
1891
|
{
|
|
1835
1892
|
"name": "tokenMint";
|
|
@@ -1837,6 +1894,10 @@ export type TelegramPrivateTransfer = {
|
|
|
1837
1894
|
},
|
|
1838
1895
|
{
|
|
1839
1896
|
"name": "amount";
|
|
1897
|
+
"docs": [
|
|
1898
|
+
"For USDC deposits, this stores the Kamino share token amount.",
|
|
1899
|
+
"For all other mints, this stores the deposited liquidity token amount."
|
|
1900
|
+
];
|
|
1840
1901
|
"type": "u64";
|
|
1841
1902
|
}
|
|
1842
1903
|
];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Program } from "@coral-xyz/anchor";
|
|
2
|
+
import type { CheckedTransactionInstruction, CloseDepositParams } from "../types";
|
|
3
|
+
import type { TelegramPrivateTransfer } from "../idl/telegram_private_transfer";
|
|
4
|
+
export declare function closeDepositIx(program: Program<TelegramPrivateTransfer>, params: CloseDepositParams): Promise<CheckedTransactionInstruction>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Program } from "@coral-xyz/anchor";
|
|
2
|
+
import type { CheckedTransactionInstruction, CloseUsernameDepositParams } from "../types";
|
|
3
|
+
import type { TelegramPrivateTransfer } from "../idl/telegram_private_transfer";
|
|
4
|
+
export declare function closeUsernameDepositIx(program: Program<TelegramPrivateTransfer>, params: CloseUsernameDepositParams): Promise<CheckedTransactionInstruction>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Program } from "@coral-xyz/anchor";
|
|
2
|
+
import type { TelegramPrivateTransfer } from "../idl/telegram_private_transfer";
|
|
3
|
+
import type { CheckedTransactionInstruction, CreatePermissionParams } from "../types";
|
|
4
|
+
export declare function createPermissionIx(program: Program<TelegramPrivateTransfer>, params: CreatePermissionParams): Promise<CheckedTransactionInstruction>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Program } from "@coral-xyz/anchor";
|
|
2
|
+
import type { CheckedTransactionInstruction, DelegateDepositParams } from "../types";
|
|
3
|
+
import type { TelegramPrivateTransfer } from "../idl/telegram_private_transfer";
|
|
4
|
+
export declare function delegateDepositIx(program: Program<TelegramPrivateTransfer>, params: DelegateDepositParams): Promise<CheckedTransactionInstruction>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Program } from "@coral-xyz/anchor";
|
|
2
|
+
import type { TelegramPrivateTransfer } from "../idl/telegram_private_transfer";
|
|
3
|
+
import type { CheckedTransactionInstruction, InitializeDepositParams } from "../types";
|
|
4
|
+
export declare function initializeDepositIx(program: Program<TelegramPrivateTransfer>, params: InitializeDepositParams): Promise<CheckedTransactionInstruction>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Program } from "@coral-xyz/anchor";
|
|
2
|
+
import type { CheckedTransactionInstruction, InitializeUsernameDepositParams } from "../types";
|
|
3
|
+
import type { TelegramPrivateTransfer } from "../idl/telegram_private_transfer";
|
|
4
|
+
export declare function initializeUsernameDepositIx(program: Program<TelegramPrivateTransfer>, params: InitializeUsernameDepositParams): Promise<CheckedTransactionInstruction>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Program } from "@coral-xyz/anchor";
|
|
2
|
+
import type { CheckedTransactionInstruction, ModifyBalanceParams } from "../types";
|
|
3
|
+
import type { TelegramPrivateTransfer } from "../idl/telegram_private_transfer";
|
|
4
|
+
export declare function modifyBalanceIx(program: Program<TelegramPrivateTransfer>, params: ModifyBalanceParams): Promise<CheckedTransactionInstruction>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Program } from "@coral-xyz/anchor";
|
|
2
|
+
import type { TelegramPrivateTransfer } from "../idl/telegram_private_transfer";
|
|
3
|
+
import type { CheckedTransactionInstruction, UndelegateDepositParams } from "../types";
|
|
4
|
+
export declare function undelegateDepositIx(perProgram: Program<TelegramPrivateTransfer>, params: UndelegateDepositParams): Promise<CheckedTransactionInstruction>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Connection, PublicKey } from "@solana/web3.js";
|
|
2
|
+
import { type KaminoModifyBalanceAccounts } from "./constants";
|
|
3
|
+
import type { KaminoPositionYieldInfo, KaminoReserveSnapshot } from "./types";
|
|
4
|
+
export declare function parseKaminoReserveSnapshotFromAccountData(args: {
|
|
5
|
+
data: Buffer | Uint8Array;
|
|
6
|
+
reserve: PublicKey;
|
|
7
|
+
tokenMint: PublicKey;
|
|
8
|
+
}): KaminoReserveSnapshot;
|
|
9
|
+
export declare function calculateKaminoRedeemableLiquidityAmountRaw(snapshot: KaminoReserveSnapshot, shareAmountRaw: bigint | number): bigint;
|
|
10
|
+
export declare function calculateKaminoShareAmountForLiquidityAmountRaw(args: {
|
|
11
|
+
snapshot: KaminoReserveSnapshot;
|
|
12
|
+
liquidityAmountRaw: bigint | number;
|
|
13
|
+
rounding?: "floor" | "ceil";
|
|
14
|
+
}): bigint;
|
|
15
|
+
export declare function calculateKaminoTrackedLiquidityCostBasisRaw(args: {
|
|
16
|
+
currentShareAmountRaw: bigint | number;
|
|
17
|
+
trackedShareAmountRaw?: bigint | number | null;
|
|
18
|
+
trackedLiquidityAmountRaw?: bigint | number | null;
|
|
19
|
+
}): bigint | null;
|
|
20
|
+
export declare function calculateKaminoCollateralExchangeRateSfFromAmounts(args: {
|
|
21
|
+
collateralAmount: bigint | number;
|
|
22
|
+
liquidityAmount: bigint | number;
|
|
23
|
+
}): bigint | null;
|
|
24
|
+
export declare function calculateKaminoCollateralValuation(args: {
|
|
25
|
+
snapshot: KaminoReserveSnapshot;
|
|
26
|
+
collateralAmount: bigint | number;
|
|
27
|
+
principalLiquidityAmount?: bigint | number | null;
|
|
28
|
+
shieldCollateralExchangeRateSf?: bigint | number | null;
|
|
29
|
+
}): {
|
|
30
|
+
currentLiquidityAmount: bigint;
|
|
31
|
+
principalLiquidityAmount: bigint | null;
|
|
32
|
+
earnedLiquidityAmount: bigint | null;
|
|
33
|
+
};
|
|
34
|
+
export declare function calculateKaminoPositionYieldInfoFromSnapshot(args: {
|
|
35
|
+
snapshot: KaminoReserveSnapshot;
|
|
36
|
+
shareAmountRaw: bigint | number;
|
|
37
|
+
trackedShareAmountRaw?: bigint | number | null;
|
|
38
|
+
trackedLiquidityAmountRaw?: bigint | number | null;
|
|
39
|
+
}): KaminoPositionYieldInfo;
|
|
40
|
+
export declare function fetchKaminoReserveSnapshot(args: {
|
|
41
|
+
connection: Connection;
|
|
42
|
+
tokenMint: PublicKey;
|
|
43
|
+
kaminoAccounts?: KaminoModifyBalanceAccounts;
|
|
44
|
+
}): Promise<KaminoReserveSnapshot | null>;
|
package/dist/src/pda.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare function findDepositPda(user: PublicKey, tokenMint: PublicKey, pr
|
|
|
16
16
|
* @param programId - Optional program ID (defaults to PROGRAM_ID)
|
|
17
17
|
* @returns [PDA address, bump seed]
|
|
18
18
|
*/
|
|
19
|
-
export declare function findUsernameDepositPda(username: string, tokenMint: PublicKey, programId?: PublicKey): [PublicKey, number]
|
|
19
|
+
export declare function findUsernameDepositPda(username: string, tokenMint: PublicKey, programId?: PublicKey): Promise<[PublicKey, number]>;
|
|
20
20
|
/**
|
|
21
21
|
* Derive the vault PDA
|
|
22
22
|
*
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Connection, PublicKey } from "@solana/web3.js";
|
|
2
|
+
export declare const MAGICBLOCK_UNDELEGATE_SESSION_FEE_LAMPORTS = 300000;
|
|
3
|
+
export declare const DEPOSIT_ACCOUNT_SIZE: number;
|
|
4
|
+
export declare const VAULT_ACCOUNT_SIZE: number;
|
|
5
|
+
export declare const PERMISSION_ACCOUNT_SIZE = 567;
|
|
6
|
+
export declare const DELEGATION_RECORD_ACCOUNT_SIZE: number;
|
|
7
|
+
export type RentAccountEstimate = {
|
|
8
|
+
address: PublicKey;
|
|
9
|
+
space: number;
|
|
10
|
+
forceCreate?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function estimateNewAccountRentLamports(params: {
|
|
13
|
+
connection: Connection;
|
|
14
|
+
accounts: RentAccountEstimate[];
|
|
15
|
+
}): Promise<number>;
|
|
16
|
+
export declare function estimateExistingAccountLamports(params: {
|
|
17
|
+
connection: Connection;
|
|
18
|
+
accounts: PublicKey[];
|
|
19
|
+
}): Promise<number>;
|
|
20
|
+
export declare function estimateDepositRentLamports(params: {
|
|
21
|
+
connection: Connection;
|
|
22
|
+
depositPda: PublicKey;
|
|
23
|
+
forceCreate?: boolean;
|
|
24
|
+
}): Promise<number>;
|
|
25
|
+
export declare function estimateModifyBalanceRentLamports(params: {
|
|
26
|
+
connection: Connection;
|
|
27
|
+
user: PublicKey;
|
|
28
|
+
tokenMint: PublicKey;
|
|
29
|
+
isNativeSol: boolean;
|
|
30
|
+
}): Promise<number>;
|
|
31
|
+
export declare function estimatePermissionRentLamports(params: {
|
|
32
|
+
connection: Connection;
|
|
33
|
+
permissionPda: PublicKey;
|
|
34
|
+
forceCreate?: boolean;
|
|
35
|
+
}): Promise<number>;
|
|
36
|
+
export declare function estimateDepositDelegationRentLamports(params: {
|
|
37
|
+
connection: Connection;
|
|
38
|
+
user: PublicKey;
|
|
39
|
+
tokenMint: PublicKey;
|
|
40
|
+
depositPda: PublicKey;
|
|
41
|
+
forceCreate?: boolean;
|
|
42
|
+
}): Promise<number>;
|
|
43
|
+
export declare function estimateDepositDelegationRentCreditLamports(params: {
|
|
44
|
+
connection: Connection;
|
|
45
|
+
depositPda: PublicKey;
|
|
46
|
+
}): Promise<number>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Connection, Transaction, type Signer } from "@solana/web3.js";
|
|
2
|
+
import type { Provider } from "@coral-xyz/anchor";
|
|
3
|
+
import type { RpcOptions } from "./types";
|
|
4
|
+
export declare function logFailedTransactionDiagnostics(params: {
|
|
5
|
+
label: string;
|
|
6
|
+
connection: Connection;
|
|
7
|
+
tx: Transaction;
|
|
8
|
+
error: unknown;
|
|
9
|
+
extraContext?: Record<string, unknown>;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Sign, broadcast, and verify a transaction while keeping the
|
|
13
|
+
* signature in hand across confirmation hiccups.
|
|
14
|
+
*
|
|
15
|
+
* The previous implementation delegated to `provider.sendAndConfirm`,
|
|
16
|
+
* which in turn called `connection.confirmTransaction({signature,
|
|
17
|
+
* blockhash, lastValidBlockHeight})`. With Seeker / Seed Vault the
|
|
18
|
+
* user may spend 5–30s between tapping our preview sheet and
|
|
19
|
+
* biometric-confirming on device; by the time Anchor starts its
|
|
20
|
+
* confirmation poll, the RPC node's poll window has often lapsed and
|
|
21
|
+
* `confirmTransaction` throws `TransactionExpiredBlockheightExceeded`
|
|
22
|
+
* — even though the tx is on chain and has moved funds. Anchor
|
|
23
|
+
* re-throws and the signature is lost, so callers surface "Shield
|
|
24
|
+
* failed" on what was actually a success.
|
|
25
|
+
*
|
|
26
|
+
* We handle the send + confirm ourselves:
|
|
27
|
+
* 1. Stamp blockhash + fee payer, sign via the provider's wallet.
|
|
28
|
+
* 2. Broadcast via `sendRawTransaction` — we now own the signature.
|
|
29
|
+
* 3. Poll `getSignatureStatuses` until landed / failed / dropped.
|
|
30
|
+
* This keeps real failures loud while immunizing callers from the
|
|
31
|
+
* "on-chain but our poll timed out" race.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sendAndConfirmWithDiagnostics(params: {
|
|
34
|
+
label: string;
|
|
35
|
+
provider: Provider;
|
|
36
|
+
tx: Transaction;
|
|
37
|
+
signers?: Signer[];
|
|
38
|
+
rpcOptions?: RpcOptions;
|
|
39
|
+
extraContext?: Record<string, unknown>;
|
|
40
|
+
}): Promise<string>;
|