@airgap/module-kit 0.13.7-beta.23
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/airgap-module-kit.min.js +30062 -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 +50 -0
- package/index.js +51 -0
- package/index.js.map +1 -0
- package/module/extensions/extensions.d.ts +2 -0
- package/module/extensions/extensions.js +3 -0
- package/module/extensions/extensions.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 +11 -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 +7 -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 +15 -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/extensions.d.ts +37 -0
- package/protocol/extensions/extensions.js +3 -0
- package/protocol/extensions/extensions.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 +6 -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 +65 -0
- package/protocol/protocol.js +3 -0
- package/protocol/protocol.js.map +1 -0
- package/readme.md +0 -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 +15 -0
- package/types/amount.js +42 -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/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 +5 -0
- package/types/meta/utility-types.js +3 -0
- package/types/meta/utility-types.js.map +1 -0
- package/types/protocol.d.ts +60 -0
- package/types/protocol.js +3 -0
- package/types/protocol.js.map +1 -0
- package/types/secret.d.ts +12 -0
- package/types/secret.js +3 -0
- package/types/secret.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 +63 -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/normalize.d.ts +1 -0
- package/utils/normalize.js +8 -0
- package/utils/normalize.js.map +1 -0
- package/utils/protocol.d.ts +29 -0
- package/utils/protocol.js +164 -0
- package/utils/protocol.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsymmetricEncryptionExtension.js","sourceRoot":"","sources":["../../../../src/protocol/extensions/crypto/AsymmetricEncryptionExtension.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { _AnyProtocol, _OfflineProtocol } from '../../protocol';
|
|
2
|
+
import { AESExtension } from './AESExtension';
|
|
3
|
+
import { AsymmetricEncryptionExtension } from './AsymmetricEncryptionExtension';
|
|
4
|
+
import { SignMessageExtension } from './SignMessageExtension';
|
|
5
|
+
export declare type CryptoExtension<T extends _AnyProtocol> = SignMessageExtension<T> & AsymmetricEncryptionExtension<T> & (T extends _OfflineProtocol ? AESExtension<T> : {});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CryptoExtension.js","sourceRoot":"","sources":["../../../../src/protocol/extensions/crypto/CryptoExtension.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ExtendedKeyPair, ExtendedPublicKey, KeyPair, PublicKey } from '../../../types/key';
|
|
2
|
+
import { Signature } from '../../../types/signature';
|
|
3
|
+
import { _AnyProtocol, _BaseProtocol, _OfflineProtocol } from '../../protocol';
|
|
4
|
+
export declare type SignMessageExtension<T extends _AnyProtocol> = T extends _OfflineProtocol<any, any, any, any, any, any, infer _PublicKey, any, infer _KeyPair> ? OfflineSignMessage<_PublicKey, _KeyPair> : T extends _BaseProtocol<any, any, any, any, any, any, infer _PublicKey> ? BaseSignMessage<_PublicKey> : never;
|
|
5
|
+
export interface BaseSignMessage<_PublicKey extends PublicKey | ExtendedPublicKey = PublicKey> {
|
|
6
|
+
verifyMessageWithPublicKey(message: string, signature: Signature, publicKey: _PublicKey): Promise<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export interface OfflineSignMessage<_PublicKey extends PublicKey | ExtendedPublicKey = PublicKey, _KeyPair extends KeyPair | ExtendedKeyPair = KeyPair> extends BaseSignMessage<_PublicKey> {
|
|
9
|
+
signMessageWithKeyPair(message: string, keyPair: _KeyPair): Promise<Signature>;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignMessageExtension.js","sourceRoot":"","sources":["../../../../src/protocol/extensions/crypto/SignMessageExtension.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { _OfflineProtocol, _OnlineProtocol, _AnyProtocol, _Protocol } from '../protocol';
|
|
2
|
+
import { FetchDataForAddressExtension } from './address/FetchDataForAddressExtension';
|
|
3
|
+
import { FetchDataForMultipleAddressesExtension } from './address/FetchDataForMultipleAddressesExtension';
|
|
4
|
+
import { MultiAddressPublicKeyExtension } from './address/MultiAddressPublicKeyExtension';
|
|
5
|
+
import { Bip32Extension } from './bip/Bip32Extension';
|
|
6
|
+
import { ConfigurableContractExtension } from './contract/ConfigurableContractExtension';
|
|
7
|
+
import { AESExtension } from './crypto/AESExtension';
|
|
8
|
+
import { AsymmetricEncryptionExtension } from './crypto/AsymmetricEncryptionExtension';
|
|
9
|
+
import { CryptoExtension } from './crypto/CryptoExtension';
|
|
10
|
+
import { SignMessageExtension } from './crypto/SignMessageExtension';
|
|
11
|
+
import { MultiTokenSubProtocolExtension } from './sub-protocol/MultiTokenSubProtocolExtension';
|
|
12
|
+
import { SingleTokenSubProtocolExtension } from './sub-protocol/SingleTokenSubProtocolExtension';
|
|
13
|
+
import { SubProtocolExtension } from './sub-protocol/SubProtocolExtension';
|
|
14
|
+
import { ConfigurableTransactionInjectorExtension } from './transaction/ConfigurableTransactionInjectorExtension';
|
|
15
|
+
import { TransactionStatusCheckerExtension } from './transaction/TransactionStatusCheckerExtension';
|
|
16
|
+
export declare type ProtocolExtensions<T> = T extends _Protocol ? OfflineExtensions<T> & OnlineExtensions<T> : T extends _OfflineProtocol ? OfflineExtensions<T> : T extends _OnlineProtocol ? OnlineExtensions<T> : never;
|
|
17
|
+
interface OfflineAndOnlineExtensions<T extends _AnyProtocol> {
|
|
18
|
+
Bip32: Bip32Extension<T>;
|
|
19
|
+
ConfigurableContract: ConfigurableContractExtension<T>;
|
|
20
|
+
MultiAddressPublicKey: MultiAddressPublicKeyExtension<T>;
|
|
21
|
+
SubProtocol: SubProtocolExtension<T>;
|
|
22
|
+
SingleTokenSubProtocol: SingleTokenSubProtocolExtension<T>;
|
|
23
|
+
MultiTokenSubProtocol: MultiTokenSubProtocolExtension<T>;
|
|
24
|
+
Crypto: CryptoExtension<T>;
|
|
25
|
+
AsymmetricEncryption: AsymmetricEncryptionExtension<T>;
|
|
26
|
+
SignMessage: SignMessageExtension<T>;
|
|
27
|
+
}
|
|
28
|
+
interface OfflineExtensions<T extends _OfflineProtocol> extends OfflineAndOnlineExtensions<T> {
|
|
29
|
+
AES: AESExtension<T>;
|
|
30
|
+
}
|
|
31
|
+
interface OnlineExtensions<T extends _OnlineProtocol> extends OfflineAndOnlineExtensions<T> {
|
|
32
|
+
FetchDataForAddress: FetchDataForAddressExtension<T>;
|
|
33
|
+
FetchDataForMultipleAddresses: FetchDataForMultipleAddressesExtension<T>;
|
|
34
|
+
ConfigurableTransactionInjector: ConfigurableTransactionInjectorExtension<T>;
|
|
35
|
+
TransactionStatusChecker: TransactionStatusCheckerExtension<T>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../../src/protocol/extensions/extensions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ExtendedPublicKey, PublicKey } from '../../../types/key';
|
|
2
|
+
import { Override } from '../../../types/meta/utility-types';
|
|
3
|
+
import { _AnyProtocol, _OnlineProtocol, OnlineGeneric } from '../../protocol';
|
|
4
|
+
import { SingleTokenSubProtocol } from './SingleTokenSubProtocolExtension';
|
|
5
|
+
export declare type MultiTokenSubProtocolExtension<T extends _AnyProtocol> = T extends _OnlineProtocol<infer _AddressCursor, infer _AddressResult, infer _ProtocolNetwork, infer _Units, infer _FeeUnits, infer _FeeEstimation, infer _SignedTransaction, infer _UnsignedTransaction, infer _TransactionCursor, infer _PublicKey, infer _BalanceConfiguration> ? OnlineMultiTokenSubProtocol<_AddressCursor, _AddressResult, _ProtocolNetwork, _Units, _FeeUnits, _FeeEstimation, _SignedTransaction, _UnsignedTransaction, _TransactionCursor, _PublicKey, _BalanceConfiguration> : BaseMultiTokenSubProtocol;
|
|
6
|
+
export interface BaseMultiTokenSubProtocol extends SingleTokenSubProtocol {
|
|
7
|
+
}
|
|
8
|
+
export interface MultiTokenBalanceConfiguration {
|
|
9
|
+
tokenId: string;
|
|
10
|
+
}
|
|
11
|
+
export interface OnlineMultiTokenSubProtocol<_AddressCursor extends OnlineGeneric['AddressCursor'] = OnlineGeneric['AddressCursor'], _AddressResult extends OnlineGeneric['AddressResult'] = OnlineGeneric['AddressResult'], _ProtocolNetwork extends OnlineGeneric['ProtocolNetwork'] = OnlineGeneric['ProtocolNetwork'], _Units extends OnlineGeneric['Units'] = OnlineGeneric['Units'], _FeeUnits extends OnlineGeneric['FeeUnits'] = OnlineGeneric['FeeUnits'], _FeeEstimation extends OnlineGeneric['FeeEstimation'] = OnlineGeneric['FeeEstimation'], _SignedTransaction extends OnlineGeneric['SignedTransaction'] = OnlineGeneric['SignedTransaction'], _UnsignedTransaction extends OnlineGeneric['UnsignedTransaction'] = OnlineGeneric['UnsignedTransaction'], _TransactionCursor extends OnlineGeneric['TransactionCursor'] = OnlineGeneric['TransactionCursor'], _PublicKey extends PublicKey | ExtendedPublicKey = PublicKey, _BalanceConfiguration extends unknown | undefined = undefined> extends BaseMultiTokenSubProtocol, _OnlineProtocol<_AddressCursor, _AddressResult, _ProtocolNetwork, _Units, _FeeUnits, _FeeEstimation, _SignedTransaction, _UnsignedTransaction, _TransactionCursor, _PublicKey, MultiTokenBalanceConfiguration extends _BalanceConfiguration ? MultiTokenBalanceConfiguration : _BalanceConfiguration extends undefined ? MultiTokenBalanceConfiguration : Override<_BalanceConfiguration, MultiTokenBalanceConfiguration>> {
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiTokenSubProtocolExtension.js","sourceRoot":"","sources":["../../../../src/protocol/extensions/sub-protocol/MultiTokenSubProtocolExtension.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Address } from '../../../types/address';
|
|
2
|
+
import { SubProtocolType } from '../../../types/sub-protocol';
|
|
3
|
+
import { _AnyProtocol } from '../../protocol';
|
|
4
|
+
import { SubProtocol } from './SubProtocolExtension';
|
|
5
|
+
export declare type SingleTokenSubProtocolExtension<T extends _AnyProtocol> = SingleTokenSubProtocol;
|
|
6
|
+
export interface SingleTokenSubProtocol extends SubProtocol {
|
|
7
|
+
getType(): Promise<Extract<SubProtocolType, 'token'>>;
|
|
8
|
+
getContractAddress(): Promise<Address>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SingleTokenSubProtocolExtension.js","sourceRoot":"","sources":["../../../../src/protocol/extensions/sub-protocol/SingleTokenSubProtocolExtension.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubProtocolExtension.js","sourceRoot":"","sources":["../../../../src/protocol/extensions/sub-protocol/SubProtocolExtension.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { _OnlineProtocol } from '../../protocol';
|
|
2
|
+
export declare type ConfigurableTransactionInjectorExtension<T extends _OnlineProtocol> = ConfigurableTransactionInjectorProtocol;
|
|
3
|
+
export interface ConfigurableTransactionInjectorProtocol {
|
|
4
|
+
getInjectorUrl(): Promise<string | undefined>;
|
|
5
|
+
setInjectorUrl(url: string): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigurableTransactionInjectorExtension.js","sourceRoot":"","sources":["../../../../src/protocol/extensions/transaction/ConfigurableTransactionInjectorExtension.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AirGapTransactionStatus } from '../../../types/transaction';
|
|
2
|
+
import { _OnlineProtocol } from '../../protocol';
|
|
3
|
+
export declare type TransactionStatusCheckerExtension<T extends _OnlineProtocol> = TransactionStatusChecker;
|
|
4
|
+
export interface TransactionStatusChecker {
|
|
5
|
+
getTransactionStatus(transactionIds: string[]): Promise<Record<string, AirGapTransactionStatus>>;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionStatusCheckerExtension.js","sourceRoot":"","sources":["../../../../src/protocol/extensions/transaction/TransactionStatusCheckerExtension.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Address, AddressCursor, AddressWithCursor } from '../types/address';
|
|
2
|
+
import { AirGapInterface, ApplicableProtocolExtension } from '../types/airgap';
|
|
3
|
+
import { Amount } from '../types/amount';
|
|
4
|
+
import { Balance } from '../types/balance';
|
|
5
|
+
import { FeeEstimation } from '../types/fee';
|
|
6
|
+
import { ExtendedKeyPair, ExtendedPublicKey, ExtendedSecretKey, KeyPair, PublicKey, SecretKey } from '../types/key';
|
|
7
|
+
import { Complement } from '../types/meta/utility-types';
|
|
8
|
+
import { ProtocolMetadata, ProtocolNetwork } from '../types/protocol';
|
|
9
|
+
import { Secret } from '../types/secret';
|
|
10
|
+
import { AirGapTransaction, AirGapTransactionsWithCursor, SignedTransaction, TransactionConfiguration, TransactionCursor, TransactionDetails, UnsignedTransaction } from '../types/transaction';
|
|
11
|
+
export interface BaseGeneric<_AddressCursor extends AddressCursor = AddressCursor, _AddressResult extends Address | AddressWithCursor<_AddressCursor> = Address | AddressWithCursor<_AddressCursor>, _Units extends string = string, _FeeUnits extends string = _Units, _SignedTransaction extends SignedTransaction = SignedTransaction, _UnsignedTransaction extends UnsignedTransaction = UnsignedTransaction> {
|
|
12
|
+
AddressCursor: _AddressCursor;
|
|
13
|
+
AddressResult: _AddressResult;
|
|
14
|
+
Units: _Units;
|
|
15
|
+
FeeUnits: _FeeUnits;
|
|
16
|
+
SignedTransaction: _SignedTransaction;
|
|
17
|
+
UnsignedTransaction: _UnsignedTransaction;
|
|
18
|
+
}
|
|
19
|
+
export interface OfflineGeneric<_AddressCursor extends AddressCursor = AddressCursor, _AddressResult extends Address | AddressWithCursor<_AddressCursor> = Address | AddressWithCursor<_AddressCursor>, _Units extends string = string, _FeeUnits extends string = _Units, _SignedTransaction extends SignedTransaction = SignedTransaction, _UnsignedTransaction extends UnsignedTransaction = UnsignedTransaction> extends BaseGeneric<_AddressCursor, _AddressResult, _Units, _FeeUnits, _SignedTransaction, _UnsignedTransaction> {
|
|
20
|
+
}
|
|
21
|
+
export interface OnlineGeneric<_AddressCursor extends AddressCursor = AddressCursor, _AddressResult extends Address | AddressWithCursor<_AddressCursor> = Address | AddressWithCursor<_AddressCursor>, _ProtocolNetwork extends ProtocolNetwork = ProtocolNetwork, _Units extends string = string, _FeeUnits extends string = _Units, _FeeEstimation extends FeeEstimation<_FeeUnits> | undefined = FeeEstimation<_FeeUnits> | undefined, _SignedTransaction extends SignedTransaction = SignedTransaction, _UnsignedTransaction extends UnsignedTransaction = UnsignedTransaction, _TransactionCursor extends TransactionCursor = TransactionCursor> extends BaseGeneric<_AddressCursor, _AddressResult, _Units, _FeeUnits, _SignedTransaction, _UnsignedTransaction> {
|
|
22
|
+
ProtocolNetwork: _ProtocolNetwork;
|
|
23
|
+
FeeEstimation: _FeeEstimation;
|
|
24
|
+
TransactionCursor: _TransactionCursor;
|
|
25
|
+
}
|
|
26
|
+
declare type TypedAddressCursor<G extends Partial<BaseGeneric>> = Complement<BaseGeneric, G>['AddressCursor'];
|
|
27
|
+
declare type TypedAddressResult<G extends Partial<BaseGeneric>> = Complement<BaseGeneric<TypedAddressCursor<G>>, G>['AddressResult'];
|
|
28
|
+
declare type TypedProtocolNetwork<G extends Partial<OnlineGeneric>> = Complement<OnlineGeneric, G>['ProtocolNetwork'];
|
|
29
|
+
declare type TypedUnits<G extends Partial<BaseGeneric>> = Complement<BaseGeneric, G>['Units'];
|
|
30
|
+
declare type TypedFeeUnits<G extends Partial<BaseGeneric>> = Complement<BaseGeneric<any, any, TypedUnits<G>>, G>['FeeUnits'];
|
|
31
|
+
declare type TypedFeeEstimation<G extends Partial<OnlineGeneric>> = Complement<OnlineGeneric<any, any, any, any, TypedFeeUnits<G>>, G>['FeeEstimation'];
|
|
32
|
+
declare type TypedSignedTransaction<G extends Partial<BaseGeneric>> = Complement<BaseGeneric, G>['SignedTransaction'];
|
|
33
|
+
declare type TypedUnsignedTransaction<G extends Partial<BaseGeneric>> = Complement<BaseGeneric, G>['UnsignedTransaction'];
|
|
34
|
+
declare type TypedTransactionCursor<G extends Partial<OnlineGeneric>> = Complement<OnlineGeneric, G>['TransactionCursor'];
|
|
35
|
+
export interface _BaseProtocol<_AddressCursor extends BaseGeneric['AddressCursor'] = any, _AddressResult extends BaseGeneric['AddressResult'] = any, _Units extends BaseGeneric['Units'] = any, _FeeUnits extends BaseGeneric['FeeUnits'] = any, _SignedTransaction extends BaseGeneric['SignedTransaction'] = any, _UnsignedTransaction extends BaseGeneric['UnsignedTransaction'] = any, _PublicKey extends PublicKey | ExtendedPublicKey = any> {
|
|
36
|
+
getMetadata(): Promise<ProtocolMetadata<_Units, _FeeUnits>>;
|
|
37
|
+
getAddressFromPublicKey(publicKey: _PublicKey): Promise<_AddressResult>;
|
|
38
|
+
getDetailsFromTransaction(transaction: _UnsignedTransaction | _SignedTransaction, publicKey: _PublicKey): Promise<AirGapTransaction<_Units, _FeeUnits>[]>;
|
|
39
|
+
}
|
|
40
|
+
export declare type BaseProtocol<G extends Partial<BaseGeneric> = {}> = _BaseProtocol<TypedAddressCursor<G>, TypedAddressResult<G>, TypedUnits<G>, TypedFeeUnits<G>, TypedSignedTransaction<G>, TypedUnsignedTransaction<G>, PublicKey>;
|
|
41
|
+
export interface _OfflineProtocol<_AddressCursor extends OfflineGeneric['AddressCursor'] = any, _AddressResult extends OfflineGeneric['AddressResult'] = any, _Units extends BaseGeneric['Units'] = any, _FeeUnits extends BaseGeneric['FeeUnits'] = any, _SignedTransaction extends BaseGeneric['SignedTransaction'] = any, _UnsignedTransaction extends BaseGeneric['UnsignedTransaction'] = any, _PublicKey extends PublicKey | ExtendedPublicKey = any, _SecretKey extends SecretKey | ExtendedSecretKey = any, _KeyPair extends KeyPair | ExtendedKeyPair = any> extends _BaseProtocol<_AddressCursor, _AddressResult, _Units, _FeeUnits, _SignedTransaction, _UnsignedTransaction, _PublicKey> {
|
|
42
|
+
getKeyPairFromSecret(secret: Secret, derivationPath?: string): Promise<KeyPair>;
|
|
43
|
+
signTransactionWithSecretKey(transaction: _UnsignedTransaction, secretKey: _SecretKey): Promise<_SignedTransaction>;
|
|
44
|
+
}
|
|
45
|
+
export declare type OfflineProtocol<G extends Partial<OfflineGeneric> = {}> = _OfflineProtocol<TypedAddressCursor<G>, TypedAddressResult<G>, TypedUnits<G>, TypedFeeUnits<G>, TypedSignedTransaction<G>, TypedUnsignedTransaction<G>, PublicKey, SecretKey, KeyPair>;
|
|
46
|
+
export interface _OnlineProtocol<_AddressCursor extends OnlineGeneric['AddressCursor'] = any, _AddressResult extends OnlineGeneric['AddressResult'] = any, _ProtocolNetwork extends OnlineGeneric['ProtocolNetwork'] = any, _Units extends OnlineGeneric['Units'] = any, _FeeUnits extends OnlineGeneric['FeeUnits'] = any, _FeeEstimation extends OnlineGeneric['FeeEstimation'] = any, _SignedTransaction extends OnlineGeneric['SignedTransaction'] = any, _UnsignedTransaction extends OnlineGeneric['UnsignedTransaction'] = any, _TransactionCursor extends OnlineGeneric['TransactionCursor'] = any, _PublicKey extends PublicKey | ExtendedPublicKey = any, _BalanceConfiguration extends Object | undefined = any> extends _BaseProtocol<_AddressCursor, _AddressResult, _Units, _FeeUnits, _SignedTransaction, _UnsignedTransaction, _PublicKey> {
|
|
47
|
+
getNetwork(): Promise<_ProtocolNetwork>;
|
|
48
|
+
getTransactionsForPublicKey(publicKey: _PublicKey, limit: number, cursor?: _TransactionCursor): Promise<AirGapTransactionsWithCursor<_TransactionCursor, _Units, _FeeUnits>>;
|
|
49
|
+
getBalanceOfPublicKey(publicKey: _PublicKey, configuration?: _BalanceConfiguration): Promise<Balance<_Units>>;
|
|
50
|
+
getTransactionMaxAmountWithPublicKey(publicKey: _PublicKey, to: Address[], configuration?: TransactionConfiguration<_FeeUnits>): Promise<Amount<_Units>>;
|
|
51
|
+
getTransactionFeeWithPublicKey(publicKey: _PublicKey, details: TransactionDetails<_Units>[]): Promise<_FeeEstimation>;
|
|
52
|
+
prepareTransactionWithPublicKey(publicKey: _PublicKey, details: TransactionDetails<_Units>[], configuration?: TransactionConfiguration<_FeeUnits>): Promise<_UnsignedTransaction>;
|
|
53
|
+
broadcastTransaction(transaction: _SignedTransaction): Promise<string>;
|
|
54
|
+
}
|
|
55
|
+
export declare type OnlineProtocol<G extends Partial<OnlineGeneric> = {}> = _OnlineProtocol<TypedAddressCursor<G>, TypedAddressResult<G>, TypedProtocolNetwork<G>, TypedUnits<G>, TypedFeeUnits<G>, TypedFeeEstimation<G>, TypedSignedTransaction<G>, TypedUnsignedTransaction<G>, TypedTransactionCursor<G>, PublicKey, undefined>;
|
|
56
|
+
export declare type _Protocol = _OfflineProtocol & _OnlineProtocol;
|
|
57
|
+
export interface Protocol<G extends Partial<OfflineGeneric & OnlineGeneric> = {}> extends OfflineProtocol<G>, OnlineProtocol<G> {
|
|
58
|
+
}
|
|
59
|
+
export declare type _AnyProtocol = _OfflineProtocol | _OnlineProtocol;
|
|
60
|
+
export declare type AnyProtocol<G extends Partial<OfflineGeneric & OnlineGeneric> = {}> = OfflineProtocol<G> | OnlineProtocol<G>;
|
|
61
|
+
export declare type AirGapOfflineProtocol<G extends Partial<OfflineGeneric> = {}, E0 extends ApplicableProtocolExtension<_OfflineProtocol> = undefined, E1 extends ApplicableProtocolExtension<_OfflineProtocol> = undefined, E2 extends ApplicableProtocolExtension<_OfflineProtocol> = undefined, E3 extends ApplicableProtocolExtension<_OfflineProtocol> = undefined, E4 extends ApplicableProtocolExtension<_OfflineProtocol> = undefined, E5 extends ApplicableProtocolExtension<_OfflineProtocol> = undefined, E6 extends ApplicableProtocolExtension<_OfflineProtocol> = undefined, E7 extends ApplicableProtocolExtension<_OfflineProtocol> = undefined, E8 extends ApplicableProtocolExtension<_OfflineProtocol> = undefined, E9 extends ApplicableProtocolExtension<_OfflineProtocol> = undefined> = AirGapInterface<OfflineProtocol<G>, E0, E1, E2, E3, E4, E5, E6, E7, E8, E9>;
|
|
62
|
+
export declare type AirGapOnlineProtocol<G extends Partial<OnlineGeneric> = {}, E0 extends ApplicableProtocolExtension<_OnlineProtocol> = undefined, E1 extends ApplicableProtocolExtension<_OnlineProtocol> = undefined, E2 extends ApplicableProtocolExtension<_OnlineProtocol> = undefined, E3 extends ApplicableProtocolExtension<_OnlineProtocol> = undefined, E4 extends ApplicableProtocolExtension<_OnlineProtocol> = undefined, E5 extends ApplicableProtocolExtension<_OnlineProtocol> = undefined, E6 extends ApplicableProtocolExtension<_OnlineProtocol> = undefined, E7 extends ApplicableProtocolExtension<_OnlineProtocol> = undefined, E8 extends ApplicableProtocolExtension<_OnlineProtocol> = undefined, E9 extends ApplicableProtocolExtension<_OnlineProtocol> = undefined> = AirGapInterface<OnlineProtocol<G>, E0, E1, E2, E3, E4, E5, E6, E7, E8, E9>;
|
|
63
|
+
export declare type AirGapProtocol<G extends Partial<OfflineGeneric & OnlineGeneric> = {}, E0 extends ApplicableProtocolExtension<_OfflineProtocol & _OnlineProtocol> = undefined, E1 extends ApplicableProtocolExtension<_OfflineProtocol & _OnlineProtocol> = undefined, E2 extends ApplicableProtocolExtension<_OfflineProtocol & _OnlineProtocol> = undefined, E3 extends ApplicableProtocolExtension<_OfflineProtocol & _OnlineProtocol> = undefined, E4 extends ApplicableProtocolExtension<_OfflineProtocol & _OnlineProtocol> = undefined, E5 extends ApplicableProtocolExtension<_OfflineProtocol & _OnlineProtocol> = undefined, E6 extends ApplicableProtocolExtension<_OfflineProtocol & _OnlineProtocol> = undefined, E7 extends ApplicableProtocolExtension<_OfflineProtocol & _OnlineProtocol> = undefined, E8 extends ApplicableProtocolExtension<_OfflineProtocol & _OnlineProtocol> = undefined, E9 extends ApplicableProtocolExtension<_OfflineProtocol & _OnlineProtocol> = undefined> = AirGapInterface<Protocol<G>, E0, E1, E2, E3, E4, E5, E6, E7, E8, E9>;
|
|
64
|
+
export declare type AirGapAnyProtocol<G extends Partial<OfflineGeneric & OnlineGeneric> = {}, E0 extends ApplicableProtocolExtension<_OfflineProtocol | _OnlineProtocol> = undefined, E1 extends ApplicableProtocolExtension<_OfflineProtocol | _OnlineProtocol> = undefined, E2 extends ApplicableProtocolExtension<_OfflineProtocol | _OnlineProtocol> = undefined, E3 extends ApplicableProtocolExtension<_OfflineProtocol | _OnlineProtocol> = undefined, E4 extends ApplicableProtocolExtension<_OfflineProtocol | _OnlineProtocol> = undefined, E5 extends ApplicableProtocolExtension<_OfflineProtocol | _OnlineProtocol> = undefined, E6 extends ApplicableProtocolExtension<_OfflineProtocol | _OnlineProtocol> = undefined, E7 extends ApplicableProtocolExtension<_OfflineProtocol | _OnlineProtocol> = undefined, E8 extends ApplicableProtocolExtension<_OfflineProtocol | _OnlineProtocol> = undefined, E9 extends ApplicableProtocolExtension<_OfflineProtocol | _OnlineProtocol> = undefined> = AirGapInterface<AnyProtocol<G>, E0, E1, E2, E3, E4, E5, E6, E7, E8, E9>;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/protocol/protocol.ts"],"names":[],"mappings":""}
|
package/readme.md
ADDED
|
File without changes
|
|
@@ -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, E0 = undefined, E1 = undefined, E2 = undefined, E3 = undefined, E4 = undefined, E5 = undefined, E6 = undefined, E7 = undefined, E8 = undefined, E9 = undefined> = E0 extends keyof AirGapExtensions<T> ? _Interface<Override<T, AirGapExtensions<T>[E0]>, E1, E2, E3, E4, E5, E6, E7, E8, E9> : T;
|
|
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,15 @@
|
|
|
1
|
+
import BigNumber from '@airgap/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
|
+
toJSON(): Amount<_Units>;
|
|
15
|
+
}
|
package/types/amount.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
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("@airgap/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
|
+
// Serialization
|
|
33
|
+
AmountEnhanced.prototype.toJSON = function () {
|
|
34
|
+
return {
|
|
35
|
+
value: this.value,
|
|
36
|
+
unit: this.unit
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
return AmountEnhanced;
|
|
40
|
+
}());
|
|
41
|
+
exports.AmountEnhanced = AmountEnhanced;
|
|
42
|
+
//# sourceMappingURL=amount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../src/types/amount.ts"],"names":[],"mappings":";;;;;;AAAA,iHAA0F;AAS1F;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,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,AApCD,IAoCC;AApCY,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":""}
|
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,5 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility-types.js","sourceRoot":"","sources":["../../../src/types/meta/utility-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Amount } from './amount';
|
|
2
|
+
import { FeeDefaults } from './fee';
|
|
3
|
+
export interface ProtocolMetadata<_Units extends 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> = {
|
|
13
|
+
[key in _Units]: {
|
|
14
|
+
symbol: ProtocolSymbol;
|
|
15
|
+
decimals: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export interface ProtocolSymbol {
|
|
19
|
+
value: string;
|
|
20
|
+
market?: string;
|
|
21
|
+
}
|
|
22
|
+
interface ProtocolFeeMetadataWithUnits<_FeeUnits extends string> {
|
|
23
|
+
units: ProtocolUnitsMetadata<_FeeUnits>;
|
|
24
|
+
mainUnit: _FeeUnits;
|
|
25
|
+
defaults?: FeeDefaults<_FeeUnits>;
|
|
26
|
+
}
|
|
27
|
+
interface ProtocolFeeMetadataWithoutUnits<_FeeUnits extends string> {
|
|
28
|
+
defaults?: FeeDefaults<_FeeUnits>;
|
|
29
|
+
}
|
|
30
|
+
export declare type ProtocolFeeMetadata<_FeeUnits extends string> = ProtocolFeeMetadataWithoutUnits<_FeeUnits> | ProtocolFeeMetadataWithUnits<_FeeUnits>;
|
|
31
|
+
export interface ProtocolAccountMetadata {
|
|
32
|
+
standardDerivationPath?: string;
|
|
33
|
+
address?: {
|
|
34
|
+
isCaseSensitive?: boolean;
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
regex?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface ProtocolTransactionMetadata<_Units extends string> {
|
|
40
|
+
arbitraryData?: ProtocolTransactionArbitraryDataMetadata | {
|
|
41
|
+
root?: ProtocolTransactionArbitraryDataMetadata;
|
|
42
|
+
inner?: ProtocolTransactionArbitraryDataMetadata;
|
|
43
|
+
};
|
|
44
|
+
minBalance?: {
|
|
45
|
+
amount: Amount<_Units>;
|
|
46
|
+
name?: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface ProtocolTransactionArbitraryDataMetadata {
|
|
50
|
+
name: string;
|
|
51
|
+
maxLength?: number;
|
|
52
|
+
regex?: string;
|
|
53
|
+
}
|
|
54
|
+
export declare type ProtocolNetworkType = 'mainnet' | 'testnet' | 'custom';
|
|
55
|
+
export interface ProtocolNetwork {
|
|
56
|
+
name: string;
|
|
57
|
+
type: ProtocolNetworkType;
|
|
58
|
+
rpcUrl: string;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/types/protocol.ts"],"names":[],"mappings":""}
|