@airgap/cosmos 0.13.11-beta.1 → 0.13.11-beta.3
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/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +1 -5
- package/v0/index.d.ts +10 -0
- package/v0/index.js +32 -0
- package/v0/index.js.map +1 -0
- package/v0/protocol/CosmosAddress.d.ts +8 -0
- package/v0/protocol/CosmosAddress.js +28 -0
- package/v0/protocol/CosmosAddress.js.map +1 -0
- package/v0/protocol/CosmosCoin.d.ts +19 -0
- package/v0/protocol/CosmosCoin.js +55 -0
- package/v0/protocol/CosmosCoin.js.map +1 -0
- package/v0/protocol/CosmosCryptoClient.d.ts +8 -0
- package/v0/protocol/CosmosCryptoClient.js +90 -0
- package/v0/protocol/CosmosCryptoClient.js.map +1 -0
- package/v0/protocol/CosmosFee.d.ts +15 -0
- package/v0/protocol/CosmosFee.js +31 -0
- package/v0/protocol/CosmosFee.js.map +1 -0
- package/v0/protocol/CosmosNodeClient.d.ts +25 -0
- package/v0/protocol/CosmosNodeClient.js +382 -0
- package/v0/protocol/CosmosNodeClient.js.map +1 -0
- package/v0/protocol/CosmosProtocol.d.ts +124 -0
- package/v0/protocol/CosmosProtocol.js +1155 -0
- package/v0/protocol/CosmosProtocol.js.map +1 -0
- package/v0/protocol/CosmosProtocolOptions.d.ts +22 -0
- package/v0/protocol/CosmosProtocolOptions.js +116 -0
- package/v0/protocol/CosmosProtocolOptions.js.map +1 -0
- package/v0/protocol/CosmosTransaction.d.ts +37 -0
- package/v0/protocol/CosmosTransaction.js +106 -0
- package/v0/protocol/CosmosTransaction.js.map +1 -0
- package/v0/protocol/CosmosTypes.d.ts +310 -0
- package/v0/protocol/CosmosTypes.js +8 -0
- package/v0/protocol/CosmosTypes.js.map +1 -0
- package/v0/protocol/cosmos-message/CosmosDelegateMessage.d.ts +20 -0
- package/v0/protocol/cosmos-message/CosmosDelegateMessage.js +72 -0
- package/v0/protocol/cosmos-message/CosmosDelegateMessage.js.map +1 -0
- package/v0/protocol/cosmos-message/CosmosMessage.d.ts +39 -0
- package/v0/protocol/cosmos-message/CosmosMessage.js +47 -0
- package/v0/protocol/cosmos-message/CosmosMessage.js.map +1 -0
- package/v0/protocol/cosmos-message/CosmosSendMessage.d.ts +20 -0
- package/v0/protocol/cosmos-message/CosmosSendMessage.js +85 -0
- package/v0/protocol/cosmos-message/CosmosSendMessage.js.map +1 -0
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.d.ts +24 -0
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js +61 -0
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js.map +1 -0
- package/v0/serializer/schemas/v2/transaction-sign-request-cosmos.json +100 -0
- package/v0/serializer/schemas/v2/transaction-sign-response-cosmos.json +22 -0
- package/v0/serializer/schemas/v3/transaction-sign-request-cosmos.json +100 -0
- package/v0/serializer/schemas/v3/transaction-sign-response-cosmos.json +23 -0
- package/v0/serializer/validators/transaction-validator.d.ts +15 -0
- package/v0/serializer/validators/transaction-validator.js +112 -0
- package/v0/serializer/validators/transaction-validator.js.map +1 -0
- package/v0/types/signed-transaction-cosmos.d.ts +5 -0
- package/v0/types/signed-transaction-cosmos.js +3 -0
- package/v0/types/signed-transaction-cosmos.js.map +1 -0
- package/v0/types/transaction-cosmos.d.ts +5 -0
- package/v0/types/transaction-cosmos.js +3 -0
- package/v0/types/transaction-cosmos.js.map +1 -0
- package/v0/types/unsigned-transaction-cosmos.d.ts +33 -0
- package/v0/types/unsigned-transaction-cosmos.js +10 -0
- package/v0/types/unsigned-transaction-cosmos.js.map +1 -0
- package/v1/block-explorer/MintscanBlockExplorer.d.ts +9 -0
- package/v1/block-explorer/MintscanBlockExplorer.js +74 -0
- package/v1/block-explorer/MintscanBlockExplorer.js.map +1 -0
- package/v1/data/CosmosAddress.d.ts +7 -0
- package/v1/data/CosmosAddress.js +29 -0
- package/v1/data/CosmosAddress.js.map +1 -0
- package/v1/data/CosmosCoin.d.ts +19 -0
- package/v1/data/CosmosCoin.js +55 -0
- package/v1/data/CosmosCoin.js.map +1 -0
- package/v1/data/CosmosFee.d.ts +15 -0
- package/v1/data/CosmosFee.js +31 -0
- package/v1/data/CosmosFee.js.map +1 -0
- package/v1/data/transaction/CosmosTransaction.d.ts +36 -0
- package/v1/data/transaction/CosmosTransaction.js +109 -0
- package/v1/data/transaction/CosmosTransaction.js.map +1 -0
- package/v1/data/transaction/message/CosmosDelegateMessage.d.ts +19 -0
- package/v1/data/transaction/message/CosmosDelegateMessage.js +70 -0
- package/v1/data/transaction/message/CosmosDelegateMessage.js.map +1 -0
- package/v1/data/transaction/message/CosmosMessage.d.ts +38 -0
- package/v1/data/transaction/message/CosmosMessage.js +47 -0
- package/v1/data/transaction/message/CosmosMessage.js.map +1 -0
- package/v1/data/transaction/message/CosmosSendMessage.d.ts +19 -0
- package/v1/data/transaction/message/CosmosSendMessage.js +83 -0
- package/v1/data/transaction/message/CosmosSendMessage.js.map +1 -0
- package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.d.ts +23 -0
- package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js +61 -0
- package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js.map +1 -0
- package/v1/index.d.ts +10 -0
- package/v1/index.js +11 -0
- package/v1/index.js.map +1 -0
- package/v1/module/CosmosModule.d.ts +15 -0
- package/v1/module/CosmosModule.js +107 -0
- package/v1/module/CosmosModule.js.map +1 -0
- package/v1/module.d.ts +3 -0
- package/v1/module.js +24 -0
- package/v1/module.js.map +1 -0
- package/v1/node/CosmosNodeClient.d.ts +28 -0
- package/v1/node/CosmosNodeClient.js +381 -0
- package/v1/node/CosmosNodeClient.js.map +1 -0
- package/v1/protocol/CosmosCryptoClient.d.ts +8 -0
- package/v1/protocol/CosmosCryptoClient.js +90 -0
- package/v1/protocol/CosmosCryptoClient.js.map +1 -0
- package/v1/protocol/CosmosProtocol.d.ts +53 -0
- package/v1/protocol/CosmosProtocol.js +651 -0
- package/v1/protocol/CosmosProtocol.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +7 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +37 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.d.ts +4 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-cosmos.json +100 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-cosmos.json +19 -0
- package/v1/serializer/v3/serializer-companion.d.ts +12 -0
- package/v1/serializer/v3/serializer-companion.js +142 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validators.d.ts +7 -0
- package/v1/serializer/v3/validators/transaction-validators.js +88 -0
- package/v1/serializer/v3/validators/transaction-validators.js.map +1 -0
- package/v1/types/crypto.d.ts +2 -0
- package/v1/types/crypto.js +3 -0
- package/v1/types/crypto.js.map +1 -0
- package/v1/types/protocol.d.ts +8 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
- package/v1/types/rpc.d.ts +286 -0
- package/v1/types/rpc.js +3 -0
- package/v1/types/rpc.js.map +1 -0
- package/v1/types/transaction.d.ts +44 -0
- package/v1/types/transaction.js +10 -0
- package/v1/types/transaction.js.map +1 -0
- package/v1/utils/key.d.ts +3 -0
- package/v1/utils/key.js +20 -0
- package/v1/utils/key.js.map +1 -0
- package/v1/utils/signature.d.ts +2 -0
- package/v1/utils/signature.js +13 -0
- package/v1/utils/signature.js.map +1 -0
- package/v1/utils/transaction.d.ts +1 -0
- package/v1/utils/transaction.js +8 -0
- package/v1/utils/transaction.js.map +1 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateTransactionLimit = void 0;
|
|
4
|
+
var calculateTransactionLimit = function (limit, selfTotal, otherTotal, selfOffset, otherOffset) {
|
|
5
|
+
return Math.min(Math.max(Math.ceil(limit / 2), limit - (otherTotal - otherOffset)), selfTotal - selfOffset);
|
|
6
|
+
};
|
|
7
|
+
exports.calculateTransactionLimit = calculateTransactionLimit;
|
|
8
|
+
//# sourceMappingURL=CosmosTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CosmosTypes.js","sourceRoot":"","sources":["../../../src/v0/protocol/CosmosTypes.ts"],"names":[],"mappings":";;;AA+VO,IAAM,yBAAyB,GAAG,UACvC,KAAa,EACb,SAAiB,EACjB,UAAkB,EAClB,UAAkB,EAClB,WAAmB;IAEnB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC,CAAA;AAC7G,CAAC,CAAA;AARY,QAAA,yBAAyB,6BAQrC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EncodeObject } from '@airgap/coinlib-core/dependencies/src/cosmjs';
|
|
2
|
+
import { IAirGapTransaction } from '@airgap/coinlib-core/interfaces/IAirGapTransaction';
|
|
3
|
+
import { ProtocolSymbols } from '@airgap/coinlib-core/utils/ProtocolSymbols';
|
|
4
|
+
import { CosmosCoin } from '../CosmosCoin';
|
|
5
|
+
import { CosmosProtocolNetwork } from '../CosmosProtocolOptions';
|
|
6
|
+
import { CosmosMessage, CosmosMessageJSON, CosmosMessageType } from './CosmosMessage';
|
|
7
|
+
export declare class CosmosDelegateMessage implements CosmosMessage {
|
|
8
|
+
readonly delegatorAddress: string;
|
|
9
|
+
readonly validatorAddress: string;
|
|
10
|
+
readonly amount: CosmosCoin;
|
|
11
|
+
readonly type: CosmosMessageType;
|
|
12
|
+
constructor(delegatorAddress: string, validatorAddress: string, amount: CosmosCoin, undelegate?: boolean);
|
|
13
|
+
toEncodeObject(): EncodeObject;
|
|
14
|
+
static fromEncodeObject(encodeObject: EncodeObject): CosmosDelegateMessage;
|
|
15
|
+
toJSON(): CosmosMessageJSON;
|
|
16
|
+
static fromJSON(json: CosmosMessageJSON): CosmosDelegateMessage;
|
|
17
|
+
toRPCBody(): any;
|
|
18
|
+
toAirGapTransaction(identifier: ProtocolSymbols, network: CosmosProtocolNetwork, fee: string): IAirGapTransaction;
|
|
19
|
+
static fromRPCBody(json: any): CosmosDelegateMessage;
|
|
20
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CosmosDelegateMessage = void 0;
|
|
4
|
+
var IAirGapTransaction_1 = require("@airgap/coinlib-core/interfaces/IAirGapTransaction");
|
|
5
|
+
var CosmosCoin_1 = require("../CosmosCoin");
|
|
6
|
+
var CosmosMessage_1 = require("./CosmosMessage");
|
|
7
|
+
var CosmosDelegateMessage = /** @class */ (function () {
|
|
8
|
+
function CosmosDelegateMessage(delegatorAddress, validatorAddress, amount, undelegate) {
|
|
9
|
+
if (undelegate === void 0) { undelegate = false; }
|
|
10
|
+
this.delegatorAddress = delegatorAddress;
|
|
11
|
+
this.validatorAddress = validatorAddress;
|
|
12
|
+
this.amount = amount;
|
|
13
|
+
this.type = undelegate ? CosmosMessage_1.CosmosMessageType.Undelegate : CosmosMessage_1.CosmosMessageType.Delegate;
|
|
14
|
+
}
|
|
15
|
+
CosmosDelegateMessage.prototype.toEncodeObject = function () {
|
|
16
|
+
return {
|
|
17
|
+
typeUrl: this.type.value,
|
|
18
|
+
value: {
|
|
19
|
+
delegatorAddress: this.delegatorAddress,
|
|
20
|
+
validatorAddress: this.validatorAddress,
|
|
21
|
+
amount: this.amount
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
CosmosDelegateMessage.fromEncodeObject = function (encodeObject) {
|
|
26
|
+
var _a, _b, _c, _d;
|
|
27
|
+
var undelegate = encodeObject.typeUrl === CosmosMessage_1.CosmosMessageType.Undelegate.value;
|
|
28
|
+
return new CosmosDelegateMessage(encodeObject.value.delegatorAddress, encodeObject.value.validatorAddress, new CosmosCoin_1.CosmosCoin((_b = (_a = encodeObject.value.amount) === null || _a === void 0 ? void 0 : _a.denom) !== null && _b !== void 0 ? _b : 'uatom', (_d = (_c = encodeObject.value.amount) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : '0'), undelegate);
|
|
29
|
+
};
|
|
30
|
+
CosmosDelegateMessage.prototype.toJSON = function () {
|
|
31
|
+
return {
|
|
32
|
+
type: this.type.index,
|
|
33
|
+
amount: [this.amount.toJSON()],
|
|
34
|
+
fromAddress: this.delegatorAddress,
|
|
35
|
+
toAddress: this.validatorAddress
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
CosmosDelegateMessage.fromJSON = function (json) {
|
|
39
|
+
return new CosmosDelegateMessage(json.fromAddress, json.toAddress, CosmosCoin_1.CosmosCoin.fromJSON(json.amount[0]), json.type === CosmosMessage_1.CosmosMessageType.Undelegate.index);
|
|
40
|
+
};
|
|
41
|
+
CosmosDelegateMessage.prototype.toRPCBody = function () {
|
|
42
|
+
return {
|
|
43
|
+
type: this.type.value,
|
|
44
|
+
value: {
|
|
45
|
+
amount: this.amount.toRPCBody(),
|
|
46
|
+
delegator_address: this.delegatorAddress,
|
|
47
|
+
validator_address: this.validatorAddress
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
CosmosDelegateMessage.prototype.toAirGapTransaction = function (identifier, network, fee) {
|
|
52
|
+
return {
|
|
53
|
+
amount: this.amount.amount,
|
|
54
|
+
from: [this.delegatorAddress],
|
|
55
|
+
to: [this.validatorAddress],
|
|
56
|
+
isInbound: false,
|
|
57
|
+
fee: fee,
|
|
58
|
+
protocolIdentifier: identifier,
|
|
59
|
+
network: network,
|
|
60
|
+
transactionDetails: this.toRPCBody(),
|
|
61
|
+
extra: {
|
|
62
|
+
type: this.type.index === CosmosMessage_1.CosmosMessageTypeIndex.DELEGATE ? IAirGapTransaction_1.AirGapTransactionType.DELEGATE : IAirGapTransaction_1.AirGapTransactionType.UNDELEGATE
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
CosmosDelegateMessage.fromRPCBody = function (json) {
|
|
67
|
+
return new CosmosDelegateMessage(json.value.delegator_address, json.value.validator_address, CosmosCoin_1.CosmosCoin.fromRPCBody(json.value.amount), json.type === CosmosMessage_1.CosmosMessageType.Undelegate.value);
|
|
68
|
+
};
|
|
69
|
+
return CosmosDelegateMessage;
|
|
70
|
+
}());
|
|
71
|
+
exports.CosmosDelegateMessage = CosmosDelegateMessage;
|
|
72
|
+
//# sourceMappingURL=CosmosDelegateMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CosmosDelegateMessage.js","sourceRoot":"","sources":["../../../../src/v0/protocol/cosmos-message/CosmosDelegateMessage.ts"],"names":[],"mappings":";;;AACA,yFAA8G;AAE9G,4CAA0C;AAG1C,iDAA6G;AAE7G;IAOE,+BAAY,gBAAwB,EAAE,gBAAwB,EAAE,MAAkB,EAAE,UAA2B;QAA3B,2BAAA,EAAA,kBAA2B;QAC7G,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;QACxC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;QACxC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AAA;IACH,CAAC;IACH,4BAAC;AAAD,CAAC,AAxFD,IAwFC;AAxFY,sDAAqB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IAirGapTransaction } from '@airgap/coinlib-core/interfaces/IAirGapTransaction';
|
|
2
|
+
import { JSONConvertible } from '@airgap/coinlib-core/interfaces/JSONConvertible';
|
|
3
|
+
import { RPCConvertible } from '@airgap/coinlib-core/interfaces/RPCConvertible';
|
|
4
|
+
import { ProtocolSymbols } from '@airgap/coinlib-core/utils/ProtocolSymbols';
|
|
5
|
+
import { CosmosCoinJSON } from '../CosmosCoin';
|
|
6
|
+
import { CosmosProtocolNetwork } from '../CosmosProtocolOptions';
|
|
7
|
+
import { Encodable } from '../CosmosTransaction';
|
|
8
|
+
export interface CosmosMessageJSON {
|
|
9
|
+
type: CosmosMessageTypeIndex;
|
|
10
|
+
amount: CosmosCoinJSON[];
|
|
11
|
+
fromAddress: string;
|
|
12
|
+
toAddress: string;
|
|
13
|
+
}
|
|
14
|
+
export declare enum CosmosMessageTypeIndex {
|
|
15
|
+
SEND = 0,
|
|
16
|
+
DELEGATE = 1,
|
|
17
|
+
UNDELEGATE = 2,
|
|
18
|
+
WITHDRAW_DELEGATION_REWARD = 3
|
|
19
|
+
}
|
|
20
|
+
export declare enum CosmosMessageTypeValue {
|
|
21
|
+
SEND = "/cosmos.bank.v1beta1.MsgSend",
|
|
22
|
+
DELEGATE = "/cosmos.staking.v1beta1.MsgDelegate",
|
|
23
|
+
UNDELEGATE = "/cosmos.staking.v1beta1.MsgUndelegate",
|
|
24
|
+
WITHDRAW_DELEGATION_REWARD = "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"
|
|
25
|
+
}
|
|
26
|
+
export declare class CosmosMessageType {
|
|
27
|
+
static Send: CosmosMessageType;
|
|
28
|
+
static Delegate: CosmosMessageType;
|
|
29
|
+
static Undelegate: CosmosMessageType;
|
|
30
|
+
static WithdrawDelegationReward: CosmosMessageType;
|
|
31
|
+
readonly index: CosmosMessageTypeIndex;
|
|
32
|
+
readonly value: string;
|
|
33
|
+
constructor(index: CosmosMessageTypeIndex);
|
|
34
|
+
}
|
|
35
|
+
export interface CosmosMessage extends JSONConvertible, RPCConvertible, Encodable {
|
|
36
|
+
type: CosmosMessageType;
|
|
37
|
+
toAirGapTransaction(identifier: ProtocolSymbols, network: CosmosProtocolNetwork, fee: string): IAirGapTransaction;
|
|
38
|
+
toJSON(): CosmosMessageJSON;
|
|
39
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CosmosMessageType = exports.CosmosMessageTypeValue = exports.CosmosMessageTypeIndex = void 0;
|
|
4
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
5
|
+
var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
6
|
+
var CosmosMessageTypeIndex;
|
|
7
|
+
(function (CosmosMessageTypeIndex) {
|
|
8
|
+
CosmosMessageTypeIndex[CosmosMessageTypeIndex["SEND"] = 0] = "SEND";
|
|
9
|
+
CosmosMessageTypeIndex[CosmosMessageTypeIndex["DELEGATE"] = 1] = "DELEGATE";
|
|
10
|
+
CosmosMessageTypeIndex[CosmosMessageTypeIndex["UNDELEGATE"] = 2] = "UNDELEGATE";
|
|
11
|
+
CosmosMessageTypeIndex[CosmosMessageTypeIndex["WITHDRAW_DELEGATION_REWARD"] = 3] = "WITHDRAW_DELEGATION_REWARD";
|
|
12
|
+
})(CosmosMessageTypeIndex = exports.CosmosMessageTypeIndex || (exports.CosmosMessageTypeIndex = {}));
|
|
13
|
+
var CosmosMessageTypeValue;
|
|
14
|
+
(function (CosmosMessageTypeValue) {
|
|
15
|
+
CosmosMessageTypeValue["SEND"] = "/cosmos.bank.v1beta1.MsgSend";
|
|
16
|
+
CosmosMessageTypeValue["DELEGATE"] = "/cosmos.staking.v1beta1.MsgDelegate";
|
|
17
|
+
CosmosMessageTypeValue["UNDELEGATE"] = "/cosmos.staking.v1beta1.MsgUndelegate";
|
|
18
|
+
CosmosMessageTypeValue["WITHDRAW_DELEGATION_REWARD"] = "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward";
|
|
19
|
+
})(CosmosMessageTypeValue = exports.CosmosMessageTypeValue || (exports.CosmosMessageTypeValue = {}));
|
|
20
|
+
var CosmosMessageType = /** @class */ (function () {
|
|
21
|
+
function CosmosMessageType(index) {
|
|
22
|
+
this.index = index;
|
|
23
|
+
switch (index) {
|
|
24
|
+
case CosmosMessageTypeIndex.SEND:
|
|
25
|
+
this.value = CosmosMessageTypeValue.SEND;
|
|
26
|
+
break;
|
|
27
|
+
case CosmosMessageTypeIndex.DELEGATE:
|
|
28
|
+
this.value = CosmosMessageTypeValue.DELEGATE;
|
|
29
|
+
break;
|
|
30
|
+
case CosmosMessageTypeIndex.UNDELEGATE:
|
|
31
|
+
this.value = CosmosMessageTypeValue.UNDELEGATE;
|
|
32
|
+
break;
|
|
33
|
+
case CosmosMessageTypeIndex.WITHDRAW_DELEGATION_REWARD:
|
|
34
|
+
this.value = CosmosMessageTypeValue.WITHDRAW_DELEGATION_REWARD;
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
throw new errors_1.InvalidValueError(coinlib_error_1.Domain.COSMOS, 'Unknown message');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
CosmosMessageType.Send = new CosmosMessageType(CosmosMessageTypeIndex.SEND);
|
|
41
|
+
CosmosMessageType.Delegate = new CosmosMessageType(CosmosMessageTypeIndex.DELEGATE);
|
|
42
|
+
CosmosMessageType.Undelegate = new CosmosMessageType(CosmosMessageTypeIndex.UNDELEGATE);
|
|
43
|
+
CosmosMessageType.WithdrawDelegationReward = new CosmosMessageType(CosmosMessageTypeIndex.WITHDRAW_DELEGATION_REWARD);
|
|
44
|
+
return CosmosMessageType;
|
|
45
|
+
}());
|
|
46
|
+
exports.CosmosMessageType = CosmosMessageType;
|
|
47
|
+
//# sourceMappingURL=CosmosMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CosmosMessage.js","sourceRoot":"","sources":["../../../../src/v0/protocol/cosmos-message/CosmosMessage.ts"],"names":[],"mappings":";;;AAAA,sDAA+D;AAC/D,2EAAkE;AAgBlE,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,mEAAQ,CAAA;IACR,2EAAY,CAAA;IACZ,+EAAc,CAAA;IACd,+GAA8B,CAAA;AAChC,CAAC,EALW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAKjC;AAED,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,+DAAqC,CAAA;IACrC,0EAAgD,CAAA;IAChD,8EAAoD,CAAA;IACpD,gHAAsF,CAAA;AACxF,CAAC,EALW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAKjC;AAED;IASE,2BAAY,KAA6B;QACvC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,QAAQ,KAAK,EAAE;YACb,KAAK,sBAAsB,CAAC,IAAI;gBAC9B,IAAI,CAAC,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAA;gBACxC,MAAK;YACP,KAAK,sBAAsB,CAAC,QAAQ;gBAClC,IAAI,CAAC,KAAK,GAAG,sBAAsB,CAAC,QAAQ,CAAA;gBAC5C,MAAK;YACP,KAAK,sBAAsB,CAAC,UAAU;gBACpC,IAAI,CAAC,KAAK,GAAG,sBAAsB,CAAC,UAAU,CAAA;gBAC9C,MAAK;YACP,KAAK,sBAAsB,CAAC,0BAA0B;gBACpD,IAAI,CAAC,KAAK,GAAG,sBAAsB,CAAC,0BAA0B,CAAA;gBAC9D,MAAK;YACP;gBACE,MAAM,IAAI,0BAAiB,CAAC,sBAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;SAChE;IACH,CAAC;IA1Ba,sBAAI,GAAsB,IAAI,iBAAiB,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAA;IAC5E,0BAAQ,GAAsB,IAAI,iBAAiB,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAA;IACpF,4BAAU,GAAsB,IAAI,iBAAiB,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAA;IACxF,0CAAwB,GAAsB,IAAI,iBAAiB,CAAC,sBAAsB,CAAC,0BAA0B,CAAC,CAAA;IAwBtI,wBAAC;CAAA,AA5BD,IA4BC;AA5BY,8CAAiB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ProtocolSymbols } from '@airgap/coinlib-core';
|
|
2
|
+
import { EncodeObject } from '@airgap/coinlib-core/dependencies/src/cosmjs';
|
|
3
|
+
import { IAirGapTransaction } from '@airgap/coinlib-core/interfaces/IAirGapTransaction';
|
|
4
|
+
import { CosmosCoin } from '../CosmosCoin';
|
|
5
|
+
import { CosmosProtocolNetwork } from '../CosmosProtocolOptions';
|
|
6
|
+
import { CosmosMessage, CosmosMessageJSON, CosmosMessageType } from './CosmosMessage';
|
|
7
|
+
export declare class CosmosSendMessage implements CosmosMessage {
|
|
8
|
+
readonly fromAddress: string;
|
|
9
|
+
readonly toAddress: string;
|
|
10
|
+
readonly amount: CosmosCoin[];
|
|
11
|
+
readonly type: CosmosMessageType;
|
|
12
|
+
constructor(fromAddress: string, toAddress: string, amount: CosmosCoin[]);
|
|
13
|
+
toEncodeObject(): EncodeObject;
|
|
14
|
+
static fromEncodeObject(encodeObject: EncodeObject): CosmosSendMessage;
|
|
15
|
+
toJSON(): CosmosMessageJSON;
|
|
16
|
+
static fromJSON(json: CosmosMessageJSON): CosmosSendMessage;
|
|
17
|
+
toRPCBody(): any;
|
|
18
|
+
toAirGapTransaction(identifier: ProtocolSymbols, network: CosmosProtocolNetwork, fee: string): IAirGapTransaction;
|
|
19
|
+
static fromRPCBody(json: any): CosmosSendMessage;
|
|
20
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CosmosSendMessage = void 0;
|
|
16
|
+
var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
17
|
+
var IAirGapTransaction_1 = require("@airgap/coinlib-core/interfaces/IAirGapTransaction");
|
|
18
|
+
var CosmosCoin_1 = require("../CosmosCoin");
|
|
19
|
+
var CosmosMessage_1 = require("./CosmosMessage");
|
|
20
|
+
var CosmosSendMessage = /** @class */ (function () {
|
|
21
|
+
function CosmosSendMessage(fromAddress, toAddress, amount) {
|
|
22
|
+
this.type = CosmosMessage_1.CosmosMessageType.Send;
|
|
23
|
+
this.fromAddress = fromAddress;
|
|
24
|
+
this.toAddress = toAddress;
|
|
25
|
+
this.amount = amount;
|
|
26
|
+
}
|
|
27
|
+
CosmosSendMessage.prototype.toEncodeObject = function () {
|
|
28
|
+
return {
|
|
29
|
+
typeUrl: this.type.value,
|
|
30
|
+
value: {
|
|
31
|
+
fromAddress: this.fromAddress,
|
|
32
|
+
toAddress: this.toAddress,
|
|
33
|
+
amount: __spreadArray([], this.amount, true)
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
CosmosSendMessage.fromEncodeObject = function (encodeObject) {
|
|
38
|
+
return new CosmosSendMessage(encodeObject.value.fromAddress, encodeObject.value.toAddress, encodeObject.value.amount.map(function (amount) { return new CosmosCoin_1.CosmosCoin(amount.denom, amount.amount); }));
|
|
39
|
+
};
|
|
40
|
+
CosmosSendMessage.prototype.toJSON = function () {
|
|
41
|
+
return {
|
|
42
|
+
type: this.type.index,
|
|
43
|
+
amount: this.amount.map(function (value) { return value.toJSON(); }),
|
|
44
|
+
fromAddress: this.fromAddress,
|
|
45
|
+
toAddress: this.toAddress
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
CosmosSendMessage.fromJSON = function (json) {
|
|
49
|
+
return new CosmosSendMessage(json.fromAddress, json.toAddress, json.amount.map(function (value) { return CosmosCoin_1.CosmosCoin.fromJSON(value); }));
|
|
50
|
+
};
|
|
51
|
+
CosmosSendMessage.prototype.toRPCBody = function () {
|
|
52
|
+
return {
|
|
53
|
+
type: this.type.value,
|
|
54
|
+
value: {
|
|
55
|
+
amount: this.amount.map(function (value) { return value.toRPCBody(); }),
|
|
56
|
+
from_address: this.fromAddress,
|
|
57
|
+
to_address: this.toAddress
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
CosmosSendMessage.prototype.toAirGapTransaction = function (identifier, network, fee) {
|
|
62
|
+
return {
|
|
63
|
+
amount: this.amount
|
|
64
|
+
.map(function (value) { return new bignumber_1.default(value.amount); })
|
|
65
|
+
.reduce(function (prev, next) { return prev.plus(next); })
|
|
66
|
+
.toString(10),
|
|
67
|
+
to: [this.toAddress],
|
|
68
|
+
from: [this.fromAddress],
|
|
69
|
+
isInbound: false,
|
|
70
|
+
fee: fee,
|
|
71
|
+
protocolIdentifier: identifier,
|
|
72
|
+
network: network,
|
|
73
|
+
transactionDetails: this.toRPCBody(),
|
|
74
|
+
extra: {
|
|
75
|
+
type: IAirGapTransaction_1.AirGapTransactionType.SPEND
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
CosmosSendMessage.fromRPCBody = function (json) {
|
|
80
|
+
return new CosmosSendMessage(json.value.from_address, json.value.to_address, json.value.amount.map(function (value) { return CosmosCoin_1.CosmosCoin.fromRPCBody(value); }));
|
|
81
|
+
};
|
|
82
|
+
return CosmosSendMessage;
|
|
83
|
+
}());
|
|
84
|
+
exports.CosmosSendMessage = CosmosSendMessage;
|
|
85
|
+
//# sourceMappingURL=CosmosSendMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CosmosSendMessage.js","sourceRoot":"","sources":["../../../../src/v0/protocol/cosmos-message/CosmosSendMessage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iHAA0F;AAE1F,yFAA8G;AAC9G,4CAA0D;AAG1D,iDAAqF;AAErF;IAOE,2BAAY,WAAmB,EAAE,SAAiB,EAAE,MAAoB;QAFxD,SAAI,GAAsB,iCAAiB,CAAC,IAAI,CAAA;QAG9D,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,0CAAc,GAArB;QACE,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;YACxB,KAAK,EAAE;gBACL,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,MAAM,oBAAM,IAAI,CAAC,MAAM,OAAC;aACzB;SACF,CAAA;IACH,CAAC;IAEa,kCAAgB,GAA9B,UAA+B,YAA0B;QACvD,OAAO,IAAI,iBAAiB,CAC1B,YAAY,CAAC,KAAK,CAAC,WAAW,EAC9B,YAAY,CAAC,KAAK,CAAC,SAAS,EAC5B,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,UAAC,MAAW,IAAK,OAAA,IAAI,uBAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAA3C,CAA2C,CAAC,CAC5F,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D,QAAQ,CAAC,EAAE,CAAC;YACf,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC;YACpB,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC;YACxB,SAAS,EAAE,KAAK;YAChB,GAAG,KAAA;YACH,kBAAkB,EAAE,UAAU;YAC9B,OAAO,SAAA;YACP,kBAAkB,EAAE,IAAI,CAAC,SAAS,EAAE;YACpC,KAAK,EAAE;gBACL,IAAI,EAAE,0CAAqB,CAAC,KAAK;aAClC;SACF,CAAA;IACH,CAAC;IAEa,6BAAW,GAAzB,UAA0B,IAAS;QACjC,OAAO,IAAI,iBAAiB,CAC1B,IAAI,CAAC,KAAK,CAAC,YAAY,EACvB,IAAI,CAAC,KAAK,CAAC,UAAU,EACrB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,UAAC,KAAU,IAAK,OAAA,uBAAU,CAAC,WAAW,CAAC,KAAK,CAAC,EAA7B,CAA6B,CAAC,CACrE,CAAA;IACH,CAAC;IACH,wBAAC;AAAD,CAAC,AAtFD,IAsFC;AAtFY,8CAAiB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EncodeObject } from '@airgap/coinlib-core/dependencies/src/cosmjs';
|
|
2
|
+
import { IAirGapTransaction } from '@airgap/coinlib-core/interfaces/IAirGapTransaction';
|
|
3
|
+
import { ProtocolSymbols } from '@airgap/coinlib-core/utils/ProtocolSymbols';
|
|
4
|
+
import { CosmosProtocolNetwork } from '../CosmosProtocolOptions';
|
|
5
|
+
import { CosmosMessage, CosmosMessageJSON, CosmosMessageType } from './CosmosMessage';
|
|
6
|
+
export declare class CosmosWithdrawDelegationRewardMessage implements CosmosMessage {
|
|
7
|
+
readonly delegatorAddress: string;
|
|
8
|
+
readonly validatorAddress: string;
|
|
9
|
+
readonly type: CosmosMessageType;
|
|
10
|
+
constructor(delegatorAddress: string, validatorAddress: string);
|
|
11
|
+
toEncodeObject(): EncodeObject;
|
|
12
|
+
static fromEncodeObject(encodeObject: EncodeObject): CosmosWithdrawDelegationRewardMessage;
|
|
13
|
+
toAirGapTransaction(identifier: ProtocolSymbols, network: CosmosProtocolNetwork, fee: string): IAirGapTransaction;
|
|
14
|
+
toJSON(): CosmosMessageJSON;
|
|
15
|
+
static fromJSON(json: CosmosMessageJSON): CosmosWithdrawDelegationRewardMessage;
|
|
16
|
+
toRPCBody(): {
|
|
17
|
+
type: string;
|
|
18
|
+
value: {
|
|
19
|
+
delegator_address: string;
|
|
20
|
+
validator_address: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
static fromRPCBody(json: any): CosmosWithdrawDelegationRewardMessage;
|
|
24
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CosmosWithdrawDelegationRewardMessage = void 0;
|
|
4
|
+
var CosmosMessage_1 = require("./CosmosMessage");
|
|
5
|
+
var CosmosWithdrawDelegationRewardMessage = /** @class */ (function () {
|
|
6
|
+
function CosmosWithdrawDelegationRewardMessage(delegatorAddress, validatorAddress) {
|
|
7
|
+
this.type = CosmosMessage_1.CosmosMessageType.WithdrawDelegationReward;
|
|
8
|
+
this.delegatorAddress = delegatorAddress;
|
|
9
|
+
this.validatorAddress = validatorAddress;
|
|
10
|
+
}
|
|
11
|
+
CosmosWithdrawDelegationRewardMessage.prototype.toEncodeObject = function () {
|
|
12
|
+
return {
|
|
13
|
+
typeUrl: this.type.value,
|
|
14
|
+
value: {
|
|
15
|
+
delegatorAddress: this.delegatorAddress,
|
|
16
|
+
validatorAddress: this.validatorAddress
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
CosmosWithdrawDelegationRewardMessage.fromEncodeObject = function (encodeObject) {
|
|
21
|
+
return new CosmosWithdrawDelegationRewardMessage(encodeObject.value.delegatorAddress, encodeObject.value.validatorAddress);
|
|
22
|
+
};
|
|
23
|
+
CosmosWithdrawDelegationRewardMessage.prototype.toAirGapTransaction = function (identifier, network, fee) {
|
|
24
|
+
return {
|
|
25
|
+
from: [this.delegatorAddress],
|
|
26
|
+
to: [this.validatorAddress],
|
|
27
|
+
amount: '0',
|
|
28
|
+
isInbound: false,
|
|
29
|
+
fee: fee,
|
|
30
|
+
protocolIdentifier: identifier,
|
|
31
|
+
network: network,
|
|
32
|
+
transactionDetails: this.toRPCBody()
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
CosmosWithdrawDelegationRewardMessage.prototype.toJSON = function () {
|
|
36
|
+
return {
|
|
37
|
+
type: this.type.index,
|
|
38
|
+
amount: [{ denom: '', amount: '' }],
|
|
39
|
+
fromAddress: this.delegatorAddress,
|
|
40
|
+
toAddress: this.validatorAddress
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
CosmosWithdrawDelegationRewardMessage.fromJSON = function (json) {
|
|
44
|
+
return new CosmosWithdrawDelegationRewardMessage(json.fromAddress, json.toAddress);
|
|
45
|
+
};
|
|
46
|
+
CosmosWithdrawDelegationRewardMessage.prototype.toRPCBody = function () {
|
|
47
|
+
return {
|
|
48
|
+
type: this.type.value,
|
|
49
|
+
value: {
|
|
50
|
+
delegator_address: this.delegatorAddress,
|
|
51
|
+
validator_address: this.validatorAddress
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
CosmosWithdrawDelegationRewardMessage.fromRPCBody = function (json) {
|
|
56
|
+
return new CosmosWithdrawDelegationRewardMessage(json.value.delegator_address, json.value.validator_address);
|
|
57
|
+
};
|
|
58
|
+
return CosmosWithdrawDelegationRewardMessage;
|
|
59
|
+
}());
|
|
60
|
+
exports.CosmosWithdrawDelegationRewardMessage = CosmosWithdrawDelegationRewardMessage;
|
|
61
|
+
//# sourceMappingURL=CosmosWithdrawDelegationRewardMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CosmosWithdrawDelegationRewardMessage.js","sourceRoot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AAI,CAAC,gBAAgB;SACjC,CAAA;IACH,CAAC;IAEa,8CAAQ,GAAtB,UAAuB,IAAuB;QAC5C,OAAO,IAAI,qCAAqC,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IACpF,CAAC;IAEM,yDAAS,GAAhB;QACE,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;YACrB,KAAK,EAAE;gBACL,iBAAiB,EAAE,IAAI,CAAC,gBAAgB;gBACxC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB;aACzC;SACF,CAAA;IACH,CAAC;IAEa,iDAAW,GAAzB,UAA0B,IAAS;QACjC,OAAO,IAAI,qCAAqC,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;IAC9G,CAAC;IACH,4CAAC;AAAD,CAAC,AA/DD,IA+DC;AA/DY,sFAAqC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/SerializableUnsignedCosmosTransaction",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"SerializableUnsignedCosmosTransaction": {
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"callbackURL": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"publicKey": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"transaction": {
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"properties": {
|
|
17
|
+
"accountNumber": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"chainID": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"fee": {
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"properties": {
|
|
26
|
+
"amount": {
|
|
27
|
+
"items": {
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"properties": {
|
|
30
|
+
"amount": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"denom": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"required": ["denom", "amount"],
|
|
38
|
+
"type": "object"
|
|
39
|
+
},
|
|
40
|
+
"type": "array"
|
|
41
|
+
},
|
|
42
|
+
"gas": {
|
|
43
|
+
"type": "string"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": ["amount", "gas"],
|
|
47
|
+
"type": "object"
|
|
48
|
+
},
|
|
49
|
+
"memo": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"messages": {
|
|
53
|
+
"items": {
|
|
54
|
+
"additionalProperties": false,
|
|
55
|
+
"properties": {
|
|
56
|
+
"amount": {
|
|
57
|
+
"items": {
|
|
58
|
+
"additionalProperties": false,
|
|
59
|
+
"properties": {
|
|
60
|
+
"amount": {
|
|
61
|
+
"type": "string"
|
|
62
|
+
},
|
|
63
|
+
"denom": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": ["denom", "amount"],
|
|
68
|
+
"type": "object"
|
|
69
|
+
},
|
|
70
|
+
"type": "array"
|
|
71
|
+
},
|
|
72
|
+
"fromAddress": {
|
|
73
|
+
"type": "string"
|
|
74
|
+
},
|
|
75
|
+
"toAddress": {
|
|
76
|
+
"type": "string"
|
|
77
|
+
},
|
|
78
|
+
"type": {
|
|
79
|
+
"enum": [0, 1, 2, 3],
|
|
80
|
+
"type": "number"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"required": ["type", "amount", "fromAddress", "toAddress"],
|
|
84
|
+
"type": "object"
|
|
85
|
+
},
|
|
86
|
+
"type": "array"
|
|
87
|
+
},
|
|
88
|
+
"sequence": {
|
|
89
|
+
"type": "string"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"required": ["messages", "fee", "memo", "chainID", "accountNumber", "sequence"],
|
|
93
|
+
"type": "object"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"required": ["publicKey", "transaction"],
|
|
97
|
+
"type": "object"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/SignedCosmosTransaction",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"IAirGapSignedTransaction": {
|
|
6
|
+
"type": "string"
|
|
7
|
+
},
|
|
8
|
+
"SignedCosmosTransaction": {
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"accountIdentifier": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"transaction": {
|
|
15
|
+
"$ref": "#/definitions/IAirGapSignedTransaction"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"required": ["accountIdentifier", "transaction"],
|
|
19
|
+
"type": "object"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/SerializableUnsignedCosmosTransaction",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"SerializableUnsignedCosmosTransaction": {
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"callbackURL": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"publicKey": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"transaction": {
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"properties": {
|
|
17
|
+
"accountNumber": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"chainID": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"fee": {
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"properties": {
|
|
26
|
+
"amount": {
|
|
27
|
+
"items": {
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"properties": {
|
|
30
|
+
"amount": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"denom": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"required": ["denom", "amount"],
|
|
38
|
+
"type": "object"
|
|
39
|
+
},
|
|
40
|
+
"type": "array"
|
|
41
|
+
},
|
|
42
|
+
"gas": {
|
|
43
|
+
"type": "string"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": ["amount", "gas"],
|
|
47
|
+
"type": "object"
|
|
48
|
+
},
|
|
49
|
+
"memo": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"messages": {
|
|
53
|
+
"items": {
|
|
54
|
+
"additionalProperties": false,
|
|
55
|
+
"properties": {
|
|
56
|
+
"amount": {
|
|
57
|
+
"items": {
|
|
58
|
+
"additionalProperties": false,
|
|
59
|
+
"properties": {
|
|
60
|
+
"amount": {
|
|
61
|
+
"type": "string"
|
|
62
|
+
},
|
|
63
|
+
"denom": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": ["denom", "amount"],
|
|
68
|
+
"type": "object"
|
|
69
|
+
},
|
|
70
|
+
"type": "array"
|
|
71
|
+
},
|
|
72
|
+
"fromAddress": {
|
|
73
|
+
"type": "string"
|
|
74
|
+
},
|
|
75
|
+
"toAddress": {
|
|
76
|
+
"type": "string"
|
|
77
|
+
},
|
|
78
|
+
"type": {
|
|
79
|
+
"enum": [0, 1, 2, 3],
|
|
80
|
+
"type": "number"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"required": ["type", "amount", "fromAddress", "toAddress"],
|
|
84
|
+
"type": "object"
|
|
85
|
+
},
|
|
86
|
+
"type": "array"
|
|
87
|
+
},
|
|
88
|
+
"sequence": {
|
|
89
|
+
"type": "string"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"required": ["messages", "fee", "memo", "chainID", "accountNumber", "sequence"],
|
|
93
|
+
"type": "object"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"required": ["publicKey", "transaction"],
|
|
97
|
+
"type": "object"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|