@wallfree-dev/module-kit 0.13.42
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/LICENSE.md +7 -0
- package/block-explorer/block-explorer.d.ts +8 -0
- package/block-explorer/block-explorer.js +3 -0
- package/block-explorer/block-explorer.js.map +1 -0
- package/block-explorer/extensions/extensions.d.ts +2 -0
- package/block-explorer/extensions/extensions.js +3 -0
- package/block-explorer/extensions/extensions.js.map +1 -0
- package/factories/amount.d.ts +4 -0
- package/factories/amount.js +16 -0
- package/factories/amount.js.map +1 -0
- package/factories/key.d.ts +5 -0
- package/factories/key.js +24 -0
- package/factories/key.js.map +1 -0
- package/factories/signature.d.ts +2 -0
- package/factories/signature.js +9 -0
- package/factories/signature.js.map +1 -0
- package/factories/transaction.d.ts +3 -0
- package/factories/transaction.js +23 -0
- package/factories/transaction.js.map +1 -0
- package/factories/ui/alert.d.ts +5 -0
- package/factories/ui/alert.js +31 -0
- package/factories/ui/alert.js.map +1 -0
- package/factories/ui/text.d.ts +2 -0
- package/factories/ui/text.js +8 -0
- package/factories/ui/text.js.map +1 -0
- package/index.d.ts +62 -0
- package/index.js +85 -0
- package/index.js.map +1 -0
- package/internal/index.d.ts +5 -0
- package/internal/index.js +7 -0
- package/internal/index.js.map +1 -0
- package/internal/protocol/AirGapDelegateProtocol.d.ts +20 -0
- package/internal/protocol/AirGapDelegateProtocol.js +3 -0
- package/internal/protocol/AirGapDelegateProtocol.js.map +1 -0
- package/internal/utils/protocol.d.ts +5 -0
- package/internal/utils/protocol.js +24 -0
- package/internal/utils/protocol.js.map +1 -0
- package/module/extensions/extensions.d.ts +7 -0
- package/module/extensions/extensions.js +3 -0
- package/module/extensions/extensions.js.map +1 -0
- package/module/extensions/serialization/ProtocolSerializer.d.ts +19 -0
- package/module/extensions/serialization/ProtocolSerializer.js +3 -0
- package/module/extensions/serialization/ProtocolSerializer.js.map +1 -0
- package/module/module-network-registry.d.ts +11 -0
- package/module/module-network-registry.js +22 -0
- package/module/module-network-registry.js.map +1 -0
- package/module/module.d.ts +24 -0
- package/module/module.js +3 -0
- package/module/module.js.map +1 -0
- package/package.json +56 -0
- package/protocol/extensions/address/FetchDataForAddressExtension.d.ts +9 -0
- package/protocol/extensions/address/FetchDataForAddressExtension.js +3 -0
- package/protocol/extensions/address/FetchDataForAddressExtension.js.map +1 -0
- package/protocol/extensions/address/FetchDataForMultipleAddressesExtension.d.ts +9 -0
- package/protocol/extensions/address/FetchDataForMultipleAddressesExtension.js +3 -0
- package/protocol/extensions/address/FetchDataForMultipleAddressesExtension.js.map +1 -0
- package/protocol/extensions/address/MultiAddressPublicKeyExtension.d.ts +8 -0
- package/protocol/extensions/address/MultiAddressPublicKeyExtension.js +3 -0
- package/protocol/extensions/address/MultiAddressPublicKeyExtension.js.map +1 -0
- package/protocol/extensions/bip/Bip32Extension.d.ts +16 -0
- package/protocol/extensions/bip/Bip32Extension.js +3 -0
- package/protocol/extensions/bip/Bip32Extension.js.map +1 -0
- package/protocol/extensions/contract/ConfigurableContractExtension.d.ts +7 -0
- package/protocol/extensions/contract/ConfigurableContractExtension.js +3 -0
- package/protocol/extensions/contract/ConfigurableContractExtension.js.map +1 -0
- package/protocol/extensions/crypto/AESExtension.d.ts +7 -0
- package/protocol/extensions/crypto/AESExtension.js +3 -0
- package/protocol/extensions/crypto/AESExtension.js.map +1 -0
- package/protocol/extensions/crypto/AsymmetricEncryptionExtension.d.ts +9 -0
- package/protocol/extensions/crypto/AsymmetricEncryptionExtension.js +3 -0
- package/protocol/extensions/crypto/AsymmetricEncryptionExtension.js.map +1 -0
- package/protocol/extensions/crypto/CryptoExtension.d.ts +5 -0
- package/protocol/extensions/crypto/CryptoExtension.js +3 -0
- package/protocol/extensions/crypto/CryptoExtension.js.map +1 -0
- package/protocol/extensions/crypto/SignMessageExtension.d.ts +10 -0
- package/protocol/extensions/crypto/SignMessageExtension.js +3 -0
- package/protocol/extensions/crypto/SignMessageExtension.js.map +1 -0
- package/protocol/extensions/dapp/WalletConnectProtocol.d.ts +17 -0
- package/protocol/extensions/dapp/WalletConnectProtocol.js +3 -0
- package/protocol/extensions/dapp/WalletConnectProtocol.js.map +1 -0
- package/protocol/extensions/extensions.d.ts +43 -0
- package/protocol/extensions/extensions.js +3 -0
- package/protocol/extensions/extensions.js.map +1 -0
- package/protocol/extensions/multisig/multisig.d.ts +7 -0
- package/protocol/extensions/multisig/multisig.js +3 -0
- package/protocol/extensions/multisig/multisig.js.map +1 -0
- package/protocol/extensions/sub-protocol/GetTokenBalancesExtension.d.ts +19 -0
- package/protocol/extensions/sub-protocol/GetTokenBalancesExtension.js +3 -0
- package/protocol/extensions/sub-protocol/GetTokenBalancesExtension.js.map +1 -0
- package/protocol/extensions/sub-protocol/MultiTokenSubProtocolExtension.d.ts +12 -0
- package/protocol/extensions/sub-protocol/MultiTokenSubProtocolExtension.js +3 -0
- package/protocol/extensions/sub-protocol/MultiTokenSubProtocolExtension.js.map +1 -0
- package/protocol/extensions/sub-protocol/SingleTokenSubProtocolExtension.d.ts +9 -0
- package/protocol/extensions/sub-protocol/SingleTokenSubProtocolExtension.js +3 -0
- package/protocol/extensions/sub-protocol/SingleTokenSubProtocolExtension.js.map +1 -0
- package/protocol/extensions/sub-protocol/SubProtocolExtension.d.ts +7 -0
- package/protocol/extensions/sub-protocol/SubProtocolExtension.js +3 -0
- package/protocol/extensions/sub-protocol/SubProtocolExtension.js.map +1 -0
- package/protocol/extensions/transaction/ConfigurableTransactionInjectorExtension.d.ts +6 -0
- package/protocol/extensions/transaction/ConfigurableTransactionInjectorExtension.js +3 -0
- package/protocol/extensions/transaction/ConfigurableTransactionInjectorExtension.js.map +1 -0
- package/protocol/extensions/transaction/TransactionStatusCheckerExtension.d.ts +6 -0
- package/protocol/extensions/transaction/TransactionStatusCheckerExtension.js +3 -0
- package/protocol/extensions/transaction/TransactionStatusCheckerExtension.js.map +1 -0
- package/protocol/protocol.d.ts +68 -0
- package/protocol/protocol.js +3 -0
- package/protocol/protocol.js.map +1 -0
- package/readme.md +0 -0
- package/serializer/serializer.d.ts +12 -0
- package/serializer/serializer.js +3 -0
- package/serializer/serializer.js.map +1 -0
- package/types/address.d.ts +8 -0
- package/types/address.js +3 -0
- package/types/address.js.map +1 -0
- package/types/airgap.d.ts +15 -0
- package/types/airgap.js +3 -0
- package/types/airgap.js.map +1 -0
- package/types/amount.d.ts +16 -0
- package/types/amount.js +46 -0
- package/types/amount.js.map +1 -0
- package/types/balance.d.ts +5 -0
- package/types/balance.js +3 -0
- package/types/balance.js.map +1 -0
- package/types/base/cursor.d.ts +3 -0
- package/types/base/cursor.js +3 -0
- package/types/base/cursor.js.map +1 -0
- package/types/base/sealed.d.ts +3 -0
- package/types/base/sealed.js +3 -0
- package/types/base/sealed.js.map +1 -0
- package/types/block-explorer.d.ts +4 -0
- package/types/block-explorer.js +3 -0
- package/types/block-explorer.js.map +1 -0
- package/types/bytes.d.ts +8 -0
- package/types/bytes.js +3 -0
- package/types/bytes.js.map +1 -0
- package/types/crypto.d.ts +29 -0
- package/types/crypto.js +3 -0
- package/types/crypto.js.map +1 -0
- package/types/fee.d.ts +7 -0
- package/types/fee.js +3 -0
- package/types/fee.js.map +1 -0
- package/types/key.d.ts +20 -0
- package/types/key.js +3 -0
- package/types/key.js.map +1 -0
- package/types/meta/utility-types.d.ts +8 -0
- package/types/meta/utility-types.js +3 -0
- package/types/meta/utility-types.js.map +1 -0
- package/types/module.d.ts +14 -0
- package/types/module.js +3 -0
- package/types/module.js.map +1 -0
- package/types/protocol.d.ts +57 -0
- package/types/protocol.js +3 -0
- package/types/protocol.js.map +1 -0
- package/types/serializer.d.ts +6 -0
- package/types/serializer.js +3 -0
- package/types/serializer.js.map +1 -0
- package/types/signature.d.ts +3 -0
- package/types/signature.js +3 -0
- package/types/signature.js.map +1 -0
- package/types/sub-protocol.d.ts +1 -0
- package/types/sub-protocol.js +3 -0
- package/types/sub-protocol.js.map +1 -0
- package/types/transaction.d.ts +68 -0
- package/types/transaction.js +3 -0
- package/types/transaction.js.map +1 -0
- package/types/ui/action.d.ts +4 -0
- package/types/ui/action.js +3 -0
- package/types/ui/action.js.map +1 -0
- package/types/ui/alert.d.ts +9 -0
- package/types/ui/alert.js +3 -0
- package/types/ui/alert.js.map +1 -0
- package/types/ui/text.d.ts +9 -0
- package/types/ui/text.js +3 -0
- package/types/ui/text.js.map +1 -0
- package/utils/amount.d.ts +2 -0
- package/utils/amount.js +13 -0
- package/utils/amount.js.map +1 -0
- package/utils/interface.d.ts +2 -0
- package/utils/interface.js +11 -0
- package/utils/interface.js.map +1 -0
- package/utils/key.d.ts +8 -0
- package/utils/key.js +26 -0
- package/utils/key.js.map +1 -0
- package/utils/module.d.ts +9 -0
- package/utils/module.js +42 -0
- package/utils/module.js.map +1 -0
- package/utils/normalize.d.ts +1 -0
- package/utils/normalize.js +8 -0
- package/utils/normalize.js.map +1 -0
- package/utils/protocol.d.ts +63 -0
- package/utils/protocol.js +198 -0
- package/utils/protocol.js.map +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TransactionSignRequest, TransactionSignResponse } from '@wallfree-dev/serializer';
|
|
2
|
+
import { V3SchemaConfiguration } from '../types/serializer';
|
|
3
|
+
import { SignedTransaction, UnsignedTransaction } from '../types/transaction';
|
|
4
|
+
export interface AirGapV3SerializerCompanion {
|
|
5
|
+
schemas: V3SchemaConfiguration[];
|
|
6
|
+
toTransactionSignRequest(identifier: string, unsignedTransaction: UnsignedTransaction, publicKey: string, callbackUrl?: string): Promise<TransactionSignRequest>;
|
|
7
|
+
fromTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise<UnsignedTransaction>;
|
|
8
|
+
validateTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise<boolean>;
|
|
9
|
+
toTransactionSignResponse(identifier: string, signedTransaction: SignedTransaction, accountIdentifier: string): Promise<TransactionSignResponse>;
|
|
10
|
+
fromTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise<SignedTransaction>;
|
|
11
|
+
validateTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise<boolean>;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/serializer/serializer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseCursor } from './base/cursor';
|
|
2
|
+
export declare type Address = string;
|
|
3
|
+
export interface AddressCursor extends BaseCursor {
|
|
4
|
+
}
|
|
5
|
+
export interface AddressWithCursor<_Cursor extends AddressCursor = AddressCursor> {
|
|
6
|
+
address: Address;
|
|
7
|
+
cursor: _Cursor;
|
|
8
|
+
}
|
package/types/address.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src/types/address.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BlockExplorer } from '../block-explorer/block-explorer';
|
|
2
|
+
import { BlockExplorerExtensions } from '../block-explorer/extensions/extensions';
|
|
3
|
+
import { ModuleExtensions } from '../module/extensions/extensions';
|
|
4
|
+
import { Module } from '../module/module';
|
|
5
|
+
import { ProtocolExtensions } from '../protocol/extensions/extensions';
|
|
6
|
+
import { _AnyProtocol } from '../protocol/protocol';
|
|
7
|
+
import { Override } from './meta/utility-types';
|
|
8
|
+
export declare type AirGapInterface<T, E0 extends ApplicableExtension<T> = undefined, E1 extends ApplicableExtension<T> = undefined, E2 extends ApplicableExtension<T> = undefined, E3 extends ApplicableExtension<T> = undefined, E4 extends ApplicableExtension<T> = undefined, E5 extends ApplicableExtension<T> = undefined, E6 extends ApplicableExtension<T> = undefined, E7 extends ApplicableExtension<T> = undefined, E8 extends ApplicableExtension<T> = undefined, E9 extends ApplicableExtension<T> = undefined> = _Interface<T, [E0, E1, E2, E3, E4, E5, E6, E7, E8, E9]>;
|
|
9
|
+
declare type _Interface<T, E extends readonly any[]> = E extends [infer Head, ...infer Tail] ? Head extends undefined ? T : Head extends keyof AirGapExtensions<T> ? _Interface<Override<T, AirGapExtensions<T>[Head]>, [...Tail]> extends infer I ? I : never : never : never;
|
|
10
|
+
export declare type ApplicableExtension<T> = keyof AirGapExtensions<T> | undefined;
|
|
11
|
+
export declare type ApplicableBlockExplorerExtension<T> = keyof BlockExplorerExtensions<T> | undefined;
|
|
12
|
+
export declare type ApplicableModuleExtension<T> = keyof ModuleExtensions<T> | undefined;
|
|
13
|
+
export declare type ApplicableProtocolExtension<T> = keyof ProtocolExtensions<T> | undefined;
|
|
14
|
+
declare type AirGapExtensions<T> = T extends BlockExplorer ? BlockExplorerExtensions<T> : T extends Module ? ModuleExtensions<T> : T extends _AnyProtocol ? ProtocolExtensions<T> : never;
|
|
15
|
+
export {};
|
package/types/airgap.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"airgap.js","sourceRoot":"","sources":["../../src/types/airgap.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import BigNumber from '@wallfree-dev/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber';
|
|
2
|
+
import { ProtocolUnitsMetadata } from './protocol';
|
|
3
|
+
export interface Amount<_Units extends string = string> {
|
|
4
|
+
value: string;
|
|
5
|
+
unit: _Units | 'blockchain';
|
|
6
|
+
}
|
|
7
|
+
export declare class AmountEnhanced<_Units extends string = string> implements Amount<_Units> {
|
|
8
|
+
readonly unit: Amount<_Units>['unit'];
|
|
9
|
+
readonly value: string;
|
|
10
|
+
private readonly bnValue;
|
|
11
|
+
constructor(value: number | string | BigNumber, unit: Amount<_Units>['unit']);
|
|
12
|
+
convert(unit: _Units, unitsMetadata: ProtocolUnitsMetadata<_Units>): AmountEnhanced<_Units>;
|
|
13
|
+
blockchain(unitsMetadata: ProtocolUnitsMetadata<_Units>): AmountEnhanced<_Units>;
|
|
14
|
+
toBigNumber(): BigNumber;
|
|
15
|
+
toJSON(): Amount<_Units>;
|
|
16
|
+
}
|
package/types/amount.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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.AmountEnhanced = void 0;
|
|
7
|
+
var bignumber_1 = __importDefault(require("@wallfree-dev/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
8
|
+
var AmountEnhanced = /** @class */ (function () {
|
|
9
|
+
function AmountEnhanced(value, unit) {
|
|
10
|
+
this.unit = unit;
|
|
11
|
+
this.bnValue = new bignumber_1.default(value);
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(AmountEnhanced.prototype, "value", {
|
|
14
|
+
get: function () {
|
|
15
|
+
return this.bnValue.toString(10);
|
|
16
|
+
},
|
|
17
|
+
enumerable: false,
|
|
18
|
+
configurable: true
|
|
19
|
+
});
|
|
20
|
+
AmountEnhanced.prototype.convert = function (unit, unitsMetadata) {
|
|
21
|
+
var blockchainAmount = this.blockchain(unitsMetadata);
|
|
22
|
+
var unitValue = blockchainAmount.bnValue.shiftedBy(-unitsMetadata[unit].decimals);
|
|
23
|
+
return new AmountEnhanced(unitValue, unit);
|
|
24
|
+
};
|
|
25
|
+
AmountEnhanced.prototype.blockchain = function (unitsMetadata) {
|
|
26
|
+
if (this.unit === 'blockchain') {
|
|
27
|
+
return new AmountEnhanced(this.bnValue, this.unit);
|
|
28
|
+
}
|
|
29
|
+
var blockchainValue = this.bnValue.shiftedBy(unitsMetadata[this.unit].decimals);
|
|
30
|
+
return new AmountEnhanced(blockchainValue, 'blockchain');
|
|
31
|
+
};
|
|
32
|
+
// Different representations
|
|
33
|
+
AmountEnhanced.prototype.toBigNumber = function () {
|
|
34
|
+
return new bignumber_1.default(this.value);
|
|
35
|
+
};
|
|
36
|
+
// Serialization
|
|
37
|
+
AmountEnhanced.prototype.toJSON = function () {
|
|
38
|
+
return {
|
|
39
|
+
value: this.value,
|
|
40
|
+
unit: this.unit
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
return AmountEnhanced;
|
|
44
|
+
}());
|
|
45
|
+
exports.AmountEnhanced = AmountEnhanced;
|
|
46
|
+
//# sourceMappingURL=amount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../src/types/amount.ts"],"names":[],"mappings":";;;;;;AAAA,uHAAgG;AAShG;IAOE,wBAAmB,KAAkC,EAAkB,IAA4B;QAA5B,SAAI,GAAJ,IAAI,CAAwB;QACjG,IAAI,CAAC,OAAO,GAAG,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAA;IACrC,CAAC;IARD,sBAAW,iCAAK;aAAhB;YACE,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;QAClC,CAAC;;;OAAA;IAQM,gCAAO,GAAd,UAAe,IAAY,EAAE,aAA4C;QACvE,IAAM,gBAAgB,GAA2B,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;QAC/E,IAAM,SAAS,GAAc,gBAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAA;QAE9F,OAAO,IAAI,cAAc,CAAS,SAAS,EAAE,IAAI,CAAC,CAAA;IACpD,CAAC;IAEM,mCAAU,GAAjB,UAAkB,aAA4C;QAC5D,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE;YAC9B,OAAO,IAAI,cAAc,CAAS,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;SAC3D;QAED,IAAM,eAAe,GAAc,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAA;QAE5F,OAAO,IAAI,cAAc,CAAS,eAAe,EAAE,YAAY,CAAC,CAAA;IAClE,CAAC;IAED,4BAA4B;IAErB,oCAAW,GAAlB;QACE,OAAO,IAAI,mBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED,gBAAgB;IAET,+BAAM,GAAb;QACE,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAA;IACH,CAAC;IACH,qBAAC;AAAD,CAAC,AA1CD,IA0CC;AA1CY,wCAAc"}
|
package/types/balance.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../src/types/balance.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/types/base/cursor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sealed.js","sourceRoot":"","sources":["../../../src/types/base/sealed.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-explorer.js","sourceRoot":"","sources":["../../src/types/block-explorer.ts"],"names":[],"mappings":""}
|
package/types/bytes.d.ts
ADDED
package/types/bytes.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../src/types/bytes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare type CryptoAlgorithm = 'ed25519' | 'sr25519' | 'secp256k1' | /* | 'secp256r1' */ 'sapling';
|
|
2
|
+
export declare type CryptoSecretType = 'secret' | 'miniSecretXor';
|
|
3
|
+
interface BaseCryptoConfiguration<_Algorithm extends CryptoAlgorithm> {
|
|
4
|
+
algorithm: _Algorithm;
|
|
5
|
+
}
|
|
6
|
+
export interface Ed25519CryptoConfiguration<_SecretType extends CryptoSecretType = CryptoSecretType> extends BaseCryptoConfiguration<'ed25519'> {
|
|
7
|
+
key?: string;
|
|
8
|
+
secretType?: _SecretType;
|
|
9
|
+
}
|
|
10
|
+
export interface Sr25519CryptoConfiguration extends BaseCryptoConfiguration<'sr25519'> {
|
|
11
|
+
compatibility: 'substrate';
|
|
12
|
+
}
|
|
13
|
+
export interface Secp256K1CryptoConfiguration<_SecretType extends CryptoSecretType = CryptoSecretType> extends BaseCryptoConfiguration<'secp256k1'> {
|
|
14
|
+
key?: string;
|
|
15
|
+
secretType?: _SecretType;
|
|
16
|
+
}
|
|
17
|
+
export interface SaplingCryptoConfiguration<_SecretType extends CryptoSecretType = CryptoSecretType> extends BaseCryptoConfiguration<'sapling'> {
|
|
18
|
+
secretType?: _SecretType;
|
|
19
|
+
}
|
|
20
|
+
export declare type CryptoConfiguration = Ed25519CryptoConfiguration | Sr25519CryptoConfiguration | Secp256K1CryptoConfiguration | SaplingCryptoConfiguration;
|
|
21
|
+
export interface CryptoDerivative {
|
|
22
|
+
depth: number;
|
|
23
|
+
parentFingerprint: number;
|
|
24
|
+
index: number;
|
|
25
|
+
chainCode: string;
|
|
26
|
+
secretKey: string;
|
|
27
|
+
publicKey: string;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
package/types/crypto.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src/types/crypto.ts"],"names":[],"mappings":""}
|
package/types/fee.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Amount } from './amount';
|
|
2
|
+
export interface FeeDefaults<_Units extends string = string> {
|
|
3
|
+
low: Amount<_Units>;
|
|
4
|
+
medium: Amount<_Units>;
|
|
5
|
+
high: Amount<_Units>;
|
|
6
|
+
}
|
|
7
|
+
export declare type FeeEstimation<_Units extends string = string> = FeeDefaults<_Units> | Amount<_Units>;
|
package/types/fee.js
ADDED
package/types/fee.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fee.js","sourceRoot":"","sources":["../../src/types/fee.ts"],"names":[],"mappings":""}
|
package/types/key.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Sealed } from './base/sealed';
|
|
2
|
+
import { BytesString } from './bytes';
|
|
3
|
+
export declare type KeyType = 'priv' | 'xpriv' | 'pub' | 'xpub';
|
|
4
|
+
interface BaseKey<_Type extends KeyType> extends Sealed<_Type>, BytesString {
|
|
5
|
+
}
|
|
6
|
+
export interface SecretKey extends BaseKey<'priv'> {
|
|
7
|
+
}
|
|
8
|
+
export interface ExtendedSecretKey extends BaseKey<'xpriv'> {
|
|
9
|
+
}
|
|
10
|
+
export interface PublicKey extends BaseKey<'pub'> {
|
|
11
|
+
}
|
|
12
|
+
export interface ExtendedPublicKey extends BaseKey<'xpub'> {
|
|
13
|
+
}
|
|
14
|
+
interface BaseKeyPair<_SecretKey extends SecretKey | ExtendedSecretKey, _PublicKey extends PublicKey | ExtendedPublicKey> {
|
|
15
|
+
secretKey: _SecretKey;
|
|
16
|
+
publicKey: _PublicKey;
|
|
17
|
+
}
|
|
18
|
+
export declare type KeyPair = BaseKeyPair<SecretKey, PublicKey>;
|
|
19
|
+
export declare type ExtendedKeyPair = BaseKeyPair<ExtendedSecretKey, ExtendedPublicKey>;
|
|
20
|
+
export {};
|
package/types/key.js
ADDED
package/types/key.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../src/types/key.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type Complement<T, P extends Partial<T>> = Required<Omit<T, keyof P> & P>;
|
|
2
|
+
export declare type RecursivePartial<T> = {
|
|
3
|
+
[K in keyof T]?: T[K] extends (infer U)[] ? RecursivePartial<U>[] : T[K] extends object ? RecursivePartial<T[K]> : T[K];
|
|
4
|
+
};
|
|
5
|
+
export declare type Override<T, U> = Omit<T, keyof U> & U;
|
|
6
|
+
export declare type ExtractTyped<T, K extends T> = Extract<T, K>;
|
|
7
|
+
export declare type ExcludeTyped<T, K extends T> = Exclude<T, K>;
|
|
8
|
+
export declare type OmitTyped<T, K extends keyof T> = Omit<T, K>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility-types.js","sourceRoot":"","sources":["../../../src/types/meta/utility-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ProtocolNetwork } from './protocol';
|
|
2
|
+
export interface OfflineProtocolConfiguration {
|
|
3
|
+
type: 'offline';
|
|
4
|
+
}
|
|
5
|
+
export interface OnlineProtocolConfiguration {
|
|
6
|
+
type: 'online';
|
|
7
|
+
networks: Record<string, ProtocolNetwork>;
|
|
8
|
+
}
|
|
9
|
+
export interface FullProtocolConfiguration {
|
|
10
|
+
type: 'full';
|
|
11
|
+
offline: OfflineProtocolConfiguration;
|
|
12
|
+
online: OnlineProtocolConfiguration;
|
|
13
|
+
}
|
|
14
|
+
export declare type ProtocolConfiguration = OfflineProtocolConfiguration | OnlineProtocolConfiguration | FullProtocolConfiguration;
|
package/types/module.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/types/module.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Amount } from './amount';
|
|
2
|
+
import { FeeDefaults } from './fee';
|
|
3
|
+
export interface ProtocolMetadata<_Units extends string = string, _FeeUnits extends string = _Units> {
|
|
4
|
+
name: string;
|
|
5
|
+
identifier: string;
|
|
6
|
+
units: ProtocolUnitsMetadata<_Units>;
|
|
7
|
+
mainUnit: _Units;
|
|
8
|
+
fee?: ProtocolFeeMetadata<_FeeUnits>;
|
|
9
|
+
account: ProtocolAccountMetadata;
|
|
10
|
+
transaction?: ProtocolTransactionMetadata<_Units>;
|
|
11
|
+
}
|
|
12
|
+
export declare type ProtocolUnitsMetadata<_Units extends string = string> = {
|
|
13
|
+
[key in _Units]: {
|
|
14
|
+
symbol: ProtocolSymbol;
|
|
15
|
+
decimals: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export interface ProtocolSymbol {
|
|
19
|
+
value: string;
|
|
20
|
+
market?: string;
|
|
21
|
+
asset?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ProtocolFeeMetadata<_FeeUnits extends string = string> {
|
|
24
|
+
defaults?: FeeDefaults<_FeeUnits>;
|
|
25
|
+
units?: ProtocolUnitsMetadata<_FeeUnits>;
|
|
26
|
+
mainUnit?: _FeeUnits;
|
|
27
|
+
}
|
|
28
|
+
export interface ProtocolAccountMetadata {
|
|
29
|
+
standardDerivationPath: string;
|
|
30
|
+
address?: {
|
|
31
|
+
isCaseSensitive?: boolean;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
regex?: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface ProtocolTransactionMetadata<_Units extends string = string> {
|
|
37
|
+
arbitraryData?: ProtocolTransactionArbitraryDataMetadata | {
|
|
38
|
+
root?: ProtocolTransactionArbitraryDataMetadata;
|
|
39
|
+
inner?: ProtocolTransactionArbitraryDataMetadata;
|
|
40
|
+
};
|
|
41
|
+
minBalance?: {
|
|
42
|
+
amount: Amount<_Units>;
|
|
43
|
+
name?: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface ProtocolTransactionArbitraryDataMetadata {
|
|
47
|
+
name: string;
|
|
48
|
+
maxLength?: number;
|
|
49
|
+
regex?: string;
|
|
50
|
+
}
|
|
51
|
+
export declare type ProtocolNetworkType = 'mainnet' | 'testnet' | 'custom';
|
|
52
|
+
export interface ProtocolNetwork {
|
|
53
|
+
name: string;
|
|
54
|
+
type: ProtocolNetworkType;
|
|
55
|
+
rpcUrl: string;
|
|
56
|
+
blockExplorerUrl: string;
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/types/protocol.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/types/serializer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src/types/signature.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type SubProtocolType = 'token' | 'account';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-protocol.js","sourceRoot":"","sources":["../../src/types/sub-protocol.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Address } from './address';
|
|
2
|
+
import { Amount } from './amount';
|
|
3
|
+
import { BaseCursor } from './base/cursor';
|
|
4
|
+
import { Sealed } from './base/sealed';
|
|
5
|
+
import { ProtocolNetwork } from './protocol';
|
|
6
|
+
import { AirGapUIAlert } from './ui/alert';
|
|
7
|
+
import { AirGapUIText } from './ui/text';
|
|
8
|
+
export declare type TransactionType = 'unsigned' | 'signed';
|
|
9
|
+
interface BaseTransaction<_Type extends TransactionType> extends Sealed<_Type> {
|
|
10
|
+
}
|
|
11
|
+
export interface UnsignedTransaction extends BaseTransaction<'unsigned'> {
|
|
12
|
+
}
|
|
13
|
+
export interface SignedTransaction extends BaseTransaction<'signed'> {
|
|
14
|
+
}
|
|
15
|
+
export interface AirGapTransaction<_Units extends string = string, _FeeUnits extends string = _Units> {
|
|
16
|
+
from: string[];
|
|
17
|
+
to: string[];
|
|
18
|
+
isInbound: boolean;
|
|
19
|
+
amount: Amount<_Units>;
|
|
20
|
+
fee: Amount<_FeeUnits>;
|
|
21
|
+
network: ProtocolNetwork;
|
|
22
|
+
timestamp?: number;
|
|
23
|
+
status?: AirGapTransactionStatus;
|
|
24
|
+
type?: string | {
|
|
25
|
+
name: string;
|
|
26
|
+
[key: string]: string;
|
|
27
|
+
};
|
|
28
|
+
uiAlerts?: AirGapUIAlert[];
|
|
29
|
+
changeAddressInfo?: any;
|
|
30
|
+
displayFromTo?: boolean;
|
|
31
|
+
arbitraryData?: string | [AirGapUIText, string];
|
|
32
|
+
json?: any;
|
|
33
|
+
extra?: any;
|
|
34
|
+
}
|
|
35
|
+
export interface TransactionCursor extends BaseCursor {
|
|
36
|
+
}
|
|
37
|
+
export interface AirGapTransactionsWithCursor<_Cursor extends TransactionCursor = TransactionCursor, _Units extends string = string, _FeeUnits extends string = _Units> {
|
|
38
|
+
transactions: AirGapTransaction<_Units, _FeeUnits>[];
|
|
39
|
+
cursor: _Cursor;
|
|
40
|
+
}
|
|
41
|
+
export interface TransactionDetails<_Units extends string = string> {
|
|
42
|
+
to: Address;
|
|
43
|
+
amount: Amount<_Units>;
|
|
44
|
+
arbitraryData?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface TransactionSimpleConfiguration {
|
|
47
|
+
arbitraryData?: string;
|
|
48
|
+
keepMinBalance?: boolean;
|
|
49
|
+
assetId?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface TransactionFullConfiguration<_FeeUnits extends string = string> extends TransactionSimpleConfiguration {
|
|
52
|
+
fee?: Amount<_FeeUnits>;
|
|
53
|
+
}
|
|
54
|
+
interface BaseTransactionStatus<_Type extends string> extends Sealed<_Type> {
|
|
55
|
+
hash?: string;
|
|
56
|
+
block?: string;
|
|
57
|
+
}
|
|
58
|
+
interface AppliedTransactionStatus extends BaseTransactionStatus<'applied'> {
|
|
59
|
+
}
|
|
60
|
+
interface FailedTransactionStatus extends BaseTransactionStatus<'failed'> {
|
|
61
|
+
}
|
|
62
|
+
interface UnknownTransactionStatus extends BaseTransactionStatus<'unknown'> {
|
|
63
|
+
}
|
|
64
|
+
interface CustomTransactionStatus extends BaseTransactionStatus<'custom'> {
|
|
65
|
+
name: string;
|
|
66
|
+
}
|
|
67
|
+
export declare type AirGapTransactionStatus = AppliedTransactionStatus | FailedTransactionStatus | UnknownTransactionStatus | CustomTransactionStatus;
|
|
68
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/types/transaction.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/types/ui/action.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AirGapUIAction } from './action';
|
|
2
|
+
import { AirGapUIText } from './text';
|
|
3
|
+
export interface AirGapUIAlert {
|
|
4
|
+
type: 'success' | 'info' | 'warning' | 'error';
|
|
5
|
+
title: AirGapUIText;
|
|
6
|
+
description: AirGapUIText;
|
|
7
|
+
icon?: string;
|
|
8
|
+
actions?: AirGapUIAction[];
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../src/types/ui/alert.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Sealed } from '../base/sealed';
|
|
2
|
+
declare type UITextType = 'plain';
|
|
3
|
+
interface BaseUIText<_Type extends UITextType> extends Sealed<_Type> {
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
interface PlainUIText extends BaseUIText<'plain'> {
|
|
7
|
+
}
|
|
8
|
+
export declare type AirGapUIText = PlainUIText;
|
|
9
|
+
export {};
|
package/types/ui/text.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/types/ui/text.ts"],"names":[],"mappings":""}
|
package/utils/amount.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAmount = void 0;
|
|
4
|
+
var interface_1 = require("./interface");
|
|
5
|
+
var amountSchema = {
|
|
6
|
+
value: 'required',
|
|
7
|
+
unit: 'required'
|
|
8
|
+
};
|
|
9
|
+
function isAmount(object) {
|
|
10
|
+
return (0, interface_1.implementsInterface)(object, amountSchema);
|
|
11
|
+
}
|
|
12
|
+
exports.isAmount = isAmount;
|
|
13
|
+
//# sourceMappingURL=amount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../src/utils/amount.ts"],"names":[],"mappings":";;;AAEA,yCAAyD;AAEzD,IAAM,YAAY,GAAmB;IACnC,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,UAAU;CACjB,CAAA;AAED,SAAgB,QAAQ,CAAwB,MAAe;IAC7D,OAAO,IAAA,+BAAmB,EAAC,MAAM,EAAE,YAAY,CAAC,CAAA;AAClD,CAAC;AAFD,4BAEC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.implementsInterface = void 0;
|
|
4
|
+
function implementsInterface(object, schema) {
|
|
5
|
+
if (typeof object !== 'object' || !object) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return Object.keys(schema).every(function (key) { return schema[key] === 'optional' || key in object; });
|
|
9
|
+
}
|
|
10
|
+
exports.implementsInterface = implementsInterface;
|
|
11
|
+
//# sourceMappingURL=interface.js.map
|