@airgap/cosmos 0.13.10 → 0.13.11-beta.1

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.
Files changed (140) hide show
  1. package/package.json +12 -8
  2. package/airgap-coinlib-cosmos.min.js +0 -86304
  3. package/index.d.ts +0 -1
  4. package/index.js +0 -18
  5. package/index.js.map +0 -1
  6. package/v0/index.d.ts +0 -10
  7. package/v0/index.js +0 -32
  8. package/v0/index.js.map +0 -1
  9. package/v0/protocol/CosmosAddress.d.ts +0 -8
  10. package/v0/protocol/CosmosAddress.js +0 -28
  11. package/v0/protocol/CosmosAddress.js.map +0 -1
  12. package/v0/protocol/CosmosCoin.d.ts +0 -19
  13. package/v0/protocol/CosmosCoin.js +0 -55
  14. package/v0/protocol/CosmosCoin.js.map +0 -1
  15. package/v0/protocol/CosmosCryptoClient.d.ts +0 -8
  16. package/v0/protocol/CosmosCryptoClient.js +0 -90
  17. package/v0/protocol/CosmosCryptoClient.js.map +0 -1
  18. package/v0/protocol/CosmosFee.d.ts +0 -15
  19. package/v0/protocol/CosmosFee.js +0 -31
  20. package/v0/protocol/CosmosFee.js.map +0 -1
  21. package/v0/protocol/CosmosNodeClient.d.ts +0 -25
  22. package/v0/protocol/CosmosNodeClient.js +0 -382
  23. package/v0/protocol/CosmosNodeClient.js.map +0 -1
  24. package/v0/protocol/CosmosProtocol.d.ts +0 -124
  25. package/v0/protocol/CosmosProtocol.js +0 -1155
  26. package/v0/protocol/CosmosProtocol.js.map +0 -1
  27. package/v0/protocol/CosmosProtocolOptions.d.ts +0 -22
  28. package/v0/protocol/CosmosProtocolOptions.js +0 -116
  29. package/v0/protocol/CosmosProtocolOptions.js.map +0 -1
  30. package/v0/protocol/CosmosTransaction.d.ts +0 -37
  31. package/v0/protocol/CosmosTransaction.js +0 -106
  32. package/v0/protocol/CosmosTransaction.js.map +0 -1
  33. package/v0/protocol/CosmosTypes.d.ts +0 -310
  34. package/v0/protocol/CosmosTypes.js +0 -8
  35. package/v0/protocol/CosmosTypes.js.map +0 -1
  36. package/v0/protocol/cosmos-message/CosmosDelegateMessage.d.ts +0 -20
  37. package/v0/protocol/cosmos-message/CosmosDelegateMessage.js +0 -72
  38. package/v0/protocol/cosmos-message/CosmosDelegateMessage.js.map +0 -1
  39. package/v0/protocol/cosmos-message/CosmosMessage.d.ts +0 -39
  40. package/v0/protocol/cosmos-message/CosmosMessage.js +0 -47
  41. package/v0/protocol/cosmos-message/CosmosMessage.js.map +0 -1
  42. package/v0/protocol/cosmos-message/CosmosSendMessage.d.ts +0 -20
  43. package/v0/protocol/cosmos-message/CosmosSendMessage.js +0 -85
  44. package/v0/protocol/cosmos-message/CosmosSendMessage.js.map +0 -1
  45. package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.d.ts +0 -24
  46. package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js +0 -61
  47. package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js.map +0 -1
  48. package/v0/serializer/schemas/v2/transaction-sign-request-cosmos.json +0 -100
  49. package/v0/serializer/schemas/v2/transaction-sign-response-cosmos.json +0 -22
  50. package/v0/serializer/schemas/v3/transaction-sign-request-cosmos.json +0 -100
  51. package/v0/serializer/schemas/v3/transaction-sign-response-cosmos.json +0 -23
  52. package/v0/serializer/validators/transaction-validator.d.ts +0 -15
  53. package/v0/serializer/validators/transaction-validator.js +0 -112
  54. package/v0/serializer/validators/transaction-validator.js.map +0 -1
  55. package/v0/types/signed-transaction-cosmos.d.ts +0 -5
  56. package/v0/types/signed-transaction-cosmos.js +0 -3
  57. package/v0/types/signed-transaction-cosmos.js.map +0 -1
  58. package/v0/types/transaction-cosmos.d.ts +0 -5
  59. package/v0/types/transaction-cosmos.js +0 -3
  60. package/v0/types/transaction-cosmos.js.map +0 -1
  61. package/v0/types/unsigned-transaction-cosmos.d.ts +0 -33
  62. package/v0/types/unsigned-transaction-cosmos.js +0 -10
  63. package/v0/types/unsigned-transaction-cosmos.js.map +0 -1
  64. package/v1/block-explorer/MintscanBlockExplorer.d.ts +0 -9
  65. package/v1/block-explorer/MintscanBlockExplorer.js +0 -74
  66. package/v1/block-explorer/MintscanBlockExplorer.js.map +0 -1
  67. package/v1/data/CosmosAddress.d.ts +0 -7
  68. package/v1/data/CosmosAddress.js +0 -29
  69. package/v1/data/CosmosAddress.js.map +0 -1
  70. package/v1/data/CosmosCoin.d.ts +0 -19
  71. package/v1/data/CosmosCoin.js +0 -55
  72. package/v1/data/CosmosCoin.js.map +0 -1
  73. package/v1/data/CosmosFee.d.ts +0 -15
  74. package/v1/data/CosmosFee.js +0 -31
  75. package/v1/data/CosmosFee.js.map +0 -1
  76. package/v1/data/transaction/CosmosTransaction.d.ts +0 -36
  77. package/v1/data/transaction/CosmosTransaction.js +0 -109
  78. package/v1/data/transaction/CosmosTransaction.js.map +0 -1
  79. package/v1/data/transaction/message/CosmosDelegateMessage.d.ts +0 -19
  80. package/v1/data/transaction/message/CosmosDelegateMessage.js +0 -70
  81. package/v1/data/transaction/message/CosmosDelegateMessage.js.map +0 -1
  82. package/v1/data/transaction/message/CosmosMessage.d.ts +0 -38
  83. package/v1/data/transaction/message/CosmosMessage.js +0 -47
  84. package/v1/data/transaction/message/CosmosMessage.js.map +0 -1
  85. package/v1/data/transaction/message/CosmosSendMessage.d.ts +0 -19
  86. package/v1/data/transaction/message/CosmosSendMessage.js +0 -83
  87. package/v1/data/transaction/message/CosmosSendMessage.js.map +0 -1
  88. package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.d.ts +0 -23
  89. package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js +0 -61
  90. package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js.map +0 -1
  91. package/v1/index.d.ts +0 -9
  92. package/v1/index.js +0 -11
  93. package/v1/index.js.map +0 -1
  94. package/v1/module/CosmosModule.d.ts +0 -15
  95. package/v1/module/CosmosModule.js +0 -107
  96. package/v1/module/CosmosModule.js.map +0 -1
  97. package/v1/node/CosmosNodeClient.d.ts +0 -28
  98. package/v1/node/CosmosNodeClient.js +0 -381
  99. package/v1/node/CosmosNodeClient.js.map +0 -1
  100. package/v1/protocol/CosmosCryptoClient.d.ts +0 -8
  101. package/v1/protocol/CosmosCryptoClient.js +0 -90
  102. package/v1/protocol/CosmosCryptoClient.js.map +0 -1
  103. package/v1/protocol/CosmosProtocol.d.ts +0 -50
  104. package/v1/protocol/CosmosProtocol.js +0 -662
  105. package/v1/protocol/CosmosProtocol.js.map +0 -1
  106. package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +0 -7
  107. package/v1/serializer/v3/schemas/converter/transaction-converter.js +0 -37
  108. package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +0 -1
  109. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.d.ts +0 -4
  110. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js +0 -3
  111. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js.map +0 -1
  112. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.d.ts +0 -3
  113. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js +0 -3
  114. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js.map +0 -1
  115. package/v1/serializer/v3/schemas/generated/transaction-sign-request-cosmos.json +0 -100
  116. package/v1/serializer/v3/schemas/generated/transaction-sign-response-cosmos.json +0 -19
  117. package/v1/serializer/v3/serializer-companion.d.ts +0 -12
  118. package/v1/serializer/v3/serializer-companion.js +0 -142
  119. package/v1/serializer/v3/serializer-companion.js.map +0 -1
  120. package/v1/serializer/v3/validators/transaction-validators.d.ts +0 -7
  121. package/v1/serializer/v3/validators/transaction-validators.js +0 -88
  122. package/v1/serializer/v3/validators/transaction-validators.js.map +0 -1
  123. package/v1/types/protocol.d.ts +0 -8
  124. package/v1/types/protocol.js +0 -3
  125. package/v1/types/protocol.js.map +0 -1
  126. package/v1/types/rpc.d.ts +0 -286
  127. package/v1/types/rpc.js +0 -3
  128. package/v1/types/rpc.js.map +0 -1
  129. package/v1/types/transaction.d.ts +0 -44
  130. package/v1/types/transaction.js +0 -10
  131. package/v1/types/transaction.js.map +0 -1
  132. package/v1/utils/key.d.ts +0 -3
  133. package/v1/utils/key.js +0 -20
  134. package/v1/utils/key.js.map +0 -1
  135. package/v1/utils/signature.d.ts +0 -2
  136. package/v1/utils/signature.js +0 -13
  137. package/v1/utils/signature.js.map +0 -1
  138. package/v1/utils/transaction.d.ts +0 -1
  139. package/v1/utils/transaction.js +0 -8
  140. package/v1/utils/transaction.js.map +0 -1
@@ -1,109 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CosmosTransaction = void 0;
7
- var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
8
- var errors_1 = require("@airgap/coinlib-core/errors");
9
- var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
10
- var CosmosFee_1 = require("../CosmosFee");
11
- var CosmosDelegateMessage_1 = require("./message/CosmosDelegateMessage");
12
- var CosmosMessage_1 = require("./message/CosmosMessage");
13
- var CosmosSendMessage_1 = require("./message/CosmosSendMessage");
14
- var CosmosWithdrawDelegationRewardMessage_1 = require("./message/CosmosWithdrawDelegationRewardMessage");
15
- var CosmosTransaction = /** @class */ (function () {
16
- function CosmosTransaction(messages, fee, memo, chainID, accountNumber, sequence) {
17
- this.messages = messages;
18
- this.fee = fee;
19
- this.memo = memo;
20
- this.chainID = chainID;
21
- this.accountNumber = accountNumber;
22
- this.sequence = sequence;
23
- }
24
- CosmosTransaction.prototype.toJSON = function () {
25
- return {
26
- accountNumber: this.accountNumber,
27
- chainID: this.chainID,
28
- fee: this.fee.toJSON(),
29
- memo: this.memo,
30
- messages: this.messages.map(function (value) { return value.toJSON(); }),
31
- sequence: this.sequence
32
- };
33
- };
34
- CosmosTransaction.prototype.toRPCBody = function () {
35
- return {
36
- account_number: this.accountNumber,
37
- chain_id: this.chainID,
38
- fee: this.fee.toRPCBody(),
39
- memo: this.memo,
40
- msgs: this.messages.map(function (value) { return value.toRPCBody(); }),
41
- sequence: this.sequence
42
- };
43
- };
44
- CosmosTransaction.prototype.toEncodeObject = function () {
45
- return {
46
- typeUrl: '/cosmos.tx.v1beta1.TxBody',
47
- value: {
48
- messages: this.messages.map(function (msg) { return msg.toEncodeObject(); }),
49
- memo: this.memo
50
- }
51
- };
52
- };
53
- CosmosTransaction.prototype.toAirGapTransactions = function (network) {
54
- var _this = this;
55
- var fee = this.fee.amount.map(function (value) { return new bignumber_1.default(value.amount); }).reduce(function (prev, next) { return prev.plus(next); });
56
- return this.messages
57
- .map(function (message) { return message.toAirGapTransaction(network, fee.toString(10)); })
58
- .map(function (tx) {
59
- if (!tx.json) {
60
- tx.json = {};
61
- }
62
- tx.json.accountNumber = _this.accountNumber;
63
- tx.json.chainID = _this.chainID;
64
- tx.json.memo = _this.memo;
65
- tx.json.sequence = _this.sequence;
66
- tx.arbitraryData = _this.memo;
67
- return tx;
68
- });
69
- };
70
- CosmosTransaction.fromJSON = function (json) {
71
- json = JSON.parse(JSON.stringify(json));
72
- var messages = json.messages.map(function (value) {
73
- var type = value.type;
74
- switch (type) {
75
- case CosmosMessage_1.CosmosMessageType.Send.index:
76
- return CosmosSendMessage_1.CosmosSendMessage.fromJSON(value);
77
- case CosmosMessage_1.CosmosMessageType.Delegate.index:
78
- case CosmosMessage_1.CosmosMessageType.Undelegate.index:
79
- return CosmosDelegateMessage_1.CosmosDelegateMessage.fromJSON(value);
80
- case CosmosMessage_1.CosmosMessageType.WithdrawDelegationReward.index:
81
- return CosmosWithdrawDelegationRewardMessage_1.CosmosWithdrawDelegationRewardMessage.fromJSON(value);
82
- default:
83
- throw new errors_1.InvalidValueError(coinlib_error_1.Domain.COSMOS, 'Unknown message');
84
- }
85
- });
86
- return new CosmosTransaction(messages, CosmosFee_1.CosmosFee.fromJSON(json.fee), json.memo, json.chainID, json.accountNumber, json.sequence);
87
- };
88
- CosmosTransaction.fromRPCBody = function (json) {
89
- json = JSON.parse(JSON.stringify(json));
90
- var messages = json.msgs.map(function (value) {
91
- var type = value.type;
92
- switch (type) {
93
- case CosmosMessage_1.CosmosMessageType.Send.value:
94
- return CosmosSendMessage_1.CosmosSendMessage.fromRPCBody(value);
95
- case CosmosMessage_1.CosmosMessageType.Delegate.value:
96
- case CosmosMessage_1.CosmosMessageType.Undelegate.value:
97
- return CosmosDelegateMessage_1.CosmosDelegateMessage.fromRPCBody(value);
98
- case CosmosMessage_1.CosmosMessageType.WithdrawDelegationReward.value:
99
- return CosmosWithdrawDelegationRewardMessage_1.CosmosWithdrawDelegationRewardMessage.fromRPCBody(value);
100
- default:
101
- throw new errors_1.InvalidValueError(coinlib_error_1.Domain.COSMOS, 'Unknown message');
102
- }
103
- });
104
- return new CosmosTransaction(messages, CosmosFee_1.CosmosFee.fromRPCBody(json.fee), json.memo, json.chain_id, json.account_number, json.sequence);
105
- };
106
- return CosmosTransaction;
107
- }());
108
- exports.CosmosTransaction = CosmosTransaction;
109
- //# sourceMappingURL=CosmosTransaction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CosmosTransaction.js","sourceRoot":"","sources":["../../../../src/v1/data/transaction/CosmosTransaction.ts"],"names":[],"mappings":";;;;;;AAAA,iHAA0F;AAE1F,sDAA+D;AAC/D,2EAAkE;AAOlE,0CAAwC;AAExC,yEAAuE;AACvE,yDAAkG;AAClG,iEAA+D;AAC/D,yGAAuG;AAMvG;IAQE,2BAAY,QAAyB,EAAE,GAAc,EAAE,IAAY,EAAE,OAAe,EAAE,aAAqB,EAAE,QAAgB;QAC3H,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IA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CAAC,CAAA;gBACjD,KAAK,iCAAiB,CAAC,wBAAwB,CAAC,KAAK;oBACnD,OAAO,6EAAqC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;gBACjE;oBACE,MAAM,IAAI,0BAAiB,CAAC,sBAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;aAChE;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,IAAI,iBAAiB,CAAC,QAAQ,EAAE,qBAAS,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACvI,CAAC;IACH,wBAAC;AAAD,CAAC,AA5GD,IA4GC;AA5GY,8CAAiB"}
@@ -1,19 +0,0 @@
1
- import { EncodeObject } from '@airgap/coinlib-core/dependencies/src/cosmjs';
2
- import { AirGapTransaction } from '@airgap/module-kit';
3
- import { CosmosProtocolNetwork, CosmosUnits } from '../../../types/protocol';
4
- import { CosmosCoin } from '../../CosmosCoin';
5
- import { CosmosMessage, CosmosMessageJSON, CosmosMessageType } from './CosmosMessage';
6
- export declare class CosmosDelegateMessage implements CosmosMessage {
7
- readonly delegatorAddress: string;
8
- readonly validatorAddress: string;
9
- readonly amount: CosmosCoin;
10
- readonly type: CosmosMessageType;
11
- constructor(delegatorAddress: string, validatorAddress: string, amount: CosmosCoin, undelegate?: boolean);
12
- toEncodeObject(): EncodeObject;
13
- static fromEncodeObject(encodeObject: EncodeObject): CosmosDelegateMessage;
14
- toJSON(): CosmosMessageJSON;
15
- static fromJSON(json: CosmosMessageJSON): CosmosDelegateMessage;
16
- toRPCBody(): any;
17
- toAirGapTransaction(network: CosmosProtocolNetwork, fee: string): AirGapTransaction<CosmosUnits>;
18
- static fromRPCBody(json: any): CosmosDelegateMessage;
19
- }
@@ -1,70 +0,0 @@
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 module_kit_1 = require("@airgap/module-kit");
6
- var CosmosCoin_1 = require("../../CosmosCoin");
7
- var CosmosMessage_1 = require("./CosmosMessage");
8
- var CosmosDelegateMessage = /** @class */ (function () {
9
- function CosmosDelegateMessage(delegatorAddress, validatorAddress, amount, undelegate) {
10
- if (undelegate === void 0) { undelegate = false; }
11
- this.delegatorAddress = delegatorAddress;
12
- this.validatorAddress = validatorAddress;
13
- this.amount = amount;
14
- this.type = undelegate ? CosmosMessage_1.CosmosMessageType.Undelegate : CosmosMessage_1.CosmosMessageType.Delegate;
15
- }
16
- CosmosDelegateMessage.prototype.toEncodeObject = function () {
17
- return {
18
- typeUrl: this.type.value,
19
- value: {
20
- delegatorAddress: this.delegatorAddress,
21
- validatorAddress: this.validatorAddress,
22
- amount: this.amount
23
- }
24
- };
25
- };
26
- CosmosDelegateMessage.fromEncodeObject = function (encodeObject) {
27
- var _a, _b, _c, _d;
28
- var undelegate = encodeObject.typeUrl === CosmosMessage_1.CosmosMessageType.Undelegate.value;
29
- 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);
30
- };
31
- CosmosDelegateMessage.prototype.toJSON = function () {
32
- return {
33
- type: this.type.index,
34
- amount: [this.amount.toJSON()],
35
- fromAddress: this.delegatorAddress,
36
- toAddress: this.validatorAddress
37
- };
38
- };
39
- CosmosDelegateMessage.fromJSON = function (json) {
40
- return new CosmosDelegateMessage(json.fromAddress, json.toAddress, CosmosCoin_1.CosmosCoin.fromJSON(json.amount[0]), json.type === CosmosMessage_1.CosmosMessageType.Undelegate.index);
41
- };
42
- CosmosDelegateMessage.prototype.toRPCBody = function () {
43
- return {
44
- type: this.type.value,
45
- value: {
46
- amount: this.amount.toRPCBody(),
47
- delegator_address: this.delegatorAddress,
48
- validator_address: this.validatorAddress
49
- }
50
- };
51
- };
52
- CosmosDelegateMessage.prototype.toAirGapTransaction = function (network, fee) {
53
- return {
54
- from: [this.delegatorAddress],
55
- to: [this.validatorAddress],
56
- isInbound: false,
57
- amount: (0, module_kit_1.newAmount)(this.amount.amount, 'blockchain'),
58
- fee: (0, module_kit_1.newAmount)(fee, 'blockchain'),
59
- network: network,
60
- type: this.type.index === CosmosMessage_1.CosmosMessageTypeIndex.DELEGATE ? IAirGapTransaction_1.AirGapTransactionType.DELEGATE : IAirGapTransaction_1.AirGapTransactionType.UNDELEGATE,
61
- json: this.toRPCBody()
62
- };
63
- };
64
- CosmosDelegateMessage.fromRPCBody = function (json) {
65
- 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);
66
- };
67
- return CosmosDelegateMessage;
68
- }());
69
- exports.CosmosDelegateMessage = CosmosDelegateMessage;
70
- //# sourceMappingURL=CosmosDelegateMessage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CosmosDelegateMessage.js","sourceRoot":"","sources":["../../../../../src/v1/data/transaction/message/CosmosDelegateMessage.ts"],"names":[],"mappings":";;;AACA,yFAA0F;AAC1F,iDAAiE;AAGjE,+CAA6C;AAE7C,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,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAA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vFD,IAuFC;AAvFY,sDAAqB"}
@@ -1,38 +0,0 @@
1
- import { JSONConvertible } from '@airgap/coinlib-core/interfaces/JSONConvertible';
2
- import { RPCConvertible } from '@airgap/coinlib-core/interfaces/RPCConvertible';
3
- import { AirGapTransaction } from '@airgap/module-kit';
4
- import { CosmosProtocolNetwork, CosmosUnits } from '../../../types/protocol';
5
- import { CosmosCoinJSON } from '../../CosmosCoin';
6
- import { Encodable } from '../CosmosTransaction';
7
- export interface CosmosMessageJSON {
8
- type: CosmosMessageTypeIndex;
9
- amount: CosmosCoinJSON[];
10
- fromAddress: string;
11
- toAddress: string;
12
- }
13
- export declare enum CosmosMessageTypeIndex {
14
- SEND = 0,
15
- DELEGATE = 1,
16
- UNDELEGATE = 2,
17
- WITHDRAW_DELEGATION_REWARD = 3
18
- }
19
- export declare enum CosmosMessageTypeValue {
20
- SEND = "/cosmos.bank.v1beta1.MsgSend",
21
- DELEGATE = "/cosmos.staking.v1beta1.MsgDelegate",
22
- UNDELEGATE = "/cosmos.staking.v1beta1.MsgUndelegate",
23
- WITHDRAW_DELEGATION_REWARD = "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"
24
- }
25
- export declare class CosmosMessageType {
26
- static Send: CosmosMessageType;
27
- static Delegate: CosmosMessageType;
28
- static Undelegate: CosmosMessageType;
29
- static WithdrawDelegationReward: CosmosMessageType;
30
- readonly index: CosmosMessageTypeIndex;
31
- readonly value: string;
32
- constructor(index: CosmosMessageTypeIndex);
33
- }
34
- export interface CosmosMessage extends JSONConvertible, RPCConvertible, Encodable {
35
- type: CosmosMessageType;
36
- toAirGapTransaction(network: CosmosProtocolNetwork, fee: string): AirGapTransaction<CosmosUnits>;
37
- toJSON(): CosmosMessageJSON;
38
- }
@@ -1,47 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"CosmosMessage.js","sourceRoot":"","sources":["../../../../../src/v1/data/transaction/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"}
@@ -1,19 +0,0 @@
1
- import { EncodeObject } from '@airgap/coinlib-core/dependencies/src/cosmjs';
2
- import { AirGapTransaction } from '@airgap/module-kit';
3
- import { CosmosProtocolNetwork, CosmosUnits } from '../../../types/protocol';
4
- import { CosmosCoin } from '../../CosmosCoin';
5
- import { CosmosMessage, CosmosMessageJSON, CosmosMessageType } from './CosmosMessage';
6
- export declare class CosmosSendMessage implements CosmosMessage {
7
- readonly fromAddress: string;
8
- readonly toAddress: string;
9
- readonly amount: CosmosCoin[];
10
- readonly type: CosmosMessageType;
11
- constructor(fromAddress: string, toAddress: string, amount: CosmosCoin[]);
12
- toEncodeObject(): EncodeObject;
13
- static fromEncodeObject(encodeObject: EncodeObject): CosmosSendMessage;
14
- toJSON(): CosmosMessageJSON;
15
- static fromJSON(json: CosmosMessageJSON): CosmosSendMessage;
16
- toRPCBody(): any;
17
- toAirGapTransaction(network: CosmosProtocolNetwork, fee: string): AirGapTransaction<CosmosUnits>;
18
- static fromRPCBody(json: any): CosmosSendMessage;
19
- }
@@ -1,83 +0,0 @@
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 module_kit_1 = require("@airgap/module-kit");
19
- var CosmosCoin_1 = require("../../CosmosCoin");
20
- var CosmosMessage_1 = require("./CosmosMessage");
21
- var CosmosSendMessage = /** @class */ (function () {
22
- function CosmosSendMessage(fromAddress, toAddress, amount) {
23
- this.type = CosmosMessage_1.CosmosMessageType.Send;
24
- this.fromAddress = fromAddress;
25
- this.toAddress = toAddress;
26
- this.amount = amount;
27
- }
28
- CosmosSendMessage.prototype.toEncodeObject = function () {
29
- return {
30
- typeUrl: this.type.value,
31
- value: {
32
- fromAddress: this.fromAddress,
33
- toAddress: this.toAddress,
34
- amount: __spreadArray([], this.amount, true)
35
- }
36
- };
37
- };
38
- CosmosSendMessage.fromEncodeObject = function (encodeObject) {
39
- return new CosmosSendMessage(encodeObject.value.fromAddress, encodeObject.value.toAddress, encodeObject.value.amount.map(function (amount) { return new CosmosCoin_1.CosmosCoin(amount.denom, amount.amount); }));
40
- };
41
- CosmosSendMessage.prototype.toJSON = function () {
42
- return {
43
- type: this.type.index,
44
- amount: this.amount.map(function (value) { return value.toJSON(); }),
45
- fromAddress: this.fromAddress,
46
- toAddress: this.toAddress
47
- };
48
- };
49
- CosmosSendMessage.fromJSON = function (json) {
50
- return new CosmosSendMessage(json.fromAddress, json.toAddress, json.amount.map(function (value) { return CosmosCoin_1.CosmosCoin.fromJSON(value); }));
51
- };
52
- CosmosSendMessage.prototype.toRPCBody = function () {
53
- return {
54
- type: this.type.value,
55
- value: {
56
- amount: this.amount.map(function (value) { return value.toRPCBody(); }),
57
- from_address: this.fromAddress,
58
- to_address: this.toAddress
59
- }
60
- };
61
- };
62
- CosmosSendMessage.prototype.toAirGapTransaction = function (network, fee) {
63
- return {
64
- from: [this.fromAddress],
65
- to: [this.toAddress],
66
- isInbound: false,
67
- amount: (0, module_kit_1.newAmount)(this.amount
68
- .map(function (value) { return new bignumber_1.default(value.amount); })
69
- .reduce(function (prev, next) { return prev.plus(next); })
70
- .toString(10), 'blockchain'),
71
- fee: (0, module_kit_1.newAmount)(fee, 'blockchain'),
72
- network: network,
73
- type: IAirGapTransaction_1.AirGapTransactionType.SPEND,
74
- json: this.toRPCBody()
75
- };
76
- };
77
- CosmosSendMessage.fromRPCBody = function (json) {
78
- return new CosmosSendMessage(json.value.from_address, json.value.to_address, json.value.amount.map(function (value) { return CosmosCoin_1.CosmosCoin.fromRPCBody(value); }));
79
- };
80
- return CosmosSendMessage;
81
- }());
82
- exports.CosmosSendMessage = CosmosSendMessage;
83
- //# sourceMappingURL=CosmosSendMessage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CosmosSendMessage.js","sourceRoot":"","sources":["../../../../../src/v1/data/transaction/message/CosmosSendMessage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iHAA0F;AAE1F,yFAA0F;AAC1F,iDAAiE;AAGjE,+CAA6D;AAE7D,iDAAqF;AAErF;IAOE,2BAAY,WAAmB,EAAE,SAAiB,EAAE,MAAoB;QAFxD,SAAI,GAAsB,iCAAiB,CAAC,IAAI,CAAA;QAG9D,IAAI,CAAC,WA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AA,uBAAU,CAAC,WAAW,CAAC,KAAK,CAAC,EAA7B,CAA6B,CAAC,CACrE,CAAA;IACH,CAAC;IACH,wBAAC;AAAD,CAAC,AAxFD,IAwFC;AAxFY,8CAAiB"}
@@ -1,23 +0,0 @@
1
- import { EncodeObject } from '@airgap/coinlib-core/dependencies/src/cosmjs';
2
- import { AirGapTransaction } from '@airgap/module-kit';
3
- import { CosmosProtocolNetwork, CosmosUnits } from '../../../types/protocol';
4
- import { CosmosMessage, CosmosMessageJSON, CosmosMessageType } from './CosmosMessage';
5
- export declare class CosmosWithdrawDelegationRewardMessage implements CosmosMessage {
6
- readonly delegatorAddress: string;
7
- readonly validatorAddress: string;
8
- readonly type: CosmosMessageType;
9
- constructor(delegatorAddress: string, validatorAddress: string);
10
- toEncodeObject(): EncodeObject;
11
- static fromEncodeObject(encodeObject: EncodeObject): CosmosWithdrawDelegationRewardMessage;
12
- toAirGapTransaction(network: CosmosProtocolNetwork, fee: string): AirGapTransaction<CosmosUnits>;
13
- toJSON(): CosmosMessageJSON;
14
- static fromJSON(json: CosmosMessageJSON): CosmosWithdrawDelegationRewardMessage;
15
- toRPCBody(): {
16
- type: string;
17
- value: {
18
- delegator_address: string;
19
- validator_address: string;
20
- };
21
- };
22
- static fromRPCBody(json: any): CosmosWithdrawDelegationRewardMessage;
23
- }
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CosmosWithdrawDelegationRewardMessage = void 0;
4
- var module_kit_1 = require("@airgap/module-kit");
5
- var CosmosMessage_1 = require("./CosmosMessage");
6
- var CosmosWithdrawDelegationRewardMessage = /** @class */ (function () {
7
- function CosmosWithdrawDelegationRewardMessage(delegatorAddress, validatorAddress) {
8
- this.type = CosmosMessage_1.CosmosMessageType.WithdrawDelegationReward;
9
- this.delegatorAddress = delegatorAddress;
10
- this.validatorAddress = validatorAddress;
11
- }
12
- CosmosWithdrawDelegationRewardMessage.prototype.toEncodeObject = function () {
13
- return {
14
- typeUrl: this.type.value,
15
- value: {
16
- delegatorAddress: this.delegatorAddress,
17
- validatorAddress: this.validatorAddress
18
- }
19
- };
20
- };
21
- CosmosWithdrawDelegationRewardMessage.fromEncodeObject = function (encodeObject) {
22
- return new CosmosWithdrawDelegationRewardMessage(encodeObject.value.delegatorAddress, encodeObject.value.validatorAddress);
23
- };
24
- CosmosWithdrawDelegationRewardMessage.prototype.toAirGapTransaction = function (network, fee) {
25
- return {
26
- from: [this.delegatorAddress],
27
- to: [this.validatorAddress],
28
- isInbound: false,
29
- amount: (0, module_kit_1.newAmount)('0', 'blockchain'),
30
- fee: (0, module_kit_1.newAmount)(fee, 'blockchain'),
31
- network: network,
32
- json: 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
@@ -1 +0,0 @@
1
- {"version":3,"file":"CosmosWithdrawDelegationRewardMessage.js","sourceRoot":"","sources":["../../../../../src/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.ts"],"names":[],"mappings":";;;AACA,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AAA;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"}
package/v1/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { MintscanBlockExplorer } from './block-explorer/MintscanBlockExplorer';
2
- import { CosmosModule } from './module/CosmosModule';
3
- import { CosmosProtocol, createCosmosProtocol, createCosmosProtocolOptions } from './protocol/CosmosProtocol';
4
- import { CosmosProtocolNetwork, CosmosProtocolOptions, CosmosUnits } from './types/protocol';
5
- import { CosmosSignedTransaction, CosmosTransactionCursor, CosmosUnsignedTransaction } from './types/transaction';
6
- export { CosmosModule };
7
- export { CosmosProtocol, createCosmosProtocol, createCosmosProtocolOptions };
8
- export { MintscanBlockExplorer };
9
- export { CosmosUnits, CosmosProtocolNetwork, CosmosProtocolOptions, CosmosUnsignedTransaction, CosmosSignedTransaction, CosmosTransactionCursor };
package/v1/index.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MintscanBlockExplorer = exports.createCosmosProtocolOptions = exports.createCosmosProtocol = exports.CosmosModule = void 0;
4
- var MintscanBlockExplorer_1 = require("./block-explorer/MintscanBlockExplorer");
5
- Object.defineProperty(exports, "MintscanBlockExplorer", { enumerable: true, get: function () { return MintscanBlockExplorer_1.MintscanBlockExplorer; } });
6
- var CosmosModule_1 = require("./module/CosmosModule");
7
- Object.defineProperty(exports, "CosmosModule", { enumerable: true, get: function () { return CosmosModule_1.CosmosModule; } });
8
- var CosmosProtocol_1 = require("./protocol/CosmosProtocol");
9
- Object.defineProperty(exports, "createCosmosProtocol", { enumerable: true, get: function () { return CosmosProtocol_1.createCosmosProtocol; } });
10
- Object.defineProperty(exports, "createCosmosProtocolOptions", { enumerable: true, get: function () { return CosmosProtocol_1.createCosmosProtocolOptions; } });
11
- //# sourceMappingURL=index.js.map
package/v1/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,gFAA8E;AAgBrE,sGAhBA,6CAAqB,OAgBA;AAf9B,sDAAoD;AAO3C,6FAPA,2BAAY,OAOA;AANrB,4DAA6G;AAUpF,qGAVA,qCAAoB,OAUA;AAAE,4GAVA,4CAA2B,OAUA"}
@@ -1,15 +0,0 @@
1
- import { MainProtocolSymbols } from '@airgap/coinlib-core';
2
- import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@airgap/module-kit';
3
- declare type SupportedProtocols = MainProtocolSymbols.COSMOS;
4
- export declare class CosmosModule implements AirGapModule<{
5
- Protocols: SupportedProtocols;
6
- }> {
7
- private readonly networkRegistries;
8
- readonly supportedProtocols: Record<SupportedProtocols, ProtocolConfiguration>;
9
- createOfflineProtocol(identifier: SupportedProtocols): Promise<AirGapOfflineProtocol | undefined>;
10
- createOnlineProtocol(identifier: SupportedProtocols, networkId?: string): Promise<AirGapOnlineProtocol | undefined>;
11
- createBlockExplorer(identifier: SupportedProtocols, networkId?: string): Promise<AirGapBlockExplorer | undefined>;
12
- createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
13
- private createProtocol;
14
- }
15
- export {};