@bitgo/public-types 5.97.0 → 6.0.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/src/schema/transactionRequest/intents/intent.d.ts +40 -26
- package/dist/src/schema/transactionRequest/intents/solAuthorizeIntent.d.ts +2 -2
- package/dist/src/schema/transactionRequest/intents/solBuildOptions.d.ts +2 -2
- package/dist/src/schema/transactionRequest/intents/solBuildOptions.js +2 -3
- package/dist/src/schema/transactionRequest/intents/solBuildOptions.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/solClaimIntent.d.ts +2 -2
- package/dist/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.d.ts +32 -5
- package/dist/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.js +18 -2
- package/dist/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/solCreateAssociatedTokenAccountIntent.d.ts +2 -2
- package/dist/src/schema/transactionRequest/intents/solCustomTxIntent.d.ts +2 -2
- package/dist/src/schema/transactionRequest/intents/solDeactivateIntent.d.ts +2 -2
- package/dist/src/schema/transactionRequest/intents/solDelegateIntent.d.ts +2 -2
- package/dist/src/schema/transactionRequest/intents/solGoUnstakeIntent.d.ts +2 -2
- package/dist/src/schema/transactionRequest/intents/solPaymentIntent.d.ts +2 -2
- package/dist/src/schema/transactionRequest/intents/solStakeIntent.d.ts +4 -4
- package/dist/src/schema/transactionRequest/intents/solUnstakeIntent.d.ts +4 -4
- package/dist/src/schema/transactionRequest/intents/solVersionedCustomTxIntent.d.ts +2 -2
- package/dist/src/schema/transactionRequest/transactionRequest.d.ts +80 -52
- package/dist/src/utils/getAssetsFromIntent.js +13 -4
- package/dist/src/utils/getAssetsFromIntent.js.map +1 -1
- package/package.json +1 -1
- package/src/schema/transactionRequest/intents/solBuildOptions.ts +20 -3
- package/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.ts +94 -5
- package/src/utils/getAssetsFromIntent.ts +21 -4
|
@@ -5058,8 +5058,8 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5058
5058
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5059
5059
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5060
5060
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5061
|
-
}>, t.
|
|
5062
|
-
memo: t.
|
|
5061
|
+
}>, t.PartialC<{
|
|
5062
|
+
memo: t.StringC;
|
|
5063
5063
|
}>]>, t.TypeC<{
|
|
5064
5064
|
intentType: t.LiteralC<"authorize">;
|
|
5065
5065
|
transactionMessage: t.StringC;
|
|
@@ -5145,8 +5145,8 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5145
5145
|
}, unknown>, t.UndefinedC]>;
|
|
5146
5146
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5147
5147
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5148
|
-
}>, t.
|
|
5149
|
-
memo: t.
|
|
5148
|
+
}>, t.PartialC<{
|
|
5149
|
+
memo: t.StringC;
|
|
5150
5150
|
}>]>, t.TypeC<{
|
|
5151
5151
|
amount: t.TypeC<{
|
|
5152
5152
|
value: t.StringC;
|
|
@@ -5215,12 +5215,26 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5215
5215
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5216
5216
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5217
5217
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5218
|
-
}>, t.
|
|
5219
|
-
memo: t.
|
|
5218
|
+
}>, t.PartialC<{
|
|
5219
|
+
memo: t.StringC;
|
|
5220
5220
|
}>]>, t.TypeC<{
|
|
5221
5221
|
intentType: t.LiteralC<"closeAssociatedTokenAccount">;
|
|
5222
|
-
|
|
5223
|
-
|
|
5222
|
+
recipients: t.RefinementC<t.ArrayC<t.RefinementC<t.IntersectionC<[t.TypeC<{
|
|
5223
|
+
address: t.PartialC<{
|
|
5224
|
+
address: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
5225
|
+
option: t.UnionC<[t.Type<{
|
|
5226
|
+
[x: string]: unknown;
|
|
5227
|
+
}, {
|
|
5228
|
+
[x: string]: unknown;
|
|
5229
|
+
}, unknown>, t.UndefinedC]>;
|
|
5230
|
+
}>;
|
|
5231
|
+
amount: t.TypeC<{
|
|
5232
|
+
value: t.StringC;
|
|
5233
|
+
symbol: t.StringC;
|
|
5234
|
+
}>;
|
|
5235
|
+
}>, t.PartialC<{
|
|
5236
|
+
data: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
5237
|
+
}>]>>>>;
|
|
5224
5238
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5225
5239
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5226
5240
|
}>, t.TypeC<{
|
|
@@ -5349,8 +5363,8 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5349
5363
|
}>]>>;
|
|
5350
5364
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5351
5365
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5352
|
-
}>, t.
|
|
5353
|
-
memo: t.
|
|
5366
|
+
}>, t.PartialC<{
|
|
5367
|
+
memo: t.StringC;
|
|
5354
5368
|
}>]>]>, t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
5355
5369
|
intentType: t.KeyofC<{
|
|
5356
5370
|
payment: t.LiteralC<"payment">;
|
|
@@ -5412,8 +5426,8 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5412
5426
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5413
5427
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5414
5428
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5415
|
-
}>, t.
|
|
5416
|
-
memo: t.
|
|
5429
|
+
}>, t.PartialC<{
|
|
5430
|
+
memo: t.StringC;
|
|
5417
5431
|
}>]>, t.TypeC<{
|
|
5418
5432
|
intentType: t.LiteralC<"customTx">;
|
|
5419
5433
|
solInstructions: t.ArrayC<t.TypeC<{
|
|
@@ -5486,8 +5500,8 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5486
5500
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5487
5501
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5488
5502
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5489
|
-
}>, t.
|
|
5490
|
-
memo: t.
|
|
5503
|
+
}>, t.PartialC<{
|
|
5504
|
+
memo: t.StringC;
|
|
5491
5505
|
}>]>, t.TypeC<{
|
|
5492
5506
|
intentType: t.LiteralC<"deactivate">;
|
|
5493
5507
|
stakingAddresses: t.UnionC<[t.Type<string[], string[], unknown>, t.UndefinedC]>;
|
|
@@ -5553,8 +5567,8 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5553
5567
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5554
5568
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5555
5569
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5556
|
-
}>, t.
|
|
5557
|
-
memo: t.
|
|
5570
|
+
}>, t.PartialC<{
|
|
5571
|
+
memo: t.StringC;
|
|
5558
5572
|
}>]>, t.TypeC<{
|
|
5559
5573
|
intentType: t.LiteralC<"delegate">;
|
|
5560
5574
|
validatorAddress: t.StringC;
|
|
@@ -5641,8 +5655,8 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5641
5655
|
}>]>>;
|
|
5642
5656
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5643
5657
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5644
|
-
}>, t.
|
|
5645
|
-
memo: t.
|
|
5658
|
+
}>, t.PartialC<{
|
|
5659
|
+
memo: t.StringC;
|
|
5646
5660
|
}>]>]>, t.IntersectionC<[t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
5647
5661
|
intentType: t.KeyofC<{
|
|
5648
5662
|
payment: t.LiteralC<"payment">;
|
|
@@ -5726,8 +5740,8 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5726
5740
|
isTestTransaction: t.BooleanC;
|
|
5727
5741
|
}>]>]>, t.IntersectionC<[t.PartialC<{
|
|
5728
5742
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5729
|
-
}>, t.
|
|
5730
|
-
memo: t.
|
|
5743
|
+
}>, t.PartialC<{
|
|
5744
|
+
memo: t.StringC;
|
|
5731
5745
|
}>]>]>, t.IntersectionC<[t.IntersectionC<[t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
5732
5746
|
intentType: t.KeyofC<{
|
|
5733
5747
|
payment: t.LiteralC<"payment">;
|
|
@@ -5795,8 +5809,8 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5795
5809
|
intentType: t.LiteralC<"stake">;
|
|
5796
5810
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5797
5811
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5798
|
-
}>, t.
|
|
5799
|
-
memo: t.
|
|
5812
|
+
}>, t.PartialC<{
|
|
5813
|
+
memo: t.StringC;
|
|
5800
5814
|
}>]>, t.TypeC<{
|
|
5801
5815
|
amount: t.TypeC<{
|
|
5802
5816
|
value: t.StringC;
|
|
@@ -5873,8 +5887,8 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5873
5887
|
intentType: t.LiteralC<"unstake">;
|
|
5874
5888
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5875
5889
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5876
|
-
}>, t.
|
|
5877
|
-
memo: t.
|
|
5890
|
+
}>, t.PartialC<{
|
|
5891
|
+
memo: t.StringC;
|
|
5878
5892
|
}>]>, t.TypeC<{
|
|
5879
5893
|
stakingAddress: t.StringC;
|
|
5880
5894
|
}>, t.PartialC<{
|
|
@@ -5982,8 +5996,8 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5982
5996
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5983
5997
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5984
5998
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5985
|
-
}>, t.
|
|
5986
|
-
memo: t.
|
|
5999
|
+
}>, t.PartialC<{
|
|
6000
|
+
memo: t.StringC;
|
|
5987
6001
|
}>]>, t.TypeC<{
|
|
5988
6002
|
intentType: t.LiteralC<"customTx">;
|
|
5989
6003
|
solVersionedTransactionData: t.IntersectionC<[t.TypeC<{
|
|
@@ -60,8 +60,8 @@ export declare const SolAuthorizeIntent: t.IntersectionC<[t.IntersectionC<[t.Typ
|
|
|
60
60
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
61
61
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
62
62
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
63
|
-
}>, t.
|
|
64
|
-
memo: t.
|
|
63
|
+
}>, t.PartialC<{
|
|
64
|
+
memo: t.StringC;
|
|
65
65
|
}>]>, t.TypeC<{
|
|
66
66
|
intentType: t.LiteralC<"authorize">;
|
|
67
67
|
transactionMessage: t.StringC;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
export declare const SolBuildOptions: t.IntersectionC<[t.PartialC<{
|
|
3
3
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
4
|
-
}>, t.
|
|
5
|
-
memo: t.
|
|
4
|
+
}>, t.PartialC<{
|
|
5
|
+
memo: t.StringC;
|
|
6
6
|
}>]>;
|
|
7
7
|
export type SolBuildOptions = t.TypeOf<typeof SolBuildOptions>;
|
|
@@ -25,12 +25,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.SolBuildOptions = void 0;
|
|
27
27
|
const t = __importStar(require("io-ts"));
|
|
28
|
-
const utils_1 = require("../../../utils");
|
|
29
28
|
const accountBaseBuildOptions_1 = require("./accountBaseBuildOptions");
|
|
30
29
|
exports.SolBuildOptions = t.intersection([
|
|
31
30
|
accountBaseBuildOptions_1.AccountBaseBuildOptions,
|
|
32
|
-
t.
|
|
33
|
-
memo:
|
|
31
|
+
t.partial({
|
|
32
|
+
memo: t.string,
|
|
34
33
|
}),
|
|
35
34
|
]);
|
|
36
35
|
//# sourceMappingURL=solBuildOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solBuildOptions.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/solBuildOptions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,
|
|
1
|
+
{"version":3,"file":"solBuildOptions.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/solBuildOptions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,uEAAoE;AAoBvD,QAAA,eAAe,GAAG,CAAC,CAAC,YAAY,CAAC;IAC5C,iDAAuB;IACvB,CAAC,CAAC,OAAO,CAAC;QACR,IAAI,EAAE,CAAC,CAAC,MAAM;KACf,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -74,8 +74,8 @@ export declare const SolClaimIntent: t.IntersectionC<[t.IntersectionC<[t.Interse
|
|
|
74
74
|
}, unknown>, t.UndefinedC]>;
|
|
75
75
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
76
76
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
77
|
-
}>, t.
|
|
78
|
-
memo: t.
|
|
77
|
+
}>, t.PartialC<{
|
|
78
|
+
memo: t.StringC;
|
|
79
79
|
}>]>, t.TypeC<{
|
|
80
80
|
amount: t.TypeC<{
|
|
81
81
|
value: t.StringC;
|
package/dist/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.d.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
+
import type { Address } from "./address";
|
|
3
|
+
export type SolCloseAssociatedTokenAccountRecipient = {
|
|
4
|
+
address: Address & {
|
|
5
|
+
address: string;
|
|
6
|
+
};
|
|
7
|
+
amount: {
|
|
8
|
+
value: "0";
|
|
9
|
+
symbol: string;
|
|
10
|
+
};
|
|
11
|
+
data?: string | undefined;
|
|
12
|
+
};
|
|
2
13
|
export declare const SolCloseAssociatedTokenAccountIntent: t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
3
14
|
intentType: t.KeyofC<{
|
|
4
15
|
payment: t.LiteralC<"payment">;
|
|
@@ -60,11 +71,27 @@ export declare const SolCloseAssociatedTokenAccountIntent: t.IntersectionC<[t.In
|
|
|
60
71
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
61
72
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
62
73
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
63
|
-
}>, t.
|
|
64
|
-
memo: t.
|
|
74
|
+
}>, t.PartialC<{
|
|
75
|
+
memo: t.StringC;
|
|
65
76
|
}>]>, t.TypeC<{
|
|
66
77
|
intentType: t.LiteralC<"closeAssociatedTokenAccount">;
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
recipients: t.RefinementC<t.ArrayC<t.RefinementC<t.IntersectionC<[t.TypeC<{
|
|
79
|
+
address: t.PartialC<{
|
|
80
|
+
address: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
81
|
+
option: t.UnionC<[t.Type<{
|
|
82
|
+
[x: string]: unknown;
|
|
83
|
+
}, {
|
|
84
|
+
[x: string]: unknown;
|
|
85
|
+
}, unknown>, t.UndefinedC]>;
|
|
86
|
+
}>;
|
|
87
|
+
amount: t.TypeC<{
|
|
88
|
+
value: t.StringC;
|
|
89
|
+
symbol: t.StringC;
|
|
90
|
+
}>;
|
|
91
|
+
}>, t.PartialC<{
|
|
92
|
+
data: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
93
|
+
}>]>>>>;
|
|
69
94
|
}>]>;
|
|
70
|
-
export type SolCloseAssociatedTokenAccountIntent = t.TypeOf<typeof SolCloseAssociatedTokenAccountIntent
|
|
95
|
+
export type SolCloseAssociatedTokenAccountIntent = Omit<t.TypeOf<typeof SolCloseAssociatedTokenAccountIntent>, "recipients"> & {
|
|
96
|
+
recipients: SolCloseAssociatedTokenAccountRecipient[];
|
|
97
|
+
};
|
|
@@ -27,14 +27,30 @@ exports.SolCloseAssociatedTokenAccountIntent = void 0;
|
|
|
27
27
|
const t = __importStar(require("io-ts"));
|
|
28
28
|
const baseIntent_1 = require("./baseIntent");
|
|
29
29
|
const intentType_1 = require("./intentType");
|
|
30
|
+
const recipientEntry_1 = require("./recipientEntry");
|
|
30
31
|
const solBuildOptions_1 = require("./solBuildOptions");
|
|
32
|
+
function isSolCloseAssociatedTokenAccountRecipient(recipient) {
|
|
33
|
+
if (recipient.amount.value !== "0") {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const recipientRecord = recipient;
|
|
37
|
+
if ("tokenName" in recipientRecord || "tokenData" in recipientRecord) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
const addressFields = recipient.address;
|
|
41
|
+
if (typeof addressFields?.address !== "string") {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
const solCloseAssociatedTokenAccountRecipientEntry = t.refinement(recipientEntry_1.RecipientEntry, isSolCloseAssociatedTokenAccountRecipient, "SolCloseAssociatedTokenAccountRecipientEntry");
|
|
47
|
+
const solCloseAssociatedTokenAccountRecipients = t.refinement(t.array(solCloseAssociatedTokenAccountRecipientEntry), (recipients) => recipients.length > 0, "SolCloseAssociatedTokenAccountRecipients");
|
|
31
48
|
exports.SolCloseAssociatedTokenAccountIntent = t.intersection([
|
|
32
49
|
baseIntent_1.BaseIntent,
|
|
33
50
|
solBuildOptions_1.SolBuildOptions,
|
|
34
51
|
t.type({
|
|
35
52
|
intentType: intentType_1.intentTypes.closeAssociatedTokenAccount,
|
|
36
|
-
|
|
37
|
-
destinationAddress: t.string,
|
|
53
|
+
recipients: solCloseAssociatedTokenAccountRecipients,
|
|
38
54
|
}),
|
|
39
55
|
]);
|
|
40
56
|
//# sourceMappingURL=solCloseAssociatedTokenAccountIntent.js.map
|
package/dist/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solCloseAssociatedTokenAccountIntent.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;
|
|
1
|
+
{"version":3,"file":"solCloseAssociatedTokenAccountIntent.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAE3B,6CAA0C;AAC1C,6CAA2C;AAC3C,qDAAkD;AAClD,uDAAoD;AAoCpD,SAAS,yCAAyC,CAChD,SAAyB;IAEzB,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,eAAe,GAAG,SAAoC,CAAC;IAG7D,IAAI,WAAW,IAAI,eAAe,IAAI,WAAW,IAAI,eAAe,EAAE,CAAC;QACrE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,aAAa,GAAG,SAAS,CAAC,OAAgC,CAAC;IACjE,IAAI,OAAO,aAAa,EAAE,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAWD,MAAM,4CAA4C,GAAG,CAAC,CAAC,UAAU,CAC/D,+BAAc,EACd,yCAAyC,EACzC,8CAA8C,CAC/C,CAAC;AAEF,MAAM,wCAAwC,GAAG,CAAC,CAAC,UAAU,CAC3D,CAAC,CAAC,KAAK,CAAC,4CAA4C,CAAC,EACrD,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EACrC,0CAA0C,CAC3C,CAAC;AAWW,QAAA,oCAAoC,GAAG,CAAC,CAAC,YAAY,CAAC;IACjE,uBAAU;IACV,iCAAe;IACf,CAAC,CAAC,IAAI,CAAC;QACL,UAAU,EAAE,wBAAW,CAAC,2BAA2B;QACnD,UAAU,EAAE,wCAAwC;KACrD,CAAC;CACH,CAAC,CAAC"}
|
package/dist/src/schema/transactionRequest/intents/solCreateAssociatedTokenAccountIntent.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export declare const SolCreateAssociatedTokenAccountIntent: t.IntersectionC<[t.I
|
|
|
67
67
|
}>]>>;
|
|
68
68
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
69
69
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
70
|
-
}>, t.
|
|
71
|
-
memo: t.
|
|
70
|
+
}>, t.PartialC<{
|
|
71
|
+
memo: t.StringC;
|
|
72
72
|
}>]>]>;
|
|
73
73
|
export type SolCreateAssociatedTokenAccountIntent = t.TypeOf<typeof SolCreateAssociatedTokenAccountIntent>;
|
|
@@ -60,8 +60,8 @@ export declare const SolCustomTxIntent: t.IntersectionC<[t.IntersectionC<[t.Type
|
|
|
60
60
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
61
61
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
62
62
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
63
|
-
}>, t.
|
|
64
|
-
memo: t.
|
|
63
|
+
}>, t.PartialC<{
|
|
64
|
+
memo: t.StringC;
|
|
65
65
|
}>]>, t.TypeC<{
|
|
66
66
|
intentType: t.LiteralC<"customTx">;
|
|
67
67
|
solInstructions: t.ArrayC<t.TypeC<{
|
|
@@ -60,8 +60,8 @@ export declare const SolDeactivateIntent: t.IntersectionC<[t.IntersectionC<[t.Ty
|
|
|
60
60
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
61
61
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
62
62
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
63
|
-
}>, t.
|
|
64
|
-
memo: t.
|
|
63
|
+
}>, t.PartialC<{
|
|
64
|
+
memo: t.StringC;
|
|
65
65
|
}>]>, t.TypeC<{
|
|
66
66
|
intentType: t.LiteralC<"deactivate">;
|
|
67
67
|
stakingAddresses: t.UnionC<[t.Type<string[], string[], unknown>, t.UndefinedC]>;
|
|
@@ -60,8 +60,8 @@ export declare const SolDelegateIntent: t.IntersectionC<[t.IntersectionC<[t.Type
|
|
|
60
60
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
61
61
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
62
62
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
63
|
-
}>, t.
|
|
64
|
-
memo: t.
|
|
63
|
+
}>, t.PartialC<{
|
|
64
|
+
memo: t.StringC;
|
|
65
65
|
}>]>, t.TypeC<{
|
|
66
66
|
intentType: t.LiteralC<"delegate">;
|
|
67
67
|
validatorAddress: t.StringC;
|
|
@@ -80,7 +80,7 @@ export declare const SolGoUnstakeIntent: t.IntersectionC<[t.IntersectionC<[t.Int
|
|
|
80
80
|
}>]>>;
|
|
81
81
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
82
82
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
83
|
-
}>, t.
|
|
84
|
-
memo: t.
|
|
83
|
+
}>, t.PartialC<{
|
|
84
|
+
memo: t.StringC;
|
|
85
85
|
}>]>]>;
|
|
86
86
|
export type SolGoUnstakeIntent = t.TypeOf<typeof SolGoUnstakeIntent>;
|
|
@@ -82,7 +82,7 @@ export declare const SolPaymentIntent: t.IntersectionC<[t.IntersectionC<[t.Inter
|
|
|
82
82
|
isTestTransaction: t.BooleanC;
|
|
83
83
|
}>]>]>, t.IntersectionC<[t.PartialC<{
|
|
84
84
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
85
|
-
}>, t.
|
|
86
|
-
memo: t.
|
|
85
|
+
}>, t.PartialC<{
|
|
86
|
+
memo: t.StringC;
|
|
87
87
|
}>]>]>;
|
|
88
88
|
export type SolPaymentIntent = t.TypeOf<typeof SolPaymentIntent>;
|
|
@@ -66,8 +66,8 @@ export declare const SolStakeIntent: t.IntersectionC<[t.IntersectionC<[t.Interse
|
|
|
66
66
|
intentType: t.LiteralC<"stake">;
|
|
67
67
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
68
68
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
69
|
-
}>, t.
|
|
70
|
-
memo: t.
|
|
69
|
+
}>, t.PartialC<{
|
|
70
|
+
memo: t.StringC;
|
|
71
71
|
}>]>, t.TypeC<{
|
|
72
72
|
amount: t.TypeC<{
|
|
73
73
|
value: t.StringC;
|
|
@@ -146,8 +146,8 @@ export declare const SolJitoStakeIntent: t.IntersectionC<[t.IntersectionC<[t.Int
|
|
|
146
146
|
intentType: t.LiteralC<"stake">;
|
|
147
147
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
148
148
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
149
|
-
}>, t.
|
|
150
|
-
memo: t.
|
|
149
|
+
}>, t.PartialC<{
|
|
150
|
+
memo: t.StringC;
|
|
151
151
|
}>]>, t.TypeC<{
|
|
152
152
|
amount: t.TypeC<{
|
|
153
153
|
value: t.StringC;
|
|
@@ -66,8 +66,8 @@ export declare const SolUnstakeIntent: t.IntersectionC<[t.IntersectionC<[t.Inter
|
|
|
66
66
|
intentType: t.LiteralC<"unstake">;
|
|
67
67
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
68
68
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
69
|
-
}>, t.
|
|
70
|
-
memo: t.
|
|
69
|
+
}>, t.PartialC<{
|
|
70
|
+
memo: t.StringC;
|
|
71
71
|
}>]>, t.TypeC<{
|
|
72
72
|
stakingAddress: t.StringC;
|
|
73
73
|
}>, t.PartialC<{
|
|
@@ -183,8 +183,8 @@ export declare const SolJitoUnstakeIntent: t.IntersectionC<[t.IntersectionC<[t.I
|
|
|
183
183
|
intentType: t.LiteralC<"unstake">;
|
|
184
184
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
185
185
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
186
|
-
}>, t.
|
|
187
|
-
memo: t.
|
|
186
|
+
}>, t.PartialC<{
|
|
187
|
+
memo: t.StringC;
|
|
188
188
|
}>]>, t.TypeC<{
|
|
189
189
|
stakingAddress: t.StringC;
|
|
190
190
|
}>, t.PartialC<{
|
|
@@ -60,8 +60,8 @@ export declare const SolVersionedCustomTxIntent: t.IntersectionC<[t.Intersection
|
|
|
60
60
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
61
61
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
62
62
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
63
|
-
}>, t.
|
|
64
|
-
memo: t.
|
|
63
|
+
}>, t.PartialC<{
|
|
64
|
+
memo: t.StringC;
|
|
65
65
|
}>]>, t.TypeC<{
|
|
66
66
|
intentType: t.LiteralC<"customTx">;
|
|
67
67
|
solVersionedTransactionData: t.IntersectionC<[t.TypeC<{
|
|
@@ -5156,8 +5156,8 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5156
5156
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5157
5157
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5158
5158
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5159
|
-
}>, t.
|
|
5160
|
-
memo: t.
|
|
5159
|
+
}>, t.PartialC<{
|
|
5160
|
+
memo: t.StringC;
|
|
5161
5161
|
}>]>, t.TypeC<{
|
|
5162
5162
|
intentType: t.LiteralC<"authorize">;
|
|
5163
5163
|
transactionMessage: t.StringC;
|
|
@@ -5243,8 +5243,8 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5243
5243
|
}, unknown>, t.UndefinedC]>;
|
|
5244
5244
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5245
5245
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5246
|
-
}>, t.
|
|
5247
|
-
memo: t.
|
|
5246
|
+
}>, t.PartialC<{
|
|
5247
|
+
memo: t.StringC;
|
|
5248
5248
|
}>]>, t.TypeC<{
|
|
5249
5249
|
amount: t.TypeC<{
|
|
5250
5250
|
value: t.StringC;
|
|
@@ -5313,12 +5313,26 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5313
5313
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5314
5314
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5315
5315
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5316
|
-
}>, t.
|
|
5317
|
-
memo: t.
|
|
5316
|
+
}>, t.PartialC<{
|
|
5317
|
+
memo: t.StringC;
|
|
5318
5318
|
}>]>, t.TypeC<{
|
|
5319
5319
|
intentType: t.LiteralC<"closeAssociatedTokenAccount">;
|
|
5320
|
-
|
|
5321
|
-
|
|
5320
|
+
recipients: t.RefinementC<t.ArrayC<t.RefinementC<t.IntersectionC<[t.TypeC<{
|
|
5321
|
+
address: t.PartialC<{
|
|
5322
|
+
address: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
5323
|
+
option: t.UnionC<[t.Type<{
|
|
5324
|
+
[x: string]: unknown;
|
|
5325
|
+
}, {
|
|
5326
|
+
[x: string]: unknown;
|
|
5327
|
+
}, unknown>, t.UndefinedC]>;
|
|
5328
|
+
}>;
|
|
5329
|
+
amount: t.TypeC<{
|
|
5330
|
+
value: t.StringC;
|
|
5331
|
+
symbol: t.StringC;
|
|
5332
|
+
}>;
|
|
5333
|
+
}>, t.PartialC<{
|
|
5334
|
+
data: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
5335
|
+
}>]>>>>;
|
|
5322
5336
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5323
5337
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5324
5338
|
}>, t.TypeC<{
|
|
@@ -5447,8 +5461,8 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5447
5461
|
}>]>>;
|
|
5448
5462
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5449
5463
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5450
|
-
}>, t.
|
|
5451
|
-
memo: t.
|
|
5464
|
+
}>, t.PartialC<{
|
|
5465
|
+
memo: t.StringC;
|
|
5452
5466
|
}>]>]>, t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
5453
5467
|
intentType: t.KeyofC<{
|
|
5454
5468
|
payment: t.LiteralC<"payment">;
|
|
@@ -5510,8 +5524,8 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5510
5524
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5511
5525
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5512
5526
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5513
|
-
}>, t.
|
|
5514
|
-
memo: t.
|
|
5527
|
+
}>, t.PartialC<{
|
|
5528
|
+
memo: t.StringC;
|
|
5515
5529
|
}>]>, t.TypeC<{
|
|
5516
5530
|
intentType: t.LiteralC<"customTx">;
|
|
5517
5531
|
solInstructions: t.ArrayC<t.TypeC<{
|
|
@@ -5584,8 +5598,8 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5584
5598
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5585
5599
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5586
5600
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5587
|
-
}>, t.
|
|
5588
|
-
memo: t.
|
|
5601
|
+
}>, t.PartialC<{
|
|
5602
|
+
memo: t.StringC;
|
|
5589
5603
|
}>]>, t.TypeC<{
|
|
5590
5604
|
intentType: t.LiteralC<"deactivate">;
|
|
5591
5605
|
stakingAddresses: t.UnionC<[t.Type<string[], string[], unknown>, t.UndefinedC]>;
|
|
@@ -5651,8 +5665,8 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5651
5665
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5652
5666
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5653
5667
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5654
|
-
}>, t.
|
|
5655
|
-
memo: t.
|
|
5668
|
+
}>, t.PartialC<{
|
|
5669
|
+
memo: t.StringC;
|
|
5656
5670
|
}>]>, t.TypeC<{
|
|
5657
5671
|
intentType: t.LiteralC<"delegate">;
|
|
5658
5672
|
validatorAddress: t.StringC;
|
|
@@ -5739,8 +5753,8 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5739
5753
|
}>]>>;
|
|
5740
5754
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5741
5755
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5742
|
-
}>, t.
|
|
5743
|
-
memo: t.
|
|
5756
|
+
}>, t.PartialC<{
|
|
5757
|
+
memo: t.StringC;
|
|
5744
5758
|
}>]>]>, t.IntersectionC<[t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
5745
5759
|
intentType: t.KeyofC<{
|
|
5746
5760
|
payment: t.LiteralC<"payment">;
|
|
@@ -5824,8 +5838,8 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5824
5838
|
isTestTransaction: t.BooleanC;
|
|
5825
5839
|
}>]>]>, t.IntersectionC<[t.PartialC<{
|
|
5826
5840
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5827
|
-
}>, t.
|
|
5828
|
-
memo: t.
|
|
5841
|
+
}>, t.PartialC<{
|
|
5842
|
+
memo: t.StringC;
|
|
5829
5843
|
}>]>]>, t.IntersectionC<[t.IntersectionC<[t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
5830
5844
|
intentType: t.KeyofC<{
|
|
5831
5845
|
payment: t.LiteralC<"payment">;
|
|
@@ -5893,8 +5907,8 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5893
5907
|
intentType: t.LiteralC<"stake">;
|
|
5894
5908
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5895
5909
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5896
|
-
}>, t.
|
|
5897
|
-
memo: t.
|
|
5910
|
+
}>, t.PartialC<{
|
|
5911
|
+
memo: t.StringC;
|
|
5898
5912
|
}>]>, t.TypeC<{
|
|
5899
5913
|
amount: t.TypeC<{
|
|
5900
5914
|
value: t.StringC;
|
|
@@ -5971,8 +5985,8 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5971
5985
|
intentType: t.LiteralC<"unstake">;
|
|
5972
5986
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5973
5987
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5974
|
-
}>, t.
|
|
5975
|
-
memo: t.
|
|
5988
|
+
}>, t.PartialC<{
|
|
5989
|
+
memo: t.StringC;
|
|
5976
5990
|
}>]>, t.TypeC<{
|
|
5977
5991
|
stakingAddress: t.StringC;
|
|
5978
5992
|
}>, t.PartialC<{
|
|
@@ -6080,8 +6094,8 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
6080
6094
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
6081
6095
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
6082
6096
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
6083
|
-
}>, t.
|
|
6084
|
-
memo: t.
|
|
6097
|
+
}>, t.PartialC<{
|
|
6098
|
+
memo: t.StringC;
|
|
6085
6099
|
}>]>, t.TypeC<{
|
|
6086
6100
|
intentType: t.LiteralC<"customTx">;
|
|
6087
6101
|
solVersionedTransactionData: t.IntersectionC<[t.TypeC<{
|
|
@@ -15911,8 +15925,8 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
15911
15925
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
15912
15926
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
15913
15927
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
15914
|
-
}>, t.
|
|
15915
|
-
memo: t.
|
|
15928
|
+
}>, t.PartialC<{
|
|
15929
|
+
memo: t.StringC;
|
|
15916
15930
|
}>]>, t.TypeC<{
|
|
15917
15931
|
intentType: t.LiteralC<"authorize">;
|
|
15918
15932
|
transactionMessage: t.StringC;
|
|
@@ -15998,8 +16012,8 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
15998
16012
|
}, unknown>, t.UndefinedC]>;
|
|
15999
16013
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16000
16014
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16001
|
-
}>, t.
|
|
16002
|
-
memo: t.
|
|
16015
|
+
}>, t.PartialC<{
|
|
16016
|
+
memo: t.StringC;
|
|
16003
16017
|
}>]>, t.TypeC<{
|
|
16004
16018
|
amount: t.TypeC<{
|
|
16005
16019
|
value: t.StringC;
|
|
@@ -16068,12 +16082,26 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16068
16082
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16069
16083
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16070
16084
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16071
|
-
}>, t.
|
|
16072
|
-
memo: t.
|
|
16085
|
+
}>, t.PartialC<{
|
|
16086
|
+
memo: t.StringC;
|
|
16073
16087
|
}>]>, t.TypeC<{
|
|
16074
16088
|
intentType: t.LiteralC<"closeAssociatedTokenAccount">;
|
|
16075
|
-
|
|
16076
|
-
|
|
16089
|
+
recipients: t.RefinementC<t.ArrayC<t.RefinementC<t.IntersectionC<[t.TypeC<{
|
|
16090
|
+
address: t.PartialC<{
|
|
16091
|
+
address: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
16092
|
+
option: t.UnionC<[t.Type<{
|
|
16093
|
+
[x: string]: unknown;
|
|
16094
|
+
}, {
|
|
16095
|
+
[x: string]: unknown;
|
|
16096
|
+
}, unknown>, t.UndefinedC]>;
|
|
16097
|
+
}>;
|
|
16098
|
+
amount: t.TypeC<{
|
|
16099
|
+
value: t.StringC;
|
|
16100
|
+
symbol: t.StringC;
|
|
16101
|
+
}>;
|
|
16102
|
+
}>, t.PartialC<{
|
|
16103
|
+
data: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
16104
|
+
}>]>>>>;
|
|
16077
16105
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16078
16106
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16079
16107
|
}>, t.TypeC<{
|
|
@@ -16202,8 +16230,8 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16202
16230
|
}>]>>;
|
|
16203
16231
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16204
16232
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16205
|
-
}>, t.
|
|
16206
|
-
memo: t.
|
|
16233
|
+
}>, t.PartialC<{
|
|
16234
|
+
memo: t.StringC;
|
|
16207
16235
|
}>]>]>, t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
16208
16236
|
intentType: t.KeyofC<{
|
|
16209
16237
|
payment: t.LiteralC<"payment">;
|
|
@@ -16265,8 +16293,8 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16265
16293
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16266
16294
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16267
16295
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16268
|
-
}>, t.
|
|
16269
|
-
memo: t.
|
|
16296
|
+
}>, t.PartialC<{
|
|
16297
|
+
memo: t.StringC;
|
|
16270
16298
|
}>]>, t.TypeC<{
|
|
16271
16299
|
intentType: t.LiteralC<"customTx">;
|
|
16272
16300
|
solInstructions: t.ArrayC<t.TypeC<{
|
|
@@ -16339,8 +16367,8 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16339
16367
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16340
16368
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16341
16369
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16342
|
-
}>, t.
|
|
16343
|
-
memo: t.
|
|
16370
|
+
}>, t.PartialC<{
|
|
16371
|
+
memo: t.StringC;
|
|
16344
16372
|
}>]>, t.TypeC<{
|
|
16345
16373
|
intentType: t.LiteralC<"deactivate">;
|
|
16346
16374
|
stakingAddresses: t.UnionC<[t.Type<string[], string[], unknown>, t.UndefinedC]>;
|
|
@@ -16406,8 +16434,8 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16406
16434
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16407
16435
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16408
16436
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16409
|
-
}>, t.
|
|
16410
|
-
memo: t.
|
|
16437
|
+
}>, t.PartialC<{
|
|
16438
|
+
memo: t.StringC;
|
|
16411
16439
|
}>]>, t.TypeC<{
|
|
16412
16440
|
intentType: t.LiteralC<"delegate">;
|
|
16413
16441
|
validatorAddress: t.StringC;
|
|
@@ -16494,8 +16522,8 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16494
16522
|
}>]>>;
|
|
16495
16523
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16496
16524
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16497
|
-
}>, t.
|
|
16498
|
-
memo: t.
|
|
16525
|
+
}>, t.PartialC<{
|
|
16526
|
+
memo: t.StringC;
|
|
16499
16527
|
}>]>]>, t.IntersectionC<[t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
16500
16528
|
intentType: t.KeyofC<{
|
|
16501
16529
|
payment: t.LiteralC<"payment">;
|
|
@@ -16579,8 +16607,8 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16579
16607
|
isTestTransaction: t.BooleanC;
|
|
16580
16608
|
}>]>]>, t.IntersectionC<[t.PartialC<{
|
|
16581
16609
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16582
|
-
}>, t.
|
|
16583
|
-
memo: t.
|
|
16610
|
+
}>, t.PartialC<{
|
|
16611
|
+
memo: t.StringC;
|
|
16584
16612
|
}>]>]>, t.IntersectionC<[t.IntersectionC<[t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
16585
16613
|
intentType: t.KeyofC<{
|
|
16586
16614
|
payment: t.LiteralC<"payment">;
|
|
@@ -16648,8 +16676,8 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16648
16676
|
intentType: t.LiteralC<"stake">;
|
|
16649
16677
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16650
16678
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16651
|
-
}>, t.
|
|
16652
|
-
memo: t.
|
|
16679
|
+
}>, t.PartialC<{
|
|
16680
|
+
memo: t.StringC;
|
|
16653
16681
|
}>]>, t.TypeC<{
|
|
16654
16682
|
amount: t.TypeC<{
|
|
16655
16683
|
value: t.StringC;
|
|
@@ -16726,8 +16754,8 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16726
16754
|
intentType: t.LiteralC<"unstake">;
|
|
16727
16755
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16728
16756
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16729
|
-
}>, t.
|
|
16730
|
-
memo: t.
|
|
16757
|
+
}>, t.PartialC<{
|
|
16758
|
+
memo: t.StringC;
|
|
16731
16759
|
}>]>, t.TypeC<{
|
|
16732
16760
|
stakingAddress: t.StringC;
|
|
16733
16761
|
}>, t.PartialC<{
|
|
@@ -16835,8 +16863,8 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16835
16863
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16836
16864
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16837
16865
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16838
|
-
}>, t.
|
|
16839
|
-
memo: t.
|
|
16866
|
+
}>, t.PartialC<{
|
|
16867
|
+
memo: t.StringC;
|
|
16840
16868
|
}>]>, t.TypeC<{
|
|
16841
16869
|
intentType: t.LiteralC<"customTx">;
|
|
16842
16870
|
solVersionedTransactionData: t.IntersectionC<[t.TypeC<{
|
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getAssetsFromIntent = getAssetsFromIntent;
|
|
4
4
|
const Either_1 = require("fp-ts/lib/Either");
|
|
5
5
|
const baseIntent_1 = require("../schema/transactionRequest/intents/baseIntent");
|
|
6
|
+
const intentType_1 = require("../schema/transactionRequest/intents/intentType");
|
|
7
|
+
const INTENT_TYPES_SKIP_RECIPIENT_AMOUNT_SYMBOL_AS_ASSET = new Set([
|
|
8
|
+
intentType_1.intentTypes.closeAssociatedTokenAccount.value,
|
|
9
|
+
]);
|
|
6
10
|
function getAssetsFromIntent(intent) {
|
|
7
11
|
if (!intent || typeof intent !== "object") {
|
|
8
12
|
return [];
|
|
@@ -10,10 +14,15 @@ function getAssetsFromIntent(intent) {
|
|
|
10
14
|
const assetStrings = new Set();
|
|
11
15
|
const recipientsDecoded = baseIntent_1.BaseIntentWithRecipients.decode(intent);
|
|
12
16
|
if ((0, Either_1.isRight)(recipientsDecoded)) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
const intentType = intent["intentType"];
|
|
18
|
+
const skipRecipientAmountSymbol = typeof intentType === "string" &&
|
|
19
|
+
INTENT_TYPES_SKIP_RECIPIENT_AMOUNT_SYMBOL_AS_ASSET.has(intentType);
|
|
20
|
+
if (!skipRecipientAmountSymbol) {
|
|
21
|
+
const data = recipientsDecoded.right;
|
|
22
|
+
for (const recipient of data.recipients) {
|
|
23
|
+
if (recipient.amount?.symbol) {
|
|
24
|
+
assetStrings.add(recipient.amount.symbol);
|
|
25
|
+
}
|
|
17
26
|
}
|
|
18
27
|
}
|
|
19
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAssetsFromIntent.js","sourceRoot":"","sources":["../../../src/utils/getAssetsFromIntent.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getAssetsFromIntent.js","sourceRoot":"","sources":["../../../src/utils/getAssetsFromIntent.ts"],"names":[],"mappings":";;AAmCA,kDA8DC;AAjGD,6CAA2C;AAC3C,gFAKyD;AACzD,gFAA8E;AAQ9E,MAAM,kDAAkD,GAAG,IAAI,GAAG,CAAS;IACzE,wBAAW,CAAC,2BAA2B,CAAC,KAAK;CAC9C,CAAC,CAAC;AAkBH,SAAgB,mBAAmB,CAAC,MAAe;IACjD,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IAKvC,MAAM,iBAAiB,GAAG,qCAAwB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClE,IAAI,IAAA,gBAAO,EAAC,iBAAiB,CAAC,EAAE,CAAC;QAC/B,MAAM,UAAU,GAAI,MAAkC,CAAC,YAAY,CAAC,CAAC;QACrE,MAAM,yBAAyB,GAC7B,OAAO,UAAU,KAAK,QAAQ;YAC9B,kDAAkD,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrE,IAAI,CAAC,yBAAyB,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC;YACrC,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACxC,IAAI,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;oBAC7B,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAKD,MAAM,gBAAgB,GAAG,oCAAuB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAChE,IAAI,IAAA,gBAAO,EAAC,gBAAgB,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC;QACpC,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACxC,IAAI,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,CAAC;gBACnC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;IACH,CAAC;IAKD,MAAM,gBAAgB,GAAG,oCAAuB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAChE,IAAI,IAAA,gBAAO,EAAC,gBAAgB,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC;QACpC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAKD,MAAM,aAAa,GAAG,iCAAoB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAI,IAAA,gBAAO,EAAC,aAAa,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC;QACjC,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;YACxB,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC;AACzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
import { optionalString } from "../../../utils";
|
|
3
2
|
import { AccountBaseBuildOptions } from "./accountBaseBuildOptions";
|
|
4
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Solana build fragment intersected by **every** Sol intent codec that composes
|
|
6
|
+
* `SolBuildOptions` (e.g. payment, stake, consolidate, close-ATA, etc.).
|
|
7
|
+
*
|
|
8
|
+
* **`memo` change is a wire-format alignment, not a type-narrowing change.**
|
|
9
|
+
* Switching from `t.type({ memo: optionalString })` to
|
|
10
|
+
* `t.partial({ memo: t.string })` lets the **key be omitted** on the wire — real
|
|
11
|
+
* prebuild payloads frequently leave `memo` out, and the previous `t.type` form
|
|
12
|
+
* required the key for `.is()` even when the value would have been `undefined`.
|
|
13
|
+
* When `memo` is present, the value is validated as a `string`; if a caller
|
|
14
|
+
* passes `memo: undefined`, `t.partial` does not run the inner codec (the key
|
|
15
|
+
* is treated as absent), so runtime stays compatible with spreads.
|
|
16
|
+
*
|
|
17
|
+
* Inferred TS types are effectively unchanged: optional-key inference for
|
|
18
|
+
* `t.partial` already produces `memo?: string | undefined`, the same shape
|
|
19
|
+
* `t.TypeOf` would have given with `optionalString`. Package-wide Solana intent
|
|
20
|
+
* fix, not limited to close-ATA.
|
|
21
|
+
*/
|
|
5
22
|
export const SolBuildOptions = t.intersection([
|
|
6
23
|
AccountBaseBuildOptions,
|
|
7
|
-
t.
|
|
8
|
-
memo:
|
|
24
|
+
t.partial({
|
|
25
|
+
memo: t.string,
|
|
9
26
|
}),
|
|
10
27
|
]);
|
|
11
28
|
|
|
@@ -1,21 +1,110 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
+
import type { Address } from "./address";
|
|
2
3
|
import { BaseIntent } from "./baseIntent";
|
|
3
4
|
import { intentTypes } from "./intentType";
|
|
5
|
+
import { RecipientEntry } from "./recipientEntry";
|
|
4
6
|
import { SolBuildOptions } from "./solBuildOptions";
|
|
5
7
|
|
|
8
|
+
/**
|
|
9
|
+
* One close-ATA recipient row: ATA in `address.address`, zero placeholder amount,
|
|
10
|
+
* no token payload. Narrower than {@link RecipientEntry} for compile-time use
|
|
11
|
+
* when you annotate with this type after a successful decode.
|
|
12
|
+
*
|
|
13
|
+
* **Address typing:** {@link Address} is `t.partial` in io-ts, so
|
|
14
|
+
* `t.TypeOf<typeof RecipientEntry>["address"]` still allows a missing inner
|
|
15
|
+
* `address`. The refinement rejects non-strings at **runtime**, but io-ts does
|
|
16
|
+
* not narrow `TypeOf` on refinements—so `decode(...).right` alone will not show
|
|
17
|
+
* `address.address` as required. Use this named type (via
|
|
18
|
+
* {@link SolCloseAssociatedTokenAccountIntent}) for the stricter contract; do
|
|
19
|
+
* not widen back to plain `t.TypeOf<typeof SolCloseAssociatedTokenAccountIntent>`
|
|
20
|
+
* if you need the guarantee on `address.address`.
|
|
21
|
+
*
|
|
22
|
+
* `amount.value` must be the **exact string** `"0"`. The refinement uses string
|
|
23
|
+
* equality (not numeric parsing), so `"0.0"`, `"0.00"`, `"00"`, `"-0"`, `"0x0"`,
|
|
24
|
+
* etc. are rejected. Construct close-ATA placeholders with the literal `"0"`.
|
|
25
|
+
*
|
|
26
|
+
* `amount.symbol` follows {@link RecipientEntry} / `Amount`: any string
|
|
27
|
+
* (including `""`); it is not validated as a ticker and is ignored for asset extraction.
|
|
28
|
+
*/
|
|
29
|
+
export type SolCloseAssociatedTokenAccountRecipient = {
|
|
30
|
+
// Intersection tightens Address.address from string | undefined to required string.
|
|
31
|
+
address: Address & { address: string };
|
|
32
|
+
amount: { value: "0"; symbol: string };
|
|
33
|
+
/**
|
|
34
|
+
* Matches {@link RecipientEntry} / `optionalString` (`string | undefined`).
|
|
35
|
+
* Note: the underlying codec is `t.partial({ data: optionalString })`, so the
|
|
36
|
+
* key may also be absent at runtime; in TS the three states (absent,
|
|
37
|
+
* `undefined`, `string`) collapse to `string | undefined` here.
|
|
38
|
+
*/
|
|
39
|
+
data?: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
function isSolCloseAssociatedTokenAccountRecipient(
|
|
43
|
+
recipient: RecipientEntry,
|
|
44
|
+
): recipient is SolCloseAssociatedTokenAccountRecipient {
|
|
45
|
+
if (recipient.amount.value !== "0") {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
const recipientRecord = recipient as Record<string, unknown>;
|
|
49
|
+
// RecipientEntry’s codec does not declare token fields; io-ts still accepts
|
|
50
|
+
// extra keys, and values widened from richer recipient shapes may carry them.
|
|
51
|
+
if ("tokenName" in recipientRecord || "tokenData" in recipientRecord) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
const addressFields = recipient.address as { address?: unknown };
|
|
55
|
+
if (typeof addressFields?.address !== "string") {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Internal io-ts refinement for one close-ATA recipient row (not exported).
|
|
63
|
+
*
|
|
64
|
+
* io-ts does not propagate refinement predicates into `TypeOf`, so
|
|
65
|
+
* `decode(...).right` is still typed as {@link RecipientEntry}. For the narrowed
|
|
66
|
+
* row shape after validation, use {@link SolCloseAssociatedTokenAccountRecipient}
|
|
67
|
+
* (see {@link SolCloseAssociatedTokenAccountIntent}’s exported type, which
|
|
68
|
+
* overrides `recipients` accordingly).
|
|
69
|
+
*/
|
|
70
|
+
const solCloseAssociatedTokenAccountRecipientEntry = t.refinement(
|
|
71
|
+
RecipientEntry,
|
|
72
|
+
isSolCloseAssociatedTokenAccountRecipient,
|
|
73
|
+
"SolCloseAssociatedTokenAccountRecipientEntry",
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const solCloseAssociatedTokenAccountRecipients = t.refinement(
|
|
77
|
+
t.array(solCloseAssociatedTokenAccountRecipientEntry),
|
|
78
|
+
(recipients) => recipients.length > 0,
|
|
79
|
+
"SolCloseAssociatedTokenAccountRecipients",
|
|
80
|
+
);
|
|
81
|
+
|
|
6
82
|
/**
|
|
7
83
|
* @title SOL Close Associated Token Account Intent
|
|
84
|
+
*
|
|
85
|
+
* After `decode`, prefer annotating or threading values as the exported
|
|
86
|
+
* {@link SolCloseAssociatedTokenAccountIntent} **type alias** (below), not raw
|
|
87
|
+
* `t.TypeOf<typeof SolCloseAssociatedTokenAccountIntent>` from io-ts alone, so
|
|
88
|
+
* `recipients` rows keep {@link SolCloseAssociatedTokenAccountRecipient} narrowing
|
|
89
|
+
* (see codec / refinement limitations in that type’s docblock).
|
|
8
90
|
*/
|
|
9
91
|
export const SolCloseAssociatedTokenAccountIntent = t.intersection([
|
|
10
92
|
BaseIntent,
|
|
11
93
|
SolBuildOptions,
|
|
12
94
|
t.type({
|
|
13
95
|
intentType: intentTypes.closeAssociatedTokenAccount,
|
|
14
|
-
|
|
15
|
-
destinationAddress: t.string,
|
|
96
|
+
recipients: solCloseAssociatedTokenAccountRecipients,
|
|
16
97
|
}),
|
|
17
98
|
]);
|
|
18
99
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Intent shape with narrowed `recipients`; use this after `decode` instead of
|
|
102
|
+
* relying only on `t.TypeOf<typeof SolCloseAssociatedTokenAccountIntent>` from
|
|
103
|
+
* the codec so recipient `address.address` and `amount.value` typing match runtime rules.
|
|
104
|
+
*/
|
|
105
|
+
export type SolCloseAssociatedTokenAccountIntent = Omit<
|
|
106
|
+
t.TypeOf<typeof SolCloseAssociatedTokenAccountIntent>,
|
|
107
|
+
"recipients"
|
|
108
|
+
> & {
|
|
109
|
+
recipients: SolCloseAssociatedTokenAccountRecipient[];
|
|
110
|
+
};
|
|
@@ -5,6 +5,17 @@ import {
|
|
|
5
5
|
BaseIntentWithTokenName,
|
|
6
6
|
BaseIntentWithAmount,
|
|
7
7
|
} from "../schema/transactionRequest/intents/baseIntent";
|
|
8
|
+
import { intentTypes } from "../schema/transactionRequest/intents/intentType";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* `intentType` values for intents that decode as `BaseIntentWithRecipients`
|
|
12
|
+
* but use `recipients[].amount.symbol` as a non-asset placeholder (do not extract).
|
|
13
|
+
* Extend this set when adding similar intents; a schema-driven marker would be
|
|
14
|
+
* a larger refactor.
|
|
15
|
+
*/
|
|
16
|
+
const INTENT_TYPES_SKIP_RECIPIENT_AMOUNT_SYMBOL_AS_ASSET = new Set<string>([
|
|
17
|
+
intentTypes.closeAssociatedTokenAccount.value,
|
|
18
|
+
]);
|
|
8
19
|
|
|
9
20
|
/**
|
|
10
21
|
* Extracts all asset-related strings from a transaction intent
|
|
@@ -34,10 +45,16 @@ export function getAssetsFromIntent(intent: unknown): string[] {
|
|
|
34
45
|
// Extracts: symbol from amount field
|
|
35
46
|
const recipientsDecoded = BaseIntentWithRecipients.decode(intent);
|
|
36
47
|
if (isRight(recipientsDecoded)) {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
const intentType = (intent as Record<string, unknown>)["intentType"];
|
|
49
|
+
const skipRecipientAmountSymbol =
|
|
50
|
+
typeof intentType === "string" &&
|
|
51
|
+
INTENT_TYPES_SKIP_RECIPIENT_AMOUNT_SYMBOL_AS_ASSET.has(intentType);
|
|
52
|
+
if (!skipRecipientAmountSymbol) {
|
|
53
|
+
const data = recipientsDecoded.right;
|
|
54
|
+
for (const recipient of data.recipients) {
|
|
55
|
+
if (recipient.amount?.symbol) {
|
|
56
|
+
assetStrings.add(recipient.amount.symbol);
|
|
57
|
+
}
|
|
41
58
|
}
|
|
42
59
|
}
|
|
43
60
|
}
|