@bitgo/public-types 4.14.0 → 4.15.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/schema/transactionRequest/intents/substrateBaseIntent.d.ts +82 -0
- package/dist/src/schema/transactionRequest/intents/substrateBaseIntent.js +40 -0
- package/dist/src/schema/transactionRequest/intents/substrateBaseIntent.js.map +1 -0
- package/dist/src/schema/transactionRequest/intents/substrateFeeOptionFormula.d.ts +14 -0
- package/dist/src/schema/transactionRequest/intents/substrateFeeOptionFormula.js +35 -0
- package/dist/src/schema/transactionRequest/intents/substrateFeeOptionFormula.js.map +1 -0
- package/dist/src/schema/transactionRequest/intents/substrateFeeOptions.d.ts +8 -0
- package/dist/src/schema/transactionRequest/intents/substrateFeeOptions.js +42 -0
- package/dist/src/schema/transactionRequest/intents/substrateFeeOptions.js.map +1 -0
- package/package.json +1 -1
- package/src/schema/transactionRequest/intents/substrateBaseIntent.ts +16 -0
- package/src/schema/transactionRequest/intents/substrateFeeOptionFormula.ts +12 -0
- package/src/schema/transactionRequest/intents/substrateFeeOptions.ts +16 -0
@@ -0,0 +1,82 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
export declare const SubstrateBaseIntent: t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
3
|
+
intentType: t.KeyofC<{
|
4
|
+
payment: t.LiteralC<"payment">;
|
5
|
+
transferToken: t.LiteralC<"transferToken">;
|
6
|
+
consolidate: t.LiteralC<"consolidate">;
|
7
|
+
consolidateToken: t.LiteralC<"consolidateToken">;
|
8
|
+
fanout: t.LiteralC<"fanout">;
|
9
|
+
stake: t.LiteralC<"stake">;
|
10
|
+
unstake: t.LiteralC<"unstake">;
|
11
|
+
delegate: t.LiteralC<"delegate">;
|
12
|
+
undelegate: t.LiteralC<"undelegate">;
|
13
|
+
switchValidator: t.LiteralC<"switchValidator">;
|
14
|
+
claim: t.LiteralC<"claim">;
|
15
|
+
stakeClaimRewards: t.LiteralC<"stakeClaimRewards">;
|
16
|
+
pledge: t.LiteralC<"pledge">;
|
17
|
+
voteDelegation: t.LiteralC<"voteDelegation">;
|
18
|
+
vote: t.LiteralC<"vote">;
|
19
|
+
createAccount: t.LiteralC<"createAccount">;
|
20
|
+
updateAccount: t.LiteralC<"updateAccount">;
|
21
|
+
addTrustLine: t.LiteralC<"addTrustLine">;
|
22
|
+
removeTrustLine: t.LiteralC<"removeTrustLine">;
|
23
|
+
signMessage: t.LiteralC<"signMessage">;
|
24
|
+
signTypedStructuredData: t.LiteralC<"signTypedStructuredData">;
|
25
|
+
enableToken: t.LiteralC<"enableToken">;
|
26
|
+
authorize: t.LiteralC<"authorize">;
|
27
|
+
acceleration: t.LiteralC<"acceleration">;
|
28
|
+
fillNonce: t.LiteralC<"fillNonce">;
|
29
|
+
walletRecovery: t.LiteralC<"walletRecovery">;
|
30
|
+
contractCall: t.LiteralC<"contractCall">;
|
31
|
+
deactivate: t.LiteralC<"deactivate">;
|
32
|
+
customTx: t.LiteralC<"customTx">;
|
33
|
+
closeAssociatedTokenAccount: t.LiteralC<"closeAssociatedTokenAccount">;
|
34
|
+
}>;
|
35
|
+
}>, t.PartialC<{
|
36
|
+
sequenceId: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
37
|
+
comment: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
38
|
+
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
39
|
+
}>]>, t.PartialC<{
|
40
|
+
senderAddressIndex: t.UnionC<[t.Type<number, number, unknown>, t.UndefinedC]>;
|
41
|
+
fee: t.UnionC<[t.Type<{
|
42
|
+
amount: string | number;
|
43
|
+
} & {
|
44
|
+
unit?: "baseUnit" | "cpu" | "ram" | undefined;
|
45
|
+
formula?: "fixed" | "feeRate" | "perKB" | "custom" | undefined;
|
46
|
+
type?: "max" | "base" | "tip" | undefined;
|
47
|
+
}, {
|
48
|
+
amount: string | number;
|
49
|
+
} & {
|
50
|
+
unit?: "baseUnit" | "cpu" | "ram" | undefined;
|
51
|
+
formula?: "fixed" | "feeRate" | "perKB" | "custom" | undefined;
|
52
|
+
type?: "max" | "base" | "tip" | undefined;
|
53
|
+
}, unknown>, t.UndefinedC]>;
|
54
|
+
recipients: t.UnionC<[t.Type<({
|
55
|
+
address: {
|
56
|
+
address?: string | undefined;
|
57
|
+
option?: {
|
58
|
+
[x: string]: unknown;
|
59
|
+
} | undefined;
|
60
|
+
};
|
61
|
+
amount: {
|
62
|
+
value: string;
|
63
|
+
symbol: string;
|
64
|
+
};
|
65
|
+
} & {
|
66
|
+
data?: string | undefined;
|
67
|
+
})[], ({
|
68
|
+
address: {
|
69
|
+
address?: string | undefined;
|
70
|
+
option?: {
|
71
|
+
[x: string]: unknown;
|
72
|
+
} | undefined;
|
73
|
+
};
|
74
|
+
amount: {
|
75
|
+
value: string;
|
76
|
+
symbol: string;
|
77
|
+
};
|
78
|
+
} & {
|
79
|
+
data?: string | undefined;
|
80
|
+
})[], unknown>, t.UndefinedC]>;
|
81
|
+
}>]>;
|
82
|
+
export type DotBaseIntent = t.TypeOf<typeof SubstrateBaseIntent>;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.SubstrateBaseIntent = void 0;
|
27
|
+
const t = __importStar(require("io-ts"));
|
28
|
+
const utils_1 = require("../../../utils");
|
29
|
+
const substrateFeeOptions_1 = require("./substrateFeeOptions");
|
30
|
+
const recipientEntry_1 = require("./recipientEntry");
|
31
|
+
const baseIntent_1 = require("./baseIntent");
|
32
|
+
exports.SubstrateBaseIntent = t.intersection([
|
33
|
+
baseIntent_1.BaseIntent,
|
34
|
+
t.partial({
|
35
|
+
senderAddressIndex: utils_1.optionalNumber,
|
36
|
+
fee: (0, utils_1.Optional)(substrateFeeOptions_1.SubstrateFeeOptions),
|
37
|
+
recipients: (0, utils_1.Optional)(t.array(recipientEntry_1.RecipientEntry)),
|
38
|
+
}),
|
39
|
+
]);
|
40
|
+
//# sourceMappingURL=substrateBaseIntent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"substrateBaseIntent.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/substrateBaseIntent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,0CAA0D;AAC1D,+DAA4D;AAC5D,qDAAkD;AAClD,6CAA0C;AAE7B,QAAA,mBAAmB,GAAG,CAAC,CAAC,YAAY,CAAC;IAChD,uBAAU;IACV,CAAC,CAAC,OAAO,CAAC;QACR,kBAAkB,EAAE,sBAAc;QAClC,GAAG,EAAE,IAAA,gBAAQ,EAAC,yCAAmB,CAAC;QAClC,UAAU,EAAE,IAAA,gBAAQ,EAAC,CAAC,CAAC,KAAK,CAAC,+BAAc,CAAC,CAAC;KAC9C,CAAC;CACH,CAAC,CAAC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
export declare const substrateFeeFormulas: {
|
3
|
+
fixed: t.LiteralC<"fixed">;
|
4
|
+
feeRate: t.LiteralC<"feeRate">;
|
5
|
+
perKB: t.LiteralC<"perKB">;
|
6
|
+
custom: t.LiteralC<"custom">;
|
7
|
+
};
|
8
|
+
export declare const SubstrateFeeFormulas: t.KeyofC<{
|
9
|
+
fixed: t.LiteralC<"fixed">;
|
10
|
+
feeRate: t.LiteralC<"feeRate">;
|
11
|
+
perKB: t.LiteralC<"perKB">;
|
12
|
+
custom: t.LiteralC<"custom">;
|
13
|
+
}>;
|
14
|
+
export type SubstrateFeeFormulas = t.TypeOf<typeof SubstrateFeeFormulas>;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.SubstrateFeeFormulas = exports.substrateFeeFormulas = void 0;
|
27
|
+
const t = __importStar(require("io-ts"));
|
28
|
+
exports.substrateFeeFormulas = {
|
29
|
+
fixed: t.literal("fixed"),
|
30
|
+
feeRate: t.literal("feeRate"),
|
31
|
+
perKB: t.literal("perKB"),
|
32
|
+
custom: t.literal("custom"),
|
33
|
+
};
|
34
|
+
exports.SubstrateFeeFormulas = t.keyof(exports.substrateFeeFormulas);
|
35
|
+
//# sourceMappingURL=substrateFeeOptionFormula.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"substrateFeeOptionFormula.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/substrateFeeOptionFormula.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAEd,QAAA,oBAAoB,GAAG;IAClC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACzB,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACzB,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;CAC5B,CAAC;AAEW,QAAA,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,4BAAoB,CAAC,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
export declare const SubstrateFeeOptions: t.IntersectionC<[t.TypeC<{
|
3
|
+
amount: t.UnionC<[t.StringC, t.NumberC]>;
|
4
|
+
}>, t.PartialC<{
|
5
|
+
unit: t.UnionC<[t.Type<"baseUnit" | "cpu" | "ram", "baseUnit" | "cpu" | "ram", unknown>, t.UndefinedC]>;
|
6
|
+
formula: t.UnionC<[t.Type<"fixed" | "feeRate" | "perKB" | "custom", "fixed" | "feeRate" | "perKB" | "custom", unknown>, t.UndefinedC]>;
|
7
|
+
type: t.UnionC<[t.Type<"max" | "base" | "tip", "max" | "base" | "tip", unknown>, t.UndefinedC]>;
|
8
|
+
}>]>;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.SubstrateFeeOptions = void 0;
|
27
|
+
const t = __importStar(require("io-ts"));
|
28
|
+
const feeOptionUnit_1 = require("./feeOptionUnit");
|
29
|
+
const utils_1 = require("../../../utils");
|
30
|
+
const substrateFeeOptionFormula_1 = require("./substrateFeeOptionFormula");
|
31
|
+
const feeOptionFeeType_1 = require("./feeOptionFeeType");
|
32
|
+
exports.SubstrateFeeOptions = t.intersection([
|
33
|
+
t.type({
|
34
|
+
amount: t.union([t.string, t.number]),
|
35
|
+
}),
|
36
|
+
t.partial({
|
37
|
+
unit: (0, utils_1.Optional)(feeOptionUnit_1.FeeUnit),
|
38
|
+
formula: (0, utils_1.Optional)(substrateFeeOptionFormula_1.SubstrateFeeFormulas),
|
39
|
+
type: (0, utils_1.Optional)(feeOptionFeeType_1.FeeType),
|
40
|
+
}),
|
41
|
+
]);
|
42
|
+
//# sourceMappingURL=substrateFeeOptions.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"substrateFeeOptions.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/substrateFeeOptions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,mDAA0C;AAC1C,0CAA0C;AAC1C,2EAAmE;AACnE,yDAA6C;AAEhC,QAAA,mBAAmB,GAAG,CAAC,CAAC,YAAY,CAAC;IAChD,CAAC,CAAC,IAAI,CAAC;QACL,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;KACtC,CAAC;IACF,CAAC,CAAC,OAAO,CAAC;QACR,IAAI,EAAE,IAAA,gBAAQ,EAAC,uBAAO,CAAC;QACvB,OAAO,EAAE,IAAA,gBAAQ,EAAC,gDAAoB,CAAC;QACvC,IAAI,EAAE,IAAA,gBAAQ,EAAC,0BAAO,CAAC;KACxB,CAAC;CACH,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import { Optional, optionalNumber } from "../../../utils";
|
3
|
+
import { SubstrateFeeOptions } from "./substrateFeeOptions";
|
4
|
+
import { RecipientEntry } from "./recipientEntry";
|
5
|
+
import { BaseIntent } from "./baseIntent";
|
6
|
+
|
7
|
+
export const SubstrateBaseIntent = t.intersection([
|
8
|
+
BaseIntent,
|
9
|
+
t.partial({
|
10
|
+
senderAddressIndex: optionalNumber,
|
11
|
+
fee: Optional(SubstrateFeeOptions),
|
12
|
+
recipients: Optional(t.array(RecipientEntry)),
|
13
|
+
}),
|
14
|
+
]);
|
15
|
+
|
16
|
+
export type DotBaseIntent = t.TypeOf<typeof SubstrateBaseIntent>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
|
3
|
+
export const substrateFeeFormulas = {
|
4
|
+
fixed: t.literal("fixed"),
|
5
|
+
feeRate: t.literal("feeRate"),
|
6
|
+
perKB: t.literal("perKB"),
|
7
|
+
custom: t.literal("custom"),
|
8
|
+
};
|
9
|
+
|
10
|
+
export const SubstrateFeeFormulas = t.keyof(substrateFeeFormulas);
|
11
|
+
|
12
|
+
export type SubstrateFeeFormulas = t.TypeOf<typeof SubstrateFeeFormulas>;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import { FeeUnit } from "./feeOptionUnit";
|
3
|
+
import { Optional } from "../../../utils";
|
4
|
+
import { SubstrateFeeFormulas } from "./substrateFeeOptionFormula";
|
5
|
+
import { FeeType } from "./feeOptionFeeType";
|
6
|
+
|
7
|
+
export const SubstrateFeeOptions = t.intersection([
|
8
|
+
t.type({
|
9
|
+
amount: t.union([t.string, t.number]),
|
10
|
+
}),
|
11
|
+
t.partial({
|
12
|
+
unit: Optional(FeeUnit),
|
13
|
+
formula: Optional(SubstrateFeeFormulas),
|
14
|
+
type: Optional(FeeType),
|
15
|
+
}),
|
16
|
+
]);
|