@airgap/ethereum 0.13.21-beta.7 → 0.13.22-beta.0
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/package.json +7 -7
- package/v1/clients/crypto/EthereumCryptoClient.d.ts +7 -0
- package/v1/clients/crypto/EthereumCryptoClient.js +147 -0
- package/v1/clients/crypto/EthereumCryptoClient.js.map +1 -0
- package/v1/clients/info/EthereumInfoClient.d.ts +9 -7
- package/v1/clients/info/EthereumInfoClient.js.map +1 -1
- package/v1/clients/info/EtherscanInfoClient.d.ts +2 -1
- package/v1/clients/info/EtherscanInfoClient.js +0 -2
- package/v1/clients/info/EtherscanInfoClient.js.map +1 -1
- package/v1/clients/node/EthereumNodeClient.d.ts +18 -0
- package/v1/clients/node/EthereumNodeClient.js +3 -0
- package/v1/clients/node/EthereumNodeClient.js.map +1 -0
- package/v1/clients/node/HttpEthereumNodeClient.d.ts +66 -0
- package/v1/clients/node/HttpEthereumNodeClient.js +443 -0
- package/v1/clients/node/HttpEthereumNodeClient.js.map +1 -0
- package/v1/data/EthereumAddress.d.ts +7 -0
- package/v1/data/EthereumAddress.js +46 -0
- package/v1/data/EthereumAddress.js.map +1 -0
- package/v1/index.d.ts +19 -6
- package/v1/index.js +16 -1
- package/v1/index.js.map +1 -1
- package/v1/module/ERC20Tokens.d.ts +1 -1
- package/v1/module/EthereumModule.d.ts +4 -4
- package/v1/module/EthereumModule.js.map +1 -1
- package/v1/protocol/EthereumBaseProtocol.d.ts +84 -7
- package/v1/protocol/EthereumBaseProtocol.js +779 -8
- package/v1/protocol/EthereumBaseProtocol.js.map +1 -1
- package/v1/protocol/EthereumChainIds.d.ts +1 -0
- package/v1/protocol/EthereumChainIds.js +340 -0
- package/v1/protocol/EthereumChainIds.js.map +1 -0
- package/v1/protocol/EthereumProtocol.d.ts +6 -7
- package/v1/protocol/EthereumProtocol.js +3 -4
- package/v1/protocol/EthereumProtocol.js.map +1 -1
- package/v1/protocol/erc20/ERC20Protocol.d.ts +32 -0
- package/v1/protocol/erc20/ERC20Protocol.js +397 -0
- package/v1/protocol/erc20/ERC20Protocol.js.map +1 -0
- package/v1/protocol/erc20/ERC20Token.d.ts +15 -10
- package/v1/protocol/erc20/ERC20Token.js +26 -35
- package/v1/protocol/erc20/ERC20Token.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +8 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +76 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.d.ts +10 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.d.ts +14 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-ethereum-typed.json +41 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-ethereum.json +58 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-ethereum.json +19 -0
- package/v1/serializer/v3/serializer-companion.js +10 -9
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.d.ts +7 -0
- package/v1/serializer/v3/validators/transaction-validator.js +71 -0
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
- package/v1/types/crypto.d.ts +2 -0
- package/v1/types/crypto.js +3 -0
- package/v1/types/crypto.js.map +1 -0
- package/v1/types/protocol.d.ts +35 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
- package/v1/types/transaction.d.ts +24 -0
- package/v1/types/transaction.js +3 -0
- package/v1/types/transaction.js.map +1 -0
- package/v1/utils/EthereumUtils.d.ts +16 -0
- package/v1/utils/EthereumUtils.js +155 -0
- package/v1/utils/EthereumUtils.js.map +1 -0
- package/v1/utils/key.d.ts +5 -0
- package/v1/utils/key.js +101 -0
- package/v1/utils/key.js.map +1 -0
- package/v1/utils/protocol.d.ts +4 -5
- package/v1/utils/protocol.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumModule.js","sourceRoot":"","sources":["../../../src/v1/module/EthereumModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,iDAO2B;AAI3B,mFAAiF;AACjF,2DAAwG;AACxG,iEAAwG;AACxG,8EAAqF;AAGrF,6CAAmE;AAEnE;IAIE;;QACE,IAAM,eAAe,GAA0B,IAAI,kCAAqB,CAAC;YACvE,iBAAiB,EAAE,CAAC,oDAAiC,CAAC;SACvD,CAAC,CAAA;QACF,IAAM,oBAAoB,GAA0B,IAAI,kCAAqB,CAAC;YAC5E,iBAAiB,EAAE,CAAC,oDAAuC,CAAC;SAC7D,CAAC,CAAA;QAEF,IAAI,CAAC,iBAAiB,yBACnB,kCAAmB,CAAC,GAAG,IAAG,eAAe,OACvC,oCAAsB,CAAC,MAAM,CAC9B,UAAC,GAA0C,EAAE,IAAY;;YAAK,OAAA,MAAM,CAAC,MAAM,CAAC,GAAG,YAAI,GAAC,IAAI,IAAG,oBAAoB,MAAG;QAApD,CAAoD,EAClH,EAAE,CACH,CACF,CAAA;QACD,IAAI,CAAC,kBAAkB,GAAG,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAC5E,CAAC;IAEY,8CAAqB,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AAAD,CAAC,AApED,IAoEC;AApEY,wCAAc"}
|
|
@@ -1,10 +1,87 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { BigNumber } from '@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber';
|
|
2
|
+
import { Address, AirGapProtocol, AirGapTransaction, AirGapTransactionStatus, AirGapTransactionsWithCursor, Amount, Balance, CryptoDerivative, ExtendedKeyPair, ExtendedPublicKey, ExtendedSecretKey, FeeDefaults, KeyPair, ProtocolMetadata, ProtocolUnitsMetadata, PublicKey, SecretKey, Signature, TokenDetails, TransactionFullConfiguration, TransactionDetails, TransactionSimpleConfiguration, WalletConnectRequest } from '@airgap/module-kit';
|
|
3
|
+
import { EthereumCryptoClient } from '../clients/crypto/EthereumCryptoClient';
|
|
4
|
+
import { EthereumInfoClient } from '../clients/info/EthereumInfoClient';
|
|
5
|
+
import { EthereumNodeClient } from '../clients/node/EthereumNodeClient';
|
|
6
|
+
import { EthereumCryptoConfiguration } from '../types/crypto';
|
|
7
|
+
import { EthereumBaseProtocolOptions, EthereumProtocolNetwork, EthereumProtocolOptions, EthereumUnits } from '../types/protocol';
|
|
8
|
+
import { EthereumRawUnsignedTransaction, EthereumSignedTransaction, EthereumTransactionCursor, EthereumTypedUnsignedTransaction, EthereumUnsignedTransaction } from '../types/transaction';
|
|
9
|
+
export interface EthereumBaseProtocol<_Units extends string = EthereumUnits, _ProtocolNetwork extends EthereumProtocolNetwork = EthereumProtocolNetwork> extends AirGapProtocol<{
|
|
10
|
+
AddressResult: Address;
|
|
11
|
+
ProtocolNetwork: _ProtocolNetwork;
|
|
12
|
+
CryptoConfiguration: EthereumCryptoConfiguration;
|
|
13
|
+
Units: _Units;
|
|
14
|
+
FeeUnits: EthereumUnits;
|
|
15
|
+
FeeEstimation: FeeDefaults<EthereumUnits>;
|
|
16
|
+
SignedTransaction: EthereumSignedTransaction;
|
|
17
|
+
UnsignedTransaction: EthereumUnsignedTransaction;
|
|
18
|
+
TransactionCursor: EthereumTransactionCursor;
|
|
19
|
+
}, 'Bip32', 'Crypto', 'FetchDataForAddress', 'FetchDataForMultipleAddresses', 'GetTokenBalances', 'TransactionStatusChecker', 'WalletConnect'> {
|
|
20
|
+
}
|
|
5
21
|
export declare const DEFAULT_ETHEREUM_UNITS_METADATA: ProtocolUnitsMetadata<EthereumUnits>;
|
|
6
|
-
export
|
|
22
|
+
export declare class EthereumBaseProtocolImpl<_Units extends string = EthereumUnits, _ProtocolNetwork extends EthereumProtocolNetwork = EthereumProtocolNetwork> implements EthereumBaseProtocol<_Units, _ProtocolNetwork> {
|
|
23
|
+
protected readonly options: EthereumProtocolOptions<_ProtocolNetwork>;
|
|
24
|
+
protected readonly nodeClient: EthereumNodeClient;
|
|
25
|
+
protected readonly infoClient: EthereumInfoClient;
|
|
26
|
+
protected readonly cryptoClient: EthereumCryptoClient;
|
|
27
|
+
protected readonly bitcoinJS: {
|
|
28
|
+
lib: any;
|
|
29
|
+
config: {
|
|
30
|
+
network: any;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
constructor(nodeClient: EthereumNodeClient, infoClient: EthereumInfoClient, options: EthereumBaseProtocolOptions<_Units, _ProtocolNetwork>);
|
|
34
|
+
readonly units: ProtocolUnitsMetadata<_Units>;
|
|
35
|
+
readonly feeUnits: ProtocolUnitsMetadata<EthereumUnits>;
|
|
36
|
+
protected readonly feeDefaults: FeeDefaults<EthereumUnits>;
|
|
37
|
+
protected readonly metadata: ProtocolMetadata<_Units, EthereumUnits>;
|
|
38
|
+
getMetadata(): Promise<ProtocolMetadata<_Units, EthereumUnits>>;
|
|
39
|
+
getAddressFromPublicKey(publicKey: PublicKey | ExtendedPublicKey): Promise<string>;
|
|
40
|
+
deriveFromExtendedPublicKey(extendedPublicKey: ExtendedPublicKey, visibilityIndex: number, addressIndex: number): Promise<PublicKey>;
|
|
41
|
+
getDetailsFromTransaction(transaction: EthereumSignedTransaction | EthereumUnsignedTransaction, publicKey: PublicKey | ExtendedPublicKey): Promise<AirGapTransaction<_Units, EthereumUnits>[]>;
|
|
42
|
+
private getDetailsFromTransactionWithPublicKey;
|
|
43
|
+
private getDetailsFromTransactionWithExtendedPublicKey;
|
|
44
|
+
protected getDetailsFromSignedTransaction(transaction: EthereumSignedTransaction): Promise<AirGapTransaction<_Units, EthereumUnits>[]>;
|
|
45
|
+
protected getDetailsFromTypedUnsignedTransaction(transaction: EthereumTypedUnsignedTransaction, ownAddress: string): Promise<AirGapTransaction<_Units, EthereumUnits>[]>;
|
|
46
|
+
protected getDetailsFromRawUnsignedTransaction(transaction: EthereumRawUnsignedTransaction, ownAddress: string): Promise<AirGapTransaction<_Units, EthereumUnits>[]>;
|
|
47
|
+
verifyMessageWithPublicKey(message: string, signature: Signature, publicKey: PublicKey | ExtendedPublicKey): Promise<boolean>;
|
|
48
|
+
encryptAsymmetricWithPublicKey(payload: string, publicKey: PublicKey | ExtendedPublicKey): Promise<string>;
|
|
49
|
+
private readonly cryptoConfiguration;
|
|
50
|
+
getCryptoConfiguration(): Promise<EthereumCryptoConfiguration>;
|
|
51
|
+
getKeyPairFromDerivative(derivative: CryptoDerivative): Promise<KeyPair>;
|
|
52
|
+
getExtendedKeyPairFromDerivative(derivative: CryptoDerivative): Promise<ExtendedKeyPair>;
|
|
53
|
+
deriveFromExtendedSecretKey(extendedSecretKey: ExtendedSecretKey, visibilityIndex: number, addressIndex: number): Promise<SecretKey>;
|
|
54
|
+
signTransactionWithSecretKey(transaction: EthereumUnsignedTransaction, secretKey: SecretKey | ExtendedSecretKey): Promise<EthereumSignedTransaction>;
|
|
55
|
+
private signTypedUnsignedTransactionWithSecretKey;
|
|
56
|
+
private signRawUnsignedTransactionWithSecretKey;
|
|
57
|
+
private signTypedTransactionWithSecretKey;
|
|
58
|
+
signMessageWithKeyPair(message: string, keyPair: KeyPair | ExtendedKeyPair): Promise<Signature>;
|
|
59
|
+
decryptAsymmetricWithKeyPair(payload: string, keyPair: KeyPair | ExtendedKeyPair): Promise<string>;
|
|
60
|
+
encryptAESWithSecretKey(payload: string, secretKey: SecretKey | ExtendedSecretKey): Promise<string>;
|
|
61
|
+
decryptAESWithSecretKey(payload: string, secretKey: SecretKey | ExtendedSecretKey): Promise<string>;
|
|
62
|
+
getNetwork(): Promise<_ProtocolNetwork>;
|
|
63
|
+
getTransactionsForPublicKey(publicKey: PublicKey | ExtendedPublicKey, limit: number, cursor?: EthereumTransactionCursor): Promise<AirGapTransactionsWithCursor<EthereumTransactionCursor, _Units, EthereumUnits>>;
|
|
64
|
+
getTransactionsForAddress(address: string, limit: number, cursor?: EthereumTransactionCursor): Promise<AirGapTransactionsWithCursor<EthereumTransactionCursor, _Units, EthereumUnits>>;
|
|
65
|
+
getTransactionsForAddresses(addresses: string[], limit: number, cursor?: EthereumTransactionCursor): Promise<AirGapTransactionsWithCursor<EthereumTransactionCursor, _Units, EthereumUnits>>;
|
|
66
|
+
getTransactionStatus(transactionIds: string[]): Promise<Record<string, AirGapTransactionStatus>>;
|
|
67
|
+
getBalanceOfPublicKey(publicKey: PublicKey | ExtendedPublicKey): Promise<Balance<_Units>>;
|
|
68
|
+
getBalanceOfAddress(address: string): Promise<Balance<_Units>>;
|
|
69
|
+
getBalanceOfAddresses(addresses: string[]): Promise<Balance<_Units>>;
|
|
70
|
+
getTokenBalancesOfPublicKey(publicKey: PublicKey | ExtendedPublicKey, tokens: TokenDetails[]): Promise<Record<string, Amount>>;
|
|
71
|
+
getTransactionMaxAmountWithPublicKey(publicKey: PublicKey | ExtendedPublicKey, to: string[], configuration?: TransactionFullConfiguration<EthereumUnits>): Promise<Amount<_Units>>;
|
|
72
|
+
getTransactionFeeWithPublicKey(publicKey: PublicKey | ExtendedPublicKey, details: TransactionDetails<_Units>[], configuration?: TransactionSimpleConfiguration): Promise<FeeDefaults<EthereumUnits>>;
|
|
73
|
+
prepareTransactionWithPublicKey(publicKey: PublicKey | ExtendedPublicKey, details: TransactionDetails<_Units>[], configuration?: TransactionFullConfiguration<EthereumUnits>): Promise<EthereumUnsignedTransaction>;
|
|
74
|
+
getWalletConnectChain(): Promise<string>;
|
|
75
|
+
prepareWalletConnectTransactionWithPublicKey(publicKey: PublicKey | ExtendedPublicKey, request: WalletConnectRequest): Promise<EthereumUnsignedTransaction>;
|
|
76
|
+
broadcastTransaction(transaction: EthereumSignedTransaction): Promise<string>;
|
|
77
|
+
private nonExtendedPublicKey;
|
|
78
|
+
private nonExtendedSecretKey;
|
|
79
|
+
private getPublicKeyFromExtendedPublicKey;
|
|
80
|
+
private getSecretKeyFromExtendedSecretKey;
|
|
81
|
+
private deriveNode;
|
|
82
|
+
protected estimateGas(fromAddress: string, toAddress: string, amount: string | number | BigNumber | Amount<_Units>, data?: string): Promise<BigNumber>;
|
|
83
|
+
private derivativeToBip32Node;
|
|
7
84
|
}
|
|
8
|
-
export declare class
|
|
9
|
-
|
|
85
|
+
export declare abstract class DefaultEthereumBaseProtocolImpl extends EthereumBaseProtocolImpl {
|
|
86
|
+
protected constructor(nodeClient: EthereumNodeClient, infoClient: EthereumInfoClient, options: EthereumProtocolOptions & Partial<EthereumBaseProtocolOptions>);
|
|
10
87
|
}
|