@bitgo/public-types 5.51.0 → 5.53.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/adaPaymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/adaStakeClaimRewardsIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/aptStakeIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/aptStakeIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/aptStakeIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/aptUnstakeIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/aptUnstakeIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/aptUnstakeIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/aptWithdrawStakeIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/aptWithdrawStakeIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/aptWithdrawStakeIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/atomPaymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/atomStakeIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/atomStakeIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/atomStakeIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/atomUnstakeIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/atomUnstakeIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/atomUnstakeIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/atomWithdrawIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/atomWithdrawIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/atomWithdrawIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/baseIntent.d.ts +69 -0
- package/dist/src/schema/transactionRequest/intents/baseIntent.js +23 -1
- package/dist/src/schema/transactionRequest/intents/baseIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/bscDelegateIntent.d.ts +3 -2
- package/dist/src/schema/transactionRequest/intents/bscDelegateIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/bscDelegateIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/bscStakeClaimRewardsIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/bscUndelegateIntent.d.ts +3 -2
- package/dist/src/schema/transactionRequest/intents/bscUndelegateIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/bscUndelegateIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/coredaoDelegateIntent.d.ts +3 -2
- package/dist/src/schema/transactionRequest/intents/coredaoDelegateIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/coredaoDelegateIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/coredaoUndelegateIntent.d.ts +3 -2
- package/dist/src/schema/transactionRequest/intents/coredaoUndelegateIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/coredaoUndelegateIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/cosmosPaymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/cosmosStakeIntent.d.ts +3 -2
- package/dist/src/schema/transactionRequest/intents/cosmosStakeIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/cosmosStakeIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/cosmosSwitchValidatorIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/cosmosUnstakeIntent.d.ts +3 -2
- package/dist/src/schema/transactionRequest/intents/cosmosUnstakeIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/cosmosUnstakeIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/dotPaymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/dotStakingIntent.d.ts +1 -0
- package/dist/src/schema/transactionRequest/intents/dotStakingIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/dotStakingIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/dotUnstakingIntent.d.ts +1 -0
- package/dist/src/schema/transactionRequest/intents/dotUnstakingIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/dotUnstakingIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/ethPaymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/ethTransferTokenIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/icpPaymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/intent.d.ts +77 -222
- package/dist/src/schema/transactionRequest/intents/iotaPaymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/mmiSignTransactionIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/paymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/paymentIntent.js +1 -3
- package/dist/src/schema/transactionRequest/intents/paymentIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/solClaimIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/solClaimIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/solClaimIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/solPaymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/solStakeIntent.d.ts +4 -2
- package/dist/src/schema/transactionRequest/intents/solStakeIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/solStakeIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/stakeClaimRewardsIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/stakeClaimRewardsIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/stakeClaimRewardsIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/stakeSwitchValidatorIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/stakeSwitchValidatorIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/stakeSwitchValidatorIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/substratePaymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/suiPaymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/tokenApprovalIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/tokenApprovalIntent.js +1 -1
- package/dist/src/schema/transactionRequest/intents/tokenApprovalIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/tonDelegateIntent.d.ts +3 -2
- package/dist/src/schema/transactionRequest/intents/tonDelegateIntent.js +1 -2
- package/dist/src/schema/transactionRequest/intents/tonDelegateIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/tonPaymentIntent.d.ts +3 -18
- package/dist/src/schema/transactionRequest/intents/transferTokenIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/transferTokenIntent.js +1 -2
- package/dist/src/schema/transactionRequest/intents/transferTokenIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/vetStakeClaimRewardsIntent.d.ts +2 -1
- package/dist/src/schema/transactionRequest/intents/vetStakingIntent.d.ts +1 -0
- package/dist/src/schema/transactionRequest/intents/vetStakingIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/vetStakingIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/transactionRequest.d.ts +154 -444
- package/dist/src/schema/wallet/freeze.d.ts +11 -0
- package/dist/src/schema/wallet/freeze.js +40 -0
- package/dist/src/schema/wallet/freeze.js.map +1 -0
- package/dist/src/schema/wallet/index.d.ts +1 -0
- package/dist/src/schema/wallet/index.js +1 -0
- package/dist/src/schema/wallet/index.js.map +1 -1
- package/dist/src/utils/getAssetsFromIntent.d.ts +1 -0
- package/dist/src/utils/getAssetsFromIntent.js +45 -0
- package/dist/src/utils/getAssetsFromIntent.js.map +1 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/schema/transactionRequest/intents/README.md +180 -8
- package/src/schema/transactionRequest/intents/aptStakeIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/aptUnstakeIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/aptWithdrawStakeIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/atomStakeIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/atomUnstakeIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/atomWithdrawIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/baseIntent.ts +116 -0
- package/src/schema/transactionRequest/intents/bscDelegateIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/bscUndelegateIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/coredaoDelegateIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/coredaoUndelegateIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/cosmosStakeIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/cosmosUnstakeIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/dotStakingIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/dotUnstakingIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/paymentIntent.ts +2 -4
- package/src/schema/transactionRequest/intents/solClaimIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/solStakeIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/stakeClaimRewardsIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/stakeSwitchValidatorIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/tokenApprovalIntent.ts +2 -2
- package/src/schema/transactionRequest/intents/tonDelegateIntent.ts +2 -3
- package/src/schema/transactionRequest/intents/transferTokenIntent.ts +2 -3
- package/src/schema/transactionRequest/intents/vetStakingIntent.ts +2 -2
- package/src/schema/wallet/freeze.ts +20 -0
- package/src/schema/wallet/index.ts +1 -0
- package/src/utils/getAssetsFromIntent.ts +81 -0
- package/src/utils/index.ts +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { BaseStakeIntentWithCalldata } from "./baseStakeIntentWithCalldata";
|
|
3
|
-
import {
|
|
3
|
+
import { BaseIntentWithAmount } from "./baseIntent";
|
|
4
4
|
import { intentTypes } from "./intentType";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -14,10 +14,10 @@ import { intentTypes } from "./intentType";
|
|
|
14
14
|
*/
|
|
15
15
|
export const CoreDaoUndelegateIntent = t.intersection([
|
|
16
16
|
BaseStakeIntentWithCalldata,
|
|
17
|
+
BaseIntentWithAmount,
|
|
17
18
|
t.type({
|
|
18
19
|
intentType: intentTypes.undelegate,
|
|
19
20
|
validatorAddress: t.string,
|
|
20
|
-
amount: Amount,
|
|
21
21
|
}),
|
|
22
22
|
]);
|
|
23
23
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { BaseStakeIntent } from "./baseStakeIntent";
|
|
3
|
+
import { BaseIntentWithAmount } from "./baseIntent";
|
|
3
4
|
import { intentTypes } from "./intentType";
|
|
4
|
-
import { Amount } from "./amount";
|
|
5
5
|
import { RecipientEntry } from "./recipientEntry";
|
|
6
6
|
import { Optional } from "../../../utils";
|
|
7
7
|
|
|
@@ -10,10 +10,10 @@ import { Optional } from "../../../utils";
|
|
|
10
10
|
*/
|
|
11
11
|
export const CosmosStakeIntent = t.intersection([
|
|
12
12
|
BaseStakeIntent,
|
|
13
|
+
BaseIntentWithAmount,
|
|
13
14
|
t.type({
|
|
14
15
|
intentType: intentTypes.delegate,
|
|
15
16
|
validatorAddress: t.string,
|
|
16
|
-
amount: Amount,
|
|
17
17
|
}),
|
|
18
18
|
t.partial({
|
|
19
19
|
recipients: Optional(t.array(RecipientEntry)),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { BaseStakeIntent } from "./baseStakeIntent";
|
|
3
|
+
import { BaseIntentWithAmount } from "./baseIntent";
|
|
3
4
|
import { intentTypes } from "./intentType";
|
|
4
|
-
import { Amount } from "./amount";
|
|
5
5
|
import { RecipientEntry } from "./recipientEntry";
|
|
6
6
|
import { Optional } from "../../../utils";
|
|
7
7
|
|
|
@@ -10,10 +10,10 @@ import { Optional } from "../../../utils";
|
|
|
10
10
|
*/
|
|
11
11
|
export const CosmosUnstakeIntent = t.intersection([
|
|
12
12
|
BaseStakeIntent,
|
|
13
|
+
BaseIntentWithAmount,
|
|
13
14
|
t.type({
|
|
14
15
|
intentType: intentTypes.undelegate,
|
|
15
16
|
validatorAddress: t.string,
|
|
16
|
-
amount: Amount,
|
|
17
17
|
}),
|
|
18
18
|
t.partial({
|
|
19
19
|
recipients: Optional(t.array(RecipientEntry)),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { DotAccountBaseBuildOptions } from "./dotAccountBaseBuildOptions";
|
|
3
|
-
import { Amount } from "./amount";
|
|
4
3
|
import { StakeIntent } from "./stakeIntent";
|
|
4
|
+
import { BaseIntentWithAmount } from "./baseIntent";
|
|
5
5
|
import { optionalBoolean } from "../../../utils";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -10,8 +10,8 @@ import { optionalBoolean } from "../../../utils";
|
|
|
10
10
|
export const DotStakingIntent = t.intersection([
|
|
11
11
|
StakeIntent,
|
|
12
12
|
DotAccountBaseBuildOptions,
|
|
13
|
+
BaseIntentWithAmount,
|
|
13
14
|
t.type({
|
|
14
|
-
amount: Amount,
|
|
15
15
|
stakingProxy: t.string,
|
|
16
16
|
}),
|
|
17
17
|
t.partial({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { UnstakeIntent } from "./unstakeIntent";
|
|
3
3
|
import { DotAccountBaseBuildOptions } from "./dotAccountBaseBuildOptions";
|
|
4
|
-
import {
|
|
4
|
+
import { BaseIntentWithAmount } from "./baseIntent";
|
|
5
5
|
import { optionalBoolean } from "../../../utils";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -10,8 +10,8 @@ import { optionalBoolean } from "../../../utils";
|
|
|
10
10
|
export const DotUnstakingIntent = t.intersection([
|
|
11
11
|
UnstakeIntent,
|
|
12
12
|
DotAccountBaseBuildOptions,
|
|
13
|
+
BaseIntentWithAmount,
|
|
13
14
|
t.type({
|
|
14
|
-
amount: Amount,
|
|
15
15
|
stakingProxy: t.string,
|
|
16
16
|
}),
|
|
17
17
|
t.partial({
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
import { BaseIntent } from "./baseIntent";
|
|
2
|
+
import { BaseIntent, BaseIntentWithRecipients } from "./baseIntent";
|
|
3
3
|
import { intentTypes } from "./intentType";
|
|
4
|
-
import { RecipientEntry } from "./recipientEntry";
|
|
5
4
|
|
|
6
5
|
export const PaymentIntent = t.intersection([
|
|
7
6
|
BaseIntent,
|
|
7
|
+
BaseIntentWithRecipients,
|
|
8
8
|
t.union([
|
|
9
9
|
t.type({
|
|
10
10
|
intentType: intentTypes.payment,
|
|
11
|
-
recipients: t.array(RecipientEntry),
|
|
12
11
|
}),
|
|
13
12
|
t.type({
|
|
14
13
|
intentType: intentTypes.payment,
|
|
15
|
-
recipients: t.array(RecipientEntry),
|
|
16
14
|
isTestTransaction: t.boolean,
|
|
17
15
|
}),
|
|
18
16
|
]),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { SolBuildOptions } from "./solBuildOptions";
|
|
3
|
-
import { Amount } from "./amount";
|
|
4
3
|
import { WithdrawIntent } from "./withdrawIntent";
|
|
4
|
+
import { BaseIntentWithAmount } from "./baseIntent";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @title SOL Claim Intent
|
|
@@ -9,9 +9,9 @@ import { WithdrawIntent } from "./withdrawIntent";
|
|
|
9
9
|
export const SolClaimIntent = t.intersection([
|
|
10
10
|
WithdrawIntent,
|
|
11
11
|
SolBuildOptions,
|
|
12
|
+
BaseIntentWithAmount,
|
|
12
13
|
t.type({
|
|
13
14
|
stakingAddress: t.string,
|
|
14
|
-
amount: Amount,
|
|
15
15
|
}),
|
|
16
16
|
]);
|
|
17
17
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { SolBuildOptions } from "./solBuildOptions";
|
|
3
3
|
import { StakeIntent } from "./stakeIntent";
|
|
4
|
-
import {
|
|
4
|
+
import { BaseIntentWithAmount } from "./baseIntent";
|
|
5
5
|
import { Optional } from "../../../utils";
|
|
6
6
|
import { SolStakingType } from "./solStakingType";
|
|
7
7
|
|
|
@@ -11,9 +11,9 @@ import { SolStakingType } from "./solStakingType";
|
|
|
11
11
|
export const SolStakeIntent = t.intersection([
|
|
12
12
|
StakeIntent,
|
|
13
13
|
SolBuildOptions,
|
|
14
|
+
BaseIntentWithAmount,
|
|
14
15
|
t.type({
|
|
15
16
|
validatorAddress: t.string,
|
|
16
|
-
amount: Amount,
|
|
17
17
|
/**
|
|
18
18
|
* @deprecated Use `stakingType` instead.
|
|
19
19
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { intentTypes } from "./intentType";
|
|
3
3
|
import { BaseStakeIntent } from "./baseStakeIntent";
|
|
4
|
-
import {
|
|
4
|
+
import { BaseIntentWithAmount } from "./baseIntent";
|
|
5
5
|
|
|
6
6
|
export const StakeClaimRewardsIntent = t.intersection([
|
|
7
7
|
BaseStakeIntent,
|
|
8
|
+
BaseIntentWithAmount,
|
|
8
9
|
t.type({
|
|
9
10
|
intentType: intentTypes.stakeClaimRewards,
|
|
10
|
-
amount: Amount,
|
|
11
11
|
}),
|
|
12
12
|
]);
|
|
13
13
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { BaseStakeIntent } from "./baseStakeIntent";
|
|
3
|
+
import { BaseIntentWithAmount } from "./baseIntent";
|
|
3
4
|
import { intentTypes } from "./intentType";
|
|
4
|
-
import { Amount } from "./amount";
|
|
5
5
|
|
|
6
6
|
export const StakeSwitchValidatorIntent = t.intersection([
|
|
7
7
|
BaseStakeIntent,
|
|
8
|
+
BaseIntentWithAmount,
|
|
8
9
|
t.type({
|
|
9
10
|
intentType: intentTypes.switchValidator,
|
|
10
|
-
amount: Amount,
|
|
11
11
|
validatorAddress: t.string,
|
|
12
12
|
destValidatorAddress: t.string,
|
|
13
13
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
import { BaseIntent } from "./baseIntent";
|
|
2
|
+
import { BaseIntent, BaseIntentWithTokenName } from "./baseIntent";
|
|
3
3
|
import { intentTypes } from "./intentType";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -8,9 +8,9 @@ import { intentTypes } from "./intentType";
|
|
|
8
8
|
*/
|
|
9
9
|
export const TokenApprovalIntent = t.intersection([
|
|
10
10
|
BaseIntent,
|
|
11
|
+
BaseIntentWithTokenName,
|
|
11
12
|
t.type({
|
|
12
13
|
intentType: intentTypes.tokenApproval,
|
|
13
|
-
tokenName: t.string,
|
|
14
14
|
}),
|
|
15
15
|
]);
|
|
16
16
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
import { BaseIntent } from "./baseIntent";
|
|
3
|
-
import { Amount } from "./amount";
|
|
2
|
+
import { BaseIntent, BaseIntentWithAmount } from "./baseIntent";
|
|
4
3
|
import { intentTypes } from "./intentType";
|
|
5
4
|
import { optionalString } from "../../../utils";
|
|
6
5
|
|
|
@@ -17,10 +16,10 @@ import { optionalString } from "../../../utils";
|
|
|
17
16
|
*/
|
|
18
17
|
export const TonDelegateIntent = t.intersection([
|
|
19
18
|
BaseIntent,
|
|
19
|
+
BaseIntentWithAmount,
|
|
20
20
|
t.type({
|
|
21
21
|
intentType: intentTypes.delegate,
|
|
22
22
|
validatorAddress: t.string,
|
|
23
|
-
amount: Amount,
|
|
24
23
|
useSingleNominator: t.boolean,
|
|
25
24
|
}),
|
|
26
25
|
t.partial({
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
import { BaseIntent } from "./baseIntent";
|
|
3
|
-
import { TokenRecipientEntry } from "./tokenRecipientEntry";
|
|
2
|
+
import { BaseIntent, BaseIntentWithTokenRecipients } from "./baseIntent";
|
|
4
3
|
import { intentTypes } from "./intentType";
|
|
5
4
|
|
|
6
5
|
export const TransferTokenIntent = t.intersection([
|
|
7
6
|
BaseIntent,
|
|
7
|
+
BaseIntentWithTokenRecipients,
|
|
8
8
|
t.type({
|
|
9
9
|
intentType: intentTypes.transferToken,
|
|
10
|
-
recipients: t.array(TokenRecipientEntry),
|
|
11
10
|
}),
|
|
12
11
|
]);
|
|
13
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { StakeIntent } from "./stakeIntent";
|
|
3
|
-
import {
|
|
3
|
+
import { BaseIntentWithAmount } from "./baseIntent";
|
|
4
4
|
import { NonEmptyString } from "io-ts-types";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -14,8 +14,8 @@ import { NonEmptyString } from "io-ts-types";
|
|
|
14
14
|
*/
|
|
15
15
|
export const VetStakingIntent = t.intersection([
|
|
16
16
|
StakeIntent,
|
|
17
|
+
BaseIntentWithAmount,
|
|
17
18
|
t.type({
|
|
18
|
-
amount: Amount,
|
|
19
19
|
stakingContractAddress: NonEmptyString,
|
|
20
20
|
levelId: NonEmptyString,
|
|
21
21
|
}),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Token transfer recipient params used in freeze metadata.
|
|
5
|
+
*/
|
|
6
|
+
export const TokenTransferRecipientParams = t.intersection([
|
|
7
|
+
t.type({
|
|
8
|
+
tokenType: t.string,
|
|
9
|
+
tokenQuantity: t.string,
|
|
10
|
+
}),
|
|
11
|
+
t.partial({
|
|
12
|
+
tokenContractAddress: t.string,
|
|
13
|
+
tokenName: t.string,
|
|
14
|
+
tokenId: t.string,
|
|
15
|
+
decimalPlaces: t.number,
|
|
16
|
+
}),
|
|
17
|
+
]);
|
|
18
|
+
export type TokenTransferRecipientParams = t.TypeOf<
|
|
19
|
+
typeof TokenTransferRecipientParams
|
|
20
|
+
>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { isRight } from "fp-ts/lib/Either";
|
|
2
|
+
import {
|
|
3
|
+
BaseIntentWithRecipients,
|
|
4
|
+
BaseIntentWithTokenData,
|
|
5
|
+
BaseIntentWithTokenName,
|
|
6
|
+
BaseIntentWithAmount,
|
|
7
|
+
} from "../schema/transactionRequest/intents/baseIntent";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Extracts all asset-related strings from a transaction intent
|
|
11
|
+
*
|
|
12
|
+
* This utility function analyzes any transaction intent object and returns
|
|
13
|
+
* all asset identifiers it references using a schema-driven approach.
|
|
14
|
+
*
|
|
15
|
+
* Assets are defined as:
|
|
16
|
+
* - Symbol names (from amount.symbol fields in recipients) - e.g., 'eth', 'btc', 'ada'
|
|
17
|
+
* - Token names (from tokenName or tokenData.tokenName fields) - e.g., 'USDC', 'DAI'
|
|
18
|
+
*
|
|
19
|
+
* Note: Technical fields like tokenType, tokenContractAddress, and tokenId are NOT
|
|
20
|
+
* considered assets - they are implementation details, not asset identifiers.
|
|
21
|
+
*
|
|
22
|
+
* @param intent - An unknown object that may be a transaction intent
|
|
23
|
+
* @returns An array of unique asset strings referenced in the intent
|
|
24
|
+
*/
|
|
25
|
+
export function getAssetsFromIntent(intent: unknown): string[] {
|
|
26
|
+
if (!intent || typeof intent !== "object") {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const assetStrings = new Set<string>();
|
|
31
|
+
|
|
32
|
+
// Pattern 1: Intents with recipients containing amounts
|
|
33
|
+
// Examples: PaymentIntent, AdaPaymentIntent, EthPaymentIntent, etc.
|
|
34
|
+
// Extracts: symbol from amount field
|
|
35
|
+
const recipientsDecoded = BaseIntentWithRecipients.decode(intent);
|
|
36
|
+
if (isRight(recipientsDecoded)) {
|
|
37
|
+
const data = recipientsDecoded.right;
|
|
38
|
+
for (const recipient of data.recipients) {
|
|
39
|
+
if (recipient.amount?.symbol) {
|
|
40
|
+
assetStrings.add(recipient.amount.symbol);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Pattern 2: Intents with token data in recipients
|
|
46
|
+
// Examples: TransferTokenIntent, EthTransferTokenIntent, EthConsolidateTokenIntent, etc.
|
|
47
|
+
// Extracts: tokenName (the asset identifier, e.g., 'USDC', 'DAI')
|
|
48
|
+
const tokenDataDecoded = BaseIntentWithTokenData.decode(intent);
|
|
49
|
+
if (isRight(tokenDataDecoded)) {
|
|
50
|
+
const data = tokenDataDecoded.right;
|
|
51
|
+
for (const recipient of data.recipients) {
|
|
52
|
+
if (recipient.tokenData?.tokenName) {
|
|
53
|
+
assetStrings.add(recipient.tokenData.tokenName);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Pattern 3: Intents with direct tokenName field
|
|
59
|
+
// Examples: TokenApprovalIntent
|
|
60
|
+
// Extracts: tokenName
|
|
61
|
+
const tokenNameDecoded = BaseIntentWithTokenName.decode(intent);
|
|
62
|
+
if (isRight(tokenNameDecoded)) {
|
|
63
|
+
const data = tokenNameDecoded.right;
|
|
64
|
+
if (data.tokenName) {
|
|
65
|
+
assetStrings.add(data.tokenName);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Pattern 4: Intents with direct amount field
|
|
70
|
+
// Examples: StakeIntent, UnstakeIntent, DelegateIntent, ClaimRewardsIntent, WithdrawIntent
|
|
71
|
+
// Extracts: symbol from amount field
|
|
72
|
+
const amountDecoded = BaseIntentWithAmount.decode(intent);
|
|
73
|
+
if (isRight(amountDecoded)) {
|
|
74
|
+
const data = amountDecoded.right;
|
|
75
|
+
if (data.amount?.symbol) {
|
|
76
|
+
assetStrings.add(data.amount.symbol);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return Array.from(assetStrings).sort();
|
|
81
|
+
}
|
package/src/utils/index.ts
CHANGED