@avalabs/vm-module-types 0.0.0-refactor-params-20240711152250 → 0.0.0-refactor-testing-20250902112011
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 +9 -0
- package/README.md +1 -1
- package/dist/account.cjs +12 -0
- package/dist/account.d.cts +64 -0
- package/dist/account.d.ts +64 -0
- package/dist/account.js +3 -0
- package/dist/balance.cjs +6 -0
- package/dist/balance.cjs.map +1 -0
- package/dist/balance.d.cts +149 -0
- package/dist/balance.d.ts +149 -0
- package/dist/balance.js +3 -0
- package/dist/balance.js.map +1 -0
- package/dist/chunk-26LJAOMG.js +12 -0
- package/dist/chunk-26LJAOMG.js.map +1 -0
- package/dist/chunk-46RRUHSN.js +42 -0
- package/dist/chunk-46RRUHSN.js.map +1 -0
- package/dist/chunk-47KTBBRA.cjs +4 -0
- package/dist/chunk-47KTBBRA.cjs.map +1 -0
- package/dist/chunk-4GFCXI7G.cjs +19 -0
- package/dist/chunk-4GFCXI7G.cjs.map +1 -0
- package/dist/chunk-5JHLGX7J.cjs +53 -0
- package/dist/chunk-5JHLGX7J.cjs.map +1 -0
- package/dist/chunk-6RQ5ZQEW.cjs +14 -0
- package/dist/chunk-6RQ5ZQEW.cjs.map +1 -0
- package/dist/chunk-7U2R34EQ.js +3 -0
- package/dist/chunk-7U2R34EQ.js.map +1 -0
- package/dist/chunk-7U7BHCMJ.cjs +33 -0
- package/dist/chunk-7U7BHCMJ.cjs.map +1 -0
- package/dist/chunk-AILYKQEY.cjs +4 -0
- package/dist/chunk-AILYKQEY.cjs.map +1 -0
- package/dist/chunk-AJVXHMTN.js +29 -0
- package/dist/chunk-AJVXHMTN.js.map +1 -0
- package/dist/chunk-BHB5UV3J.js +3 -0
- package/dist/chunk-BHB5UV3J.js.map +1 -0
- package/dist/chunk-D3D2XKFF.cjs +48 -0
- package/dist/chunk-D3D2XKFF.cjs.map +1 -0
- package/dist/chunk-FFDMFNPI.js +27 -0
- package/dist/chunk-FFDMFNPI.js.map +1 -0
- package/dist/chunk-GF7C4PA6.js +3 -0
- package/dist/chunk-GF7C4PA6.js.map +1 -0
- package/dist/chunk-JFQR367G.js +44 -0
- package/dist/chunk-JFQR367G.js.map +1 -0
- package/dist/chunk-JG5OGPFO.cjs +15 -0
- package/dist/chunk-JG5OGPFO.cjs.map +1 -0
- package/dist/chunk-JUV577XH.cjs +4 -0
- package/dist/chunk-JUV577XH.cjs.map +1 -0
- package/dist/chunk-KZNBNGA4.js +14 -0
- package/dist/chunk-KZNBNGA4.js.map +1 -0
- package/dist/chunk-N6B7PSUI.js +16 -0
- package/dist/chunk-N6B7PSUI.js.map +1 -0
- package/dist/chunk-OTPBUHSA.cjs +16 -0
- package/dist/chunk-OTPBUHSA.cjs.map +1 -0
- package/dist/chunk-P6AM7I3B.js +3 -0
- package/dist/chunk-P6AM7I3B.js.map +1 -0
- package/dist/chunk-QRH3HH3I.js +49 -0
- package/dist/chunk-QRH3HH3I.js.map +1 -0
- package/dist/chunk-REHORWPH.js +3 -0
- package/dist/chunk-REHORWPH.js.map +1 -0
- package/dist/chunk-RVRG2Q3B.cjs +44 -0
- package/dist/chunk-RVRG2Q3B.cjs.map +1 -0
- package/dist/chunk-SMD2ON6Q.js +13 -0
- package/dist/chunk-SMD2ON6Q.js.map +1 -0
- package/dist/chunk-SYVNOFCV.cjs +4 -0
- package/dist/chunk-SYVNOFCV.cjs.map +1 -0
- package/dist/chunk-UTF5G77X.cjs +29 -0
- package/dist/chunk-UTF5G77X.cjs.map +1 -0
- package/dist/chunk-YB5EN6FL.cjs +4 -0
- package/dist/chunk-YB5EN6FL.cjs.map +1 -0
- package/dist/coingecko.cjs +16 -0
- package/dist/coingecko.cjs.map +1 -0
- package/dist/coingecko.d.cts +23 -0
- package/dist/coingecko.d.ts +23 -0
- package/dist/coingecko.js +3 -0
- package/dist/coingecko.js.map +1 -0
- package/dist/common.cjs +20 -0
- package/dist/common.cjs.map +1 -0
- package/dist/common.d.cts +53 -0
- package/dist/common.d.ts +53 -0
- package/dist/common.js +3 -0
- package/dist/common.js.map +1 -0
- package/dist/error.cjs +6 -0
- package/dist/error.cjs.map +1 -0
- package/dist/error.d.cts +5 -0
- package/dist/error.d.ts +5 -0
- package/dist/error.js +3 -0
- package/dist/error.js.map +1 -0
- package/dist/index.cjs +69 -12
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +14 -1
- package/dist/manifest.cjs +12 -0
- package/dist/manifest.cjs.map +1 -0
- package/dist/{types.d.cts → manifest.d.cts} +10 -175
- package/dist/{types.d.ts → manifest.d.ts} +10 -175
- package/dist/manifest.js +3 -0
- package/dist/manifest.js.map +1 -0
- package/dist/module.cjs +7 -0
- package/dist/module.cjs.map +1 -0
- package/dist/module.d.cts +45 -0
- package/dist/module.d.ts +45 -0
- package/dist/module.js +4 -0
- package/dist/module.js.map +1 -0
- package/dist/network-fee.cjs +6 -0
- package/dist/network-fee.cjs.map +1 -0
- package/dist/network-fee.d.cts +31 -0
- package/dist/network-fee.d.ts +31 -0
- package/dist/network-fee.js +3 -0
- package/dist/network-fee.js.map +1 -0
- package/dist/provider.cjs +12 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +62 -0
- package/dist/provider.d.ts +62 -0
- package/dist/provider.js +3 -0
- package/dist/provider.js.map +1 -0
- package/dist/rpc-22e53ced.d.ts +379 -0
- package/dist/rpc-a75fe4b4.d.ts +379 -0
- package/dist/rpc.cjs +20 -0
- package/dist/rpc.cjs.map +1 -0
- package/dist/rpc.d.cts +10 -0
- package/dist/rpc.d.ts +10 -0
- package/dist/rpc.js +3 -0
- package/dist/rpc.js.map +1 -0
- package/dist/staking.cjs +12 -0
- package/dist/staking.cjs.map +1 -0
- package/dist/staking.d.cts +157 -0
- package/dist/staking.d.ts +157 -0
- package/dist/staking.js +3 -0
- package/dist/staking.js.map +1 -0
- package/dist/token.cjs +12 -0
- package/dist/token.cjs.map +1 -0
- package/dist/token.d.cts +61 -0
- package/dist/token.d.ts +61 -0
- package/dist/token.js +3 -0
- package/dist/token.js.map +1 -0
- package/dist/transaction-history.cjs +20 -0
- package/dist/transaction-history.cjs.map +1 -0
- package/dist/transaction-history.d.cts +106 -0
- package/dist/transaction-history.d.ts +106 -0
- package/dist/transaction-history.js +3 -0
- package/dist/transaction-history.js.map +1 -0
- package/dist/transaction-simulation.cjs +6 -0
- package/dist/transaction-simulation.cjs.map +1 -0
- package/dist/transaction-simulation.d.cts +10 -0
- package/dist/transaction-simulation.d.ts +10 -0
- package/dist/transaction-simulation.js +3 -0
- package/dist/transaction-simulation.js.map +1 -0
- package/package.json +19 -4
- package/.turbo/turbo-build.log +0 -32
- package/.turbo/turbo-lint.log +0 -4
- package/CHANGELOG.md +0 -52
- package/dist/chunk-BIY73MWZ.cjs +0 -13
- package/dist/chunk-BIY73MWZ.cjs.map +0 -1
- package/dist/chunk-MMBK5YXH.js +0 -7
- package/dist/chunk-MMBK5YXH.js.map +0 -1
- package/dist/types.cjs +0 -28
- package/dist/types.js +0 -3
- package/src/index.ts +0 -1
- package/src/types.ts +0 -228
- package/tsconfig.json +0 -8
- package/tsup.config.ts +0 -4
- /package/dist/{types.cjs.map → account.cjs.map} +0 -0
- /package/dist/{types.js.map → account.js.map} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Copyright (C) 2021, Ava Labs, Inc. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Subject to the limited license below (**”License””), you may not, and you may not permit anyone else to, copy, reproduce, aggregate, republish, download, post, distribute, license, sublicense, reverse engineer, modify, or create derivative works based on this software (collectively, **“Software”**).
|
|
4
|
+
|
|
5
|
+
You are hereby granted a limited, non-exclusive, non-sublicensable and non-transferable license to download and use the Software as-is solely (i) for use in connection with the Avalanche Public Blockchain platform, having a NetworkID of 1 (Mainnet) or 5 (Fuji), and associated blockchains, comprised exclusively of the Avalanche X-Chain, C-Chain, P-Chain and any subnets linked to the P-Chain (**“Avalanche Authorized Platform”**) or (ii) for non-production, testing or research purposes without any commercial application within the Avalanche ecosystem (**“Non-Commercial Use”**); provided that, in each case, you may not use or allow use of the Software (a) in connection with any forks of the Avalanche Authorized Platform, (b) in any manner not operationally connected to the Avalanche Authorized Platform other than for Non-Commercial Use, or (c) to the extent the number of monthly active users or the number of total installs of any software that uses the Software across all versions thereof exceeds 10,000 at any time. You may not modify or alter the Software in any way.
|
|
6
|
+
|
|
7
|
+
You hereby acknowledge and agree to the terms set forth at www.avalabs.org/important-notice.
|
|
8
|
+
|
|
9
|
+
**TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED ON AN “AS IS” BASIS, AND AVA LABS EXPRESSLY DISCLAIMS AND EXCLUDES ALL REPRESENTATIONS, WARRANTIES AND OTHER TERMS AND CONDITIONS, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION BY OPERATION OF LAW OR BY CUSTOM, STATUTE OR OTHERWISE, AND INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTY, TERM, OR CONDITION OF NON-INFRINGEMENT, MERCHANTABILITY, TITLE, OR FITNESS FOR PARTICULAR PURPOSE. YOU USE THE SOFTWARE AT YOUR OWN RISK. AVA LABS EXPRESSLY DISCLAIMS ALL LIABILITY (INCLUDING FOR ALL DIRECT, CONSEQUENTIAL OR OTHER DAMAGES OR LOSSES) RELATED TO ANY USE OF THE SOFTWARE.**
|
package/README.md
CHANGED
package/dist/account.cjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkJG5OGPFO_cjs = require('./chunk-JG5OGPFO.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, 'WalletType', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkJG5OGPFO_cjs.WalletType; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=account.cjs.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Network, NetworkVMType } from './common.cjs';
|
|
2
|
+
import './token.cjs';
|
|
3
|
+
|
|
4
|
+
declare enum WalletType {
|
|
5
|
+
Mnemonic = "mnemonic",
|
|
6
|
+
Ledger = "ledger",
|
|
7
|
+
LedgerLive = "ledger-live",
|
|
8
|
+
Keystone = "keystone",
|
|
9
|
+
Seedless = "seedless"
|
|
10
|
+
}
|
|
11
|
+
type GetAddressParams = {
|
|
12
|
+
walletType: WalletType;
|
|
13
|
+
accountIndex: number;
|
|
14
|
+
xpub: string;
|
|
15
|
+
network?: Network;
|
|
16
|
+
xpubXP?: string;
|
|
17
|
+
};
|
|
18
|
+
type GetAddressResponse = Record<string, string>;
|
|
19
|
+
type SimpleDeriveAddressParams = {
|
|
20
|
+
network: Omit<Network, 'tokens'>;
|
|
21
|
+
/**
|
|
22
|
+
* ID of the secret key to use for derivation.
|
|
23
|
+
*/
|
|
24
|
+
secretId: string;
|
|
25
|
+
};
|
|
26
|
+
type DetailedDeriveAddressParams = SimpleDeriveAddressParams & {
|
|
27
|
+
/**
|
|
28
|
+
* Account index for which the public key is requested.
|
|
29
|
+
* Leave empty if requesting a public key for a single-account private key.
|
|
30
|
+
*/
|
|
31
|
+
accountIndex: number;
|
|
32
|
+
/**
|
|
33
|
+
* Type of the derivation path to use.
|
|
34
|
+
* Useful when working with Ledger devices, which support BIP44 and Ledger Live derivation paths.
|
|
35
|
+
*/
|
|
36
|
+
derivationPathType: DerivationPathType;
|
|
37
|
+
};
|
|
38
|
+
type DeriveAddressParams = SimpleDeriveAddressParams | DetailedDeriveAddressParams;
|
|
39
|
+
type DeriveAddressResponse = Partial<Record<NetworkVMType, string>>;
|
|
40
|
+
type DerivationPathType = 'bip44' | 'ledger_live';
|
|
41
|
+
type BuildDerivationPathParams = {
|
|
42
|
+
accountIndex: number;
|
|
43
|
+
derivationPathType: DerivationPathType;
|
|
44
|
+
};
|
|
45
|
+
type BuildDerivationPathResponse = Partial<Record<NetworkVMType, string>>;
|
|
46
|
+
type PubKeyType = {
|
|
47
|
+
evm: string;
|
|
48
|
+
/**
|
|
49
|
+
* Public keys used for X/P chain are from a different derivation path.
|
|
50
|
+
*/
|
|
51
|
+
xp?: string;
|
|
52
|
+
btcWalletPolicyDetails?: BtcWalletPolicyDetails;
|
|
53
|
+
};
|
|
54
|
+
type BtcWalletPolicyDetails = {
|
|
55
|
+
hmacHex: string;
|
|
56
|
+
/**
|
|
57
|
+
* Extended public key of m/44'/60'/n
|
|
58
|
+
*/
|
|
59
|
+
xpub: string;
|
|
60
|
+
masterFingerprint: string;
|
|
61
|
+
name: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { BtcWalletPolicyDetails, BuildDerivationPathParams, BuildDerivationPathResponse, DerivationPathType, DeriveAddressParams, DeriveAddressResponse, DetailedDeriveAddressParams, GetAddressParams, GetAddressResponse, PubKeyType, SimpleDeriveAddressParams, WalletType };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Network, NetworkVMType } from './common.js';
|
|
2
|
+
import './token.js';
|
|
3
|
+
|
|
4
|
+
declare enum WalletType {
|
|
5
|
+
Mnemonic = "mnemonic",
|
|
6
|
+
Ledger = "ledger",
|
|
7
|
+
LedgerLive = "ledger-live",
|
|
8
|
+
Keystone = "keystone",
|
|
9
|
+
Seedless = "seedless"
|
|
10
|
+
}
|
|
11
|
+
type GetAddressParams = {
|
|
12
|
+
walletType: WalletType;
|
|
13
|
+
accountIndex: number;
|
|
14
|
+
xpub: string;
|
|
15
|
+
network?: Network;
|
|
16
|
+
xpubXP?: string;
|
|
17
|
+
};
|
|
18
|
+
type GetAddressResponse = Record<string, string>;
|
|
19
|
+
type SimpleDeriveAddressParams = {
|
|
20
|
+
network: Omit<Network, 'tokens'>;
|
|
21
|
+
/**
|
|
22
|
+
* ID of the secret key to use for derivation.
|
|
23
|
+
*/
|
|
24
|
+
secretId: string;
|
|
25
|
+
};
|
|
26
|
+
type DetailedDeriveAddressParams = SimpleDeriveAddressParams & {
|
|
27
|
+
/**
|
|
28
|
+
* Account index for which the public key is requested.
|
|
29
|
+
* Leave empty if requesting a public key for a single-account private key.
|
|
30
|
+
*/
|
|
31
|
+
accountIndex: number;
|
|
32
|
+
/**
|
|
33
|
+
* Type of the derivation path to use.
|
|
34
|
+
* Useful when working with Ledger devices, which support BIP44 and Ledger Live derivation paths.
|
|
35
|
+
*/
|
|
36
|
+
derivationPathType: DerivationPathType;
|
|
37
|
+
};
|
|
38
|
+
type DeriveAddressParams = SimpleDeriveAddressParams | DetailedDeriveAddressParams;
|
|
39
|
+
type DeriveAddressResponse = Partial<Record<NetworkVMType, string>>;
|
|
40
|
+
type DerivationPathType = 'bip44' | 'ledger_live';
|
|
41
|
+
type BuildDerivationPathParams = {
|
|
42
|
+
accountIndex: number;
|
|
43
|
+
derivationPathType: DerivationPathType;
|
|
44
|
+
};
|
|
45
|
+
type BuildDerivationPathResponse = Partial<Record<NetworkVMType, string>>;
|
|
46
|
+
type PubKeyType = {
|
|
47
|
+
evm: string;
|
|
48
|
+
/**
|
|
49
|
+
* Public keys used for X/P chain are from a different derivation path.
|
|
50
|
+
*/
|
|
51
|
+
xp?: string;
|
|
52
|
+
btcWalletPolicyDetails?: BtcWalletPolicyDetails;
|
|
53
|
+
};
|
|
54
|
+
type BtcWalletPolicyDetails = {
|
|
55
|
+
hmacHex: string;
|
|
56
|
+
/**
|
|
57
|
+
* Extended public key of m/44'/60'/n
|
|
58
|
+
*/
|
|
59
|
+
xpub: string;
|
|
60
|
+
masterFingerprint: string;
|
|
61
|
+
name: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { BtcWalletPolicyDetails, BuildDerivationPathParams, BuildDerivationPathResponse, DerivationPathType, DeriveAddressParams, DeriveAddressResponse, DetailedDeriveAddressParams, GetAddressParams, GetAddressResponse, PubKeyType, SimpleDeriveAddressParams, WalletType };
|
package/dist/account.js
ADDED
package/dist/balance.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Network, Storage } from './common.cjs';
|
|
2
|
+
import { Error } from './error.cjs';
|
|
3
|
+
import { TokenType, NetworkContractToken, NetworkToken } from './token.cjs';
|
|
4
|
+
import { Erc20TokenBalance, PChainBalance, XChainBalances } from '@avalabs/glacier-sdk';
|
|
5
|
+
|
|
6
|
+
type GetBalancesParams = {
|
|
7
|
+
addresses: string[];
|
|
8
|
+
network: Network;
|
|
9
|
+
tokenTypes?: TokenType[];
|
|
10
|
+
customTokens?: NetworkContractToken[];
|
|
11
|
+
currency: string;
|
|
12
|
+
storage?: Storage;
|
|
13
|
+
};
|
|
14
|
+
type TokenBalanceData = {
|
|
15
|
+
type: TokenType;
|
|
16
|
+
name: string;
|
|
17
|
+
symbol: string;
|
|
18
|
+
balance: bigint;
|
|
19
|
+
balanceDisplayValue: string;
|
|
20
|
+
balanceInCurrency?: number;
|
|
21
|
+
balanceCurrencyDisplayValue?: string;
|
|
22
|
+
};
|
|
23
|
+
type TokenMarketData = {
|
|
24
|
+
priceInCurrency?: number;
|
|
25
|
+
priceChanges?: {
|
|
26
|
+
percentage?: number;
|
|
27
|
+
value?: number;
|
|
28
|
+
};
|
|
29
|
+
marketCap?: number;
|
|
30
|
+
change24?: number;
|
|
31
|
+
vol24?: number;
|
|
32
|
+
};
|
|
33
|
+
type NetworkTokenWithBalance = TokenBalanceDataWithDecimals & NetworkToken & TokenMarketData & {
|
|
34
|
+
coingeckoId: string;
|
|
35
|
+
type: TokenType.NATIVE;
|
|
36
|
+
};
|
|
37
|
+
interface TokenBalanceDataWithDecimals extends TokenBalanceData {
|
|
38
|
+
decimals: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* EVM TokenWithBalance interface.
|
|
42
|
+
*/
|
|
43
|
+
type TokenWithBalanceERC20 = TokenBalanceDataWithDecimals & TokenMarketData & NetworkContractToken & {
|
|
44
|
+
type: TokenType.ERC20;
|
|
45
|
+
reputation: Erc20TokenBalance.tokenReputation | null;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* SPL TokenWithBalance interface.
|
|
49
|
+
*/
|
|
50
|
+
type TokenWithBalanceSPL = TokenBalanceDataWithDecimals & TokenMarketData & {
|
|
51
|
+
address: string;
|
|
52
|
+
type: TokenType.SPL;
|
|
53
|
+
logoUri?: string;
|
|
54
|
+
reputation: null;
|
|
55
|
+
};
|
|
56
|
+
type TokenWithBalanceEVM = NetworkTokenWithBalance | TokenWithBalanceERC20 | NftTokenWithBalance;
|
|
57
|
+
/**
|
|
58
|
+
* Bitcoin TokenWithBalance interface.
|
|
59
|
+
*/
|
|
60
|
+
interface BitcoinInputUTXO {
|
|
61
|
+
txHash: string;
|
|
62
|
+
txHex?: string;
|
|
63
|
+
index: number;
|
|
64
|
+
value: number;
|
|
65
|
+
script: string;
|
|
66
|
+
blockHeight: number;
|
|
67
|
+
confirmations: number;
|
|
68
|
+
confirmedTime?: string;
|
|
69
|
+
}
|
|
70
|
+
interface BitcoinInputUTXOWithOptionalScript extends Omit<BitcoinInputUTXO, 'script'> {
|
|
71
|
+
script?: string;
|
|
72
|
+
}
|
|
73
|
+
interface TokenWithBalanceBTC extends NetworkTokenWithBalance {
|
|
74
|
+
logoUri: string;
|
|
75
|
+
utxos: BitcoinInputUTXOWithOptionalScript[];
|
|
76
|
+
utxosUnconfirmed?: BitcoinInputUTXOWithOptionalScript[];
|
|
77
|
+
unconfirmedBalance?: bigint;
|
|
78
|
+
unconfirmedBalanceDisplayValue?: string;
|
|
79
|
+
unconfirmedBalanceCurrencyDisplayValue?: string;
|
|
80
|
+
unconfirmedBalanceInCurrency?: number;
|
|
81
|
+
}
|
|
82
|
+
interface TokenWithBalanceSVM extends NetworkTokenWithBalance {
|
|
83
|
+
logoUri: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Avalanche TokenWithBalance interface.
|
|
87
|
+
*/
|
|
88
|
+
interface TokenWithBalancePVM extends NetworkTokenWithBalance {
|
|
89
|
+
available?: bigint;
|
|
90
|
+
availableInCurrency?: number;
|
|
91
|
+
availableDisplayValue?: string;
|
|
92
|
+
availableCurrencyDisplayValue?: string;
|
|
93
|
+
utxos?: PChainBalance;
|
|
94
|
+
/**
|
|
95
|
+
* All values are represented in `nAvax`
|
|
96
|
+
*/
|
|
97
|
+
balancePerType: {
|
|
98
|
+
lockedStaked?: bigint;
|
|
99
|
+
lockedStakeable?: bigint;
|
|
100
|
+
lockedPlatform?: bigint;
|
|
101
|
+
atomicMemoryLocked?: bigint;
|
|
102
|
+
atomicMemoryUnlocked?: bigint;
|
|
103
|
+
unlockedUnstaked?: bigint;
|
|
104
|
+
unlockedStaked?: bigint;
|
|
105
|
+
pendingStaked?: bigint;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
interface TokenWithBalanceAVM extends NetworkTokenWithBalance {
|
|
109
|
+
available?: bigint;
|
|
110
|
+
availableInCurrency?: number;
|
|
111
|
+
availableDisplayValue?: string;
|
|
112
|
+
availableCurrencyDisplayValue?: string;
|
|
113
|
+
utxos?: XChainBalances;
|
|
114
|
+
/**
|
|
115
|
+
* All values are represented in `nAvax`
|
|
116
|
+
*/
|
|
117
|
+
balancePerType: {
|
|
118
|
+
locked?: bigint;
|
|
119
|
+
unlocked?: bigint;
|
|
120
|
+
atomicMemoryUnlocked?: bigint;
|
|
121
|
+
atomicMemoryLocked?: bigint;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
interface NftTokenWithBalance extends Omit<NetworkTokenWithBalance, 'type' | 'decimals' | 'coingeckoId'> {
|
|
125
|
+
type: TokenType.ERC721 | TokenType.ERC1155;
|
|
126
|
+
address: string;
|
|
127
|
+
description: string;
|
|
128
|
+
logoUri: string;
|
|
129
|
+
logoSmall: string;
|
|
130
|
+
name: string;
|
|
131
|
+
symbol: string;
|
|
132
|
+
tokenId: string;
|
|
133
|
+
tokenUri: string;
|
|
134
|
+
collectionName: string;
|
|
135
|
+
updatedAt?: number;
|
|
136
|
+
metadata?: {
|
|
137
|
+
description?: string;
|
|
138
|
+
lastUpdatedTimestamp?: number;
|
|
139
|
+
properties?: string;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
interface TokenAttribute {
|
|
143
|
+
name: string;
|
|
144
|
+
value: string;
|
|
145
|
+
}
|
|
146
|
+
type TokenWithBalance = TokenWithBalanceEVM | TokenWithBalanceBTC | TokenWithBalancePVM | TokenWithBalanceAVM | TokenWithBalanceSVM | TokenWithBalanceSPL;
|
|
147
|
+
type GetBalancesResponse = Record<string, Record<string, TokenWithBalance | Error> | Error>;
|
|
148
|
+
|
|
149
|
+
export { GetBalancesParams, GetBalancesResponse, NetworkTokenWithBalance, NftTokenWithBalance, TokenAttribute, TokenBalanceData, TokenMarketData, TokenWithBalance, TokenWithBalanceAVM, TokenWithBalanceBTC, TokenWithBalanceERC20, TokenWithBalanceEVM, TokenWithBalancePVM, TokenWithBalanceSPL, TokenWithBalanceSVM };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Network, Storage } from './common.js';
|
|
2
|
+
import { Error } from './error.js';
|
|
3
|
+
import { TokenType, NetworkContractToken, NetworkToken } from './token.js';
|
|
4
|
+
import { Erc20TokenBalance, PChainBalance, XChainBalances } from '@avalabs/glacier-sdk';
|
|
5
|
+
|
|
6
|
+
type GetBalancesParams = {
|
|
7
|
+
addresses: string[];
|
|
8
|
+
network: Network;
|
|
9
|
+
tokenTypes?: TokenType[];
|
|
10
|
+
customTokens?: NetworkContractToken[];
|
|
11
|
+
currency: string;
|
|
12
|
+
storage?: Storage;
|
|
13
|
+
};
|
|
14
|
+
type TokenBalanceData = {
|
|
15
|
+
type: TokenType;
|
|
16
|
+
name: string;
|
|
17
|
+
symbol: string;
|
|
18
|
+
balance: bigint;
|
|
19
|
+
balanceDisplayValue: string;
|
|
20
|
+
balanceInCurrency?: number;
|
|
21
|
+
balanceCurrencyDisplayValue?: string;
|
|
22
|
+
};
|
|
23
|
+
type TokenMarketData = {
|
|
24
|
+
priceInCurrency?: number;
|
|
25
|
+
priceChanges?: {
|
|
26
|
+
percentage?: number;
|
|
27
|
+
value?: number;
|
|
28
|
+
};
|
|
29
|
+
marketCap?: number;
|
|
30
|
+
change24?: number;
|
|
31
|
+
vol24?: number;
|
|
32
|
+
};
|
|
33
|
+
type NetworkTokenWithBalance = TokenBalanceDataWithDecimals & NetworkToken & TokenMarketData & {
|
|
34
|
+
coingeckoId: string;
|
|
35
|
+
type: TokenType.NATIVE;
|
|
36
|
+
};
|
|
37
|
+
interface TokenBalanceDataWithDecimals extends TokenBalanceData {
|
|
38
|
+
decimals: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* EVM TokenWithBalance interface.
|
|
42
|
+
*/
|
|
43
|
+
type TokenWithBalanceERC20 = TokenBalanceDataWithDecimals & TokenMarketData & NetworkContractToken & {
|
|
44
|
+
type: TokenType.ERC20;
|
|
45
|
+
reputation: Erc20TokenBalance.tokenReputation | null;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* SPL TokenWithBalance interface.
|
|
49
|
+
*/
|
|
50
|
+
type TokenWithBalanceSPL = TokenBalanceDataWithDecimals & TokenMarketData & {
|
|
51
|
+
address: string;
|
|
52
|
+
type: TokenType.SPL;
|
|
53
|
+
logoUri?: string;
|
|
54
|
+
reputation: null;
|
|
55
|
+
};
|
|
56
|
+
type TokenWithBalanceEVM = NetworkTokenWithBalance | TokenWithBalanceERC20 | NftTokenWithBalance;
|
|
57
|
+
/**
|
|
58
|
+
* Bitcoin TokenWithBalance interface.
|
|
59
|
+
*/
|
|
60
|
+
interface BitcoinInputUTXO {
|
|
61
|
+
txHash: string;
|
|
62
|
+
txHex?: string;
|
|
63
|
+
index: number;
|
|
64
|
+
value: number;
|
|
65
|
+
script: string;
|
|
66
|
+
blockHeight: number;
|
|
67
|
+
confirmations: number;
|
|
68
|
+
confirmedTime?: string;
|
|
69
|
+
}
|
|
70
|
+
interface BitcoinInputUTXOWithOptionalScript extends Omit<BitcoinInputUTXO, 'script'> {
|
|
71
|
+
script?: string;
|
|
72
|
+
}
|
|
73
|
+
interface TokenWithBalanceBTC extends NetworkTokenWithBalance {
|
|
74
|
+
logoUri: string;
|
|
75
|
+
utxos: BitcoinInputUTXOWithOptionalScript[];
|
|
76
|
+
utxosUnconfirmed?: BitcoinInputUTXOWithOptionalScript[];
|
|
77
|
+
unconfirmedBalance?: bigint;
|
|
78
|
+
unconfirmedBalanceDisplayValue?: string;
|
|
79
|
+
unconfirmedBalanceCurrencyDisplayValue?: string;
|
|
80
|
+
unconfirmedBalanceInCurrency?: number;
|
|
81
|
+
}
|
|
82
|
+
interface TokenWithBalanceSVM extends NetworkTokenWithBalance {
|
|
83
|
+
logoUri: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Avalanche TokenWithBalance interface.
|
|
87
|
+
*/
|
|
88
|
+
interface TokenWithBalancePVM extends NetworkTokenWithBalance {
|
|
89
|
+
available?: bigint;
|
|
90
|
+
availableInCurrency?: number;
|
|
91
|
+
availableDisplayValue?: string;
|
|
92
|
+
availableCurrencyDisplayValue?: string;
|
|
93
|
+
utxos?: PChainBalance;
|
|
94
|
+
/**
|
|
95
|
+
* All values are represented in `nAvax`
|
|
96
|
+
*/
|
|
97
|
+
balancePerType: {
|
|
98
|
+
lockedStaked?: bigint;
|
|
99
|
+
lockedStakeable?: bigint;
|
|
100
|
+
lockedPlatform?: bigint;
|
|
101
|
+
atomicMemoryLocked?: bigint;
|
|
102
|
+
atomicMemoryUnlocked?: bigint;
|
|
103
|
+
unlockedUnstaked?: bigint;
|
|
104
|
+
unlockedStaked?: bigint;
|
|
105
|
+
pendingStaked?: bigint;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
interface TokenWithBalanceAVM extends NetworkTokenWithBalance {
|
|
109
|
+
available?: bigint;
|
|
110
|
+
availableInCurrency?: number;
|
|
111
|
+
availableDisplayValue?: string;
|
|
112
|
+
availableCurrencyDisplayValue?: string;
|
|
113
|
+
utxos?: XChainBalances;
|
|
114
|
+
/**
|
|
115
|
+
* All values are represented in `nAvax`
|
|
116
|
+
*/
|
|
117
|
+
balancePerType: {
|
|
118
|
+
locked?: bigint;
|
|
119
|
+
unlocked?: bigint;
|
|
120
|
+
atomicMemoryUnlocked?: bigint;
|
|
121
|
+
atomicMemoryLocked?: bigint;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
interface NftTokenWithBalance extends Omit<NetworkTokenWithBalance, 'type' | 'decimals' | 'coingeckoId'> {
|
|
125
|
+
type: TokenType.ERC721 | TokenType.ERC1155;
|
|
126
|
+
address: string;
|
|
127
|
+
description: string;
|
|
128
|
+
logoUri: string;
|
|
129
|
+
logoSmall: string;
|
|
130
|
+
name: string;
|
|
131
|
+
symbol: string;
|
|
132
|
+
tokenId: string;
|
|
133
|
+
tokenUri: string;
|
|
134
|
+
collectionName: string;
|
|
135
|
+
updatedAt?: number;
|
|
136
|
+
metadata?: {
|
|
137
|
+
description?: string;
|
|
138
|
+
lastUpdatedTimestamp?: number;
|
|
139
|
+
properties?: string;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
interface TokenAttribute {
|
|
143
|
+
name: string;
|
|
144
|
+
value: string;
|
|
145
|
+
}
|
|
146
|
+
type TokenWithBalance = TokenWithBalanceEVM | TokenWithBalanceBTC | TokenWithBalancePVM | TokenWithBalanceAVM | TokenWithBalanceSVM | TokenWithBalanceSPL;
|
|
147
|
+
type GetBalancesResponse = Record<string, Record<string, TokenWithBalance | Error> | Error>;
|
|
148
|
+
|
|
149
|
+
export { GetBalancesParams, GetBalancesResponse, NetworkTokenWithBalance, NftTokenWithBalance, TokenAttribute, TokenBalanceData, TokenMarketData, TokenWithBalance, TokenWithBalanceAVM, TokenWithBalanceBTC, TokenWithBalanceERC20, TokenWithBalanceEVM, TokenWithBalancePVM, TokenWithBalanceSPL, TokenWithBalanceSVM };
|
package/dist/balance.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/provider.ts
|
|
2
|
+
var EventNames = /* @__PURE__ */ ((EventNames2) => {
|
|
3
|
+
EventNames2["CORE_WALLET_ANNOUNCE_PROVIDER"] = "core-wallet:announceProvider";
|
|
4
|
+
EventNames2["CORE_WALLET_REQUEST_PROVIDER"] = "core-wallet:requestProvider";
|
|
5
|
+
EventNames2["EIP6963_ANNOUNCE_PROVIDER"] = "eip6963:announceProvider";
|
|
6
|
+
EventNames2["EIP6963_REQUEST_PROVIDER"] = "eip6963:requestProvider";
|
|
7
|
+
return EventNames2;
|
|
8
|
+
})(EventNames || {});
|
|
9
|
+
|
|
10
|
+
export { EventNames };
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=chunk-26LJAOMG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/provider.ts"],"names":["EventNames"],"mappings":";AA4BO,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,mCAAgC;AAChC,EAAAA,YAAA,kCAA+B;AAC/B,EAAAA,YAAA,+BAA4B;AAC5B,EAAAA,YAAA,8BAA2B;AAJjB,SAAAA;AAAA,GAAA","sourcesContent":["import type { Eip1193Provider } from 'ethers';\nimport type EventEmitter from 'events';\n\nexport interface ChainChangedEventData {\n chainId: string;\n networkVersion: string;\n}\n\nexport type AccountsChangedEventData = string[];\n\nexport interface UnlockStateChangedEventData {\n accounts: string[];\n isUnlocked: boolean;\n}\n\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n icon: string;\n rdns: string;\n description: string;\n}\n\nexport interface EIP6963ProviderDetail {\n info: EIP6963ProviderInfo;\n provider: Eip1193Provider;\n}\n\nexport enum EventNames {\n CORE_WALLET_ANNOUNCE_PROVIDER = 'core-wallet:announceProvider',\n CORE_WALLET_REQUEST_PROVIDER = 'core-wallet:requestProvider',\n EIP6963_ANNOUNCE_PROVIDER = 'eip6963:announceProvider',\n EIP6963_REQUEST_PROVIDER = 'eip6963:requestProvider',\n}\n\nexport interface DomainMetadata {\n domain: string;\n name?: string;\n icon?: string;\n tabId?: number;\n}\n\ninterface JsonRpcRequestPayloadBase<Method extends string> {\n readonly id: string;\n readonly method: Method;\n readonly site?: DomainMetadata;\n readonly tabId?: number;\n}\n\ninterface JsonRpcRequestPayloadWithParams<Method extends string, Params = unknown>\n extends JsonRpcRequestPayloadBase<Method> {\n readonly params: Params;\n}\n\ninterface JsonRpcRequestPayloadWithoutParams<Method extends string> extends JsonRpcRequestPayloadBase<Method> {\n readonly params?: never;\n}\n\nexport type JsonRpcRequestPayload<Method extends string, Params = unknown> = Params extends undefined\n ? JsonRpcRequestPayloadWithoutParams<Method>\n : JsonRpcRequestPayloadWithParams<Method, Params>;\n\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\nexport interface ChainAgnosticProvider extends EventEmitter {\n request<T = unknown>({\n data,\n sessionId,\n scope,\n }: {\n data: PartialBy<JsonRpcRequestPayload<string>, 'id' | 'params'>;\n sessionId?: string;\n scope?: string | null;\n }): Promise<T>;\n\n subscribeToMessage(callback: ({ method, params }: { method: string; params: unknown }) => void): void;\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { object, string, boolean } from 'zod';
|
|
2
|
+
|
|
3
|
+
// src/manifest.ts
|
|
4
|
+
var sourceSchema = object({
|
|
5
|
+
checksum: string(),
|
|
6
|
+
location: object({
|
|
7
|
+
npm: object({
|
|
8
|
+
filePath: string(),
|
|
9
|
+
packageName: string(),
|
|
10
|
+
registry: string()
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
var manifestSchema = object({
|
|
15
|
+
name: string(),
|
|
16
|
+
version: string(),
|
|
17
|
+
description: string(),
|
|
18
|
+
sources: object({
|
|
19
|
+
module: sourceSchema,
|
|
20
|
+
provider: sourceSchema.optional()
|
|
21
|
+
}),
|
|
22
|
+
network: object({
|
|
23
|
+
chainIds: string().array(),
|
|
24
|
+
namespaces: string().array()
|
|
25
|
+
}),
|
|
26
|
+
cointype: string(),
|
|
27
|
+
permissions: object({
|
|
28
|
+
rpc: object({
|
|
29
|
+
dapps: boolean(),
|
|
30
|
+
methods: string().array(),
|
|
31
|
+
nonRestrictedMethods: string().array()
|
|
32
|
+
})
|
|
33
|
+
}),
|
|
34
|
+
manifestVersion: string()
|
|
35
|
+
});
|
|
36
|
+
var parseManifest = (params) => {
|
|
37
|
+
return manifestSchema.safeParse(params);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { parseManifest };
|
|
41
|
+
//# sourceMappingURL=out.js.map
|
|
42
|
+
//# sourceMappingURL=chunk-46RRUHSN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/manifest.ts"],"names":[],"mappings":";AAAA,SAAS,SAAS,QAAQ,cAAiB;AAE3C,IAAM,eAAe,OAAO;AAAA,EAC1B,UAAU,OAAO;AAAA,EACjB,UAAU,OAAO;AAAA,IACf,KAAK,OAAO;AAAA,MACV,UAAU,OAAO;AAAA,MACjB,aAAa,OAAO;AAAA,MACpB,UAAU,OAAO;AAAA,IACnB,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AAED,IAAM,iBAAiB,OAAO;AAAA,EAC5B,MAAM,OAAO;AAAA,EACb,SAAS,OAAO;AAAA,EAChB,aAAa,OAAO;AAAA,EACpB,SAAS,OAAO;AAAA,IACd,QAAQ;AAAA,IACR,UAAU,aAAa,SAAS;AAAA,EAClC,CAAC;AAAA,EACD,SAAS,OAAO;AAAA,IACd,UAAU,OAAO,EAAE,MAAM;AAAA,IACzB,YAAY,OAAO,EAAE,MAAM;AAAA,EAC7B,CAAC;AAAA,EACD,UAAU,OAAO;AAAA,EACjB,aAAa,OAAO;AAAA,IAClB,KAAK,OAAO;AAAA,MACV,OAAO,QAAQ;AAAA,MACf,SAAS,OAAO,EAAE,MAAM;AAAA,MACxB,sBAAsB,OAAO,EAAE,MAAM;AAAA,IACvC,CAAC;AAAA,EACH,CAAC;AAAA,EACD,iBAAiB,OAAO;AAC1B,CAAC;AAIM,IAAM,gBAAgB,CAAC,WAA8D;AAC1F,SAAO,eAAe,UAAU,MAAM;AACxC","sourcesContent":["import { boolean, object, string, z } from 'zod';\n\nconst sourceSchema = object({\n checksum: string(),\n location: object({\n npm: object({\n filePath: string(),\n packageName: string(),\n registry: string(),\n }),\n }),\n});\n\nconst manifestSchema = object({\n name: string(),\n version: string(),\n description: string(),\n sources: object({\n module: sourceSchema,\n provider: sourceSchema.optional(),\n }),\n network: object({\n chainIds: string().array(),\n namespaces: string().array(),\n }),\n cointype: string(),\n permissions: object({\n rpc: object({\n dapps: boolean(),\n methods: string().array(),\n nonRestrictedMethods: string().array(),\n }),\n }),\n manifestVersion: string(),\n});\n\nexport type Manifest = z.infer<typeof manifestSchema>;\n\nexport const parseManifest = (params: unknown): z.SafeParseReturnType<unknown, Manifest> => {\n return manifestSchema.safeParse(params);\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
// src/coingecko.ts
|
|
6
|
+
var SimplePriceInCurrency = zod.object({
|
|
7
|
+
price: zod.number().optional().nullable(),
|
|
8
|
+
change24: zod.number().optional().nullable(),
|
|
9
|
+
marketCap: zod.number().optional().nullable(),
|
|
10
|
+
vol24: zod.number().optional().nullable()
|
|
11
|
+
});
|
|
12
|
+
var SimplePriceInCurrencyResponseSchema = zod.record(SimplePriceInCurrency);
|
|
13
|
+
var SimplePriceResponseSchema = zod.record(SimplePriceInCurrencyResponseSchema);
|
|
14
|
+
var RawSimplePriceResponseSchema = zod.record(zod.record(zod.number().nullable().optional()));
|
|
15
|
+
|
|
16
|
+
exports.RawSimplePriceResponseSchema = RawSimplePriceResponseSchema;
|
|
17
|
+
exports.SimplePriceResponseSchema = SimplePriceResponseSchema;
|
|
18
|
+
//# sourceMappingURL=out.js.map
|
|
19
|
+
//# sourceMappingURL=chunk-4GFCXI7G.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/coingecko.ts"],"names":[],"mappings":";AAAA,SAAS,QAAQ,QAAQ,cAAiB;AAE1C,IAAM,wBAAwB,OAAO;AAAA,EACnC,OAAO,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACpC,UAAU,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACvC,WAAW,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACxC,OAAO,OAAO,EAAE,SAAS,EAAE,SAAS;AACtC,CAAC;AAED,IAAM,sCAAsC,OAAO,qBAAqB;AACjE,IAAM,4BAA4B,OAAO,mCAAmC;AAG5E,IAAM,+BAA+B,OAAO,OAAO,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { number, object, record, z } from 'zod';\n\nconst SimplePriceInCurrency = object({\n price: number().optional().nullable(),\n change24: number().optional().nullable(),\n marketCap: number().optional().nullable(),\n vol24: number().optional().nullable(),\n});\n\nconst SimplePriceInCurrencyResponseSchema = record(SimplePriceInCurrency);\nexport const SimplePriceResponseSchema = record(SimplePriceInCurrencyResponseSchema);\nexport type SimplePriceResponse = z.infer<typeof SimplePriceResponseSchema>;\n\nexport const RawSimplePriceResponseSchema = record(record(number().nullable().optional()));\nexport type RawSimplePriceResponse = z.infer<typeof RawSimplePriceResponseSchema>;\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/transaction-history.ts
|
|
4
|
+
var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
|
|
5
|
+
TransactionType2["BRIDGE"] = "Bridge";
|
|
6
|
+
TransactionType2["SWAP"] = "Swap";
|
|
7
|
+
TransactionType2["SEND"] = "Send";
|
|
8
|
+
TransactionType2["RECEIVE"] = "Receive";
|
|
9
|
+
TransactionType2["NFT_BUY"] = "NFTBuy";
|
|
10
|
+
TransactionType2["APPROVE"] = "Approve";
|
|
11
|
+
TransactionType2["TRANSFER"] = "Transfer";
|
|
12
|
+
TransactionType2["NFT_SEND"] = "NFTSend";
|
|
13
|
+
TransactionType2["NFT_RECEIVE"] = "NFTReceive";
|
|
14
|
+
TransactionType2["AIRDROP"] = "Airdrop";
|
|
15
|
+
TransactionType2["FILL_ORDER"] = "FillOrder";
|
|
16
|
+
TransactionType2["UNWRAP"] = "Unwrap";
|
|
17
|
+
TransactionType2["UNKNOWN"] = "UNKNOWN";
|
|
18
|
+
return TransactionType2;
|
|
19
|
+
})(TransactionType || {});
|
|
20
|
+
var PChainTransactionType = /* @__PURE__ */ ((PChainTransactionType2) => {
|
|
21
|
+
PChainTransactionType2["ADD_VALIDATOR_TX"] = "AddValidatorTx";
|
|
22
|
+
PChainTransactionType2["ADD_SUBNET_VALIDATOR_TX"] = "AddSubnetValidatorTx";
|
|
23
|
+
PChainTransactionType2["ADD_DELEGATOR_TX"] = "AddDelegatorTx";
|
|
24
|
+
PChainTransactionType2["CREATE_CHAIN_TX"] = "CreateChainTx";
|
|
25
|
+
PChainTransactionType2["CREATE_SUBNET_TX"] = "CreateSubnetTx";
|
|
26
|
+
PChainTransactionType2["IMPORT_TX"] = "ImportTx";
|
|
27
|
+
PChainTransactionType2["EXPORT_TX"] = "ExportTx";
|
|
28
|
+
PChainTransactionType2["ADVANCE_TIME_TX"] = "AdvanceTimeTx";
|
|
29
|
+
PChainTransactionType2["REWARD_VALIDATOR_TX"] = "RewardValidatorTx";
|
|
30
|
+
PChainTransactionType2["REMOVE_SUBNET_VALIDATOR_TX"] = "RemoveSubnetValidatorTx";
|
|
31
|
+
PChainTransactionType2["TRANSFORM_SUBNET_TX"] = "TransformSubnetTx";
|
|
32
|
+
PChainTransactionType2["ADD_PERMISSIONLESS_VALIDATOR_TX"] = "AddPermissionlessValidatorTx";
|
|
33
|
+
PChainTransactionType2["ADD_PERMISSIONLESS_DELEGATOR_TX"] = "AddPermissionlessDelegatorTx";
|
|
34
|
+
PChainTransactionType2["BASE_TX"] = "BaseTx";
|
|
35
|
+
PChainTransactionType2["TRANSFER_SUBNET_OWNERSHIP_TX"] = "TransferSubnetOwnershipTx";
|
|
36
|
+
PChainTransactionType2["UNKNOWN"] = "UNKNOWN";
|
|
37
|
+
return PChainTransactionType2;
|
|
38
|
+
})(PChainTransactionType || {});
|
|
39
|
+
var XChainTransactionType = /* @__PURE__ */ ((XChainTransactionType2) => {
|
|
40
|
+
XChainTransactionType2["BASE_TX"] = "BaseTx";
|
|
41
|
+
XChainTransactionType2["CREATE_ASSET_TX"] = "CreateAssetTx";
|
|
42
|
+
XChainTransactionType2["OPERATION_TX"] = "OperationTx";
|
|
43
|
+
XChainTransactionType2["IMPORT_TX"] = "ImportTx";
|
|
44
|
+
XChainTransactionType2["EXPORT_TX"] = "ExportTx";
|
|
45
|
+
XChainTransactionType2["UNKNOWN"] = "UNKNOWN";
|
|
46
|
+
return XChainTransactionType2;
|
|
47
|
+
})(XChainTransactionType || {});
|
|
48
|
+
|
|
49
|
+
exports.PChainTransactionType = PChainTransactionType;
|
|
50
|
+
exports.TransactionType = TransactionType;
|
|
51
|
+
exports.XChainTransactionType = XChainTransactionType;
|
|
52
|
+
//# sourceMappingURL=out.js.map
|
|
53
|
+
//# sourceMappingURL=chunk-5JHLGX7J.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transaction-history.ts"],"names":["TransactionType","PChainTransactionType","XChainTransactionType"],"mappings":";AAsEO,IAAK,kBAAL,kBAAKA,qBAAL;AACL,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,cAAW;AACX,EAAAA,iBAAA,cAAW;AACX,EAAAA,iBAAA,iBAAc;AACd,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,gBAAa;AACb,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,aAAU;AAbA,SAAAA;AAAA,GAAA;AAgBL,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,sBAAmB;AACnB,EAAAA,uBAAA,6BAA0B;AAC1B,EAAAA,uBAAA,sBAAmB;AACnB,EAAAA,uBAAA,qBAAkB;AAClB,EAAAA,uBAAA,sBAAmB;AACnB,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,qBAAkB;AAClB,EAAAA,uBAAA,yBAAsB;AACtB,EAAAA,uBAAA,gCAA6B;AAC7B,EAAAA,uBAAA,yBAAsB;AACtB,EAAAA,uBAAA,qCAAkC;AAClC,EAAAA,uBAAA,qCAAkC;AAClC,EAAAA,uBAAA,aAAU;AACV,EAAAA,uBAAA,kCAA+B;AAC/B,EAAAA,uBAAA,aAAU;AAhBA,SAAAA;AAAA,GAAA;AAmBL,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,aAAU;AACV,EAAAA,uBAAA,qBAAkB;AAClB,EAAAA,uBAAA,kBAAe;AACf,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,aAAU;AANA,SAAAA;AAAA,GAAA","sourcesContent":["import type { Network } from './common';\nimport type { TokenType } from './token';\n\nexport type GetTransactionHistory = {\n network: Network;\n address: string;\n nextPageToken?: string;\n offset?: number;\n};\n\nexport type TransactionHistoryResponse = {\n transactions: Transaction[];\n nextPageToken?: string;\n};\n\nexport type Transaction = {\n isContractCall: boolean;\n isIncoming: boolean;\n isOutgoing: boolean;\n isSender: boolean;\n timestamp: number;\n hash: string;\n from: string;\n to: string;\n tokens: TxToken[];\n gasPrice?: string;\n gasUsed: string;\n txType?: TransactionType | PChainTransactionType | XChainTransactionType | 'CreateAssetTx' | 'OperationTx';\n chainId: string; // chainId from ActiveNetwork used to fetch tx\n method?: string;\n explorerLink: string;\n};\n\nexport interface TxToken {\n decimal?: string;\n name: string;\n symbol: string;\n amount: string;\n imageUri?: string;\n from?: TokenWithAddress;\n to?: TokenWithAddress;\n collectableTokenId?: string;\n type: TokenType;\n}\n\n// this is RichAddress from @avalabs/glacier-sdk,\n// rename it to TokenWithAddress for better understanding\ntype TokenWithAddress = {\n /**\n * The contract name.\n */\n name?: string;\n /**\n * The contract symbol.\n */\n symbol?: string;\n /**\n * The number of decimals the token uses. For example `6`, means to divide the token amount by `1000000` to get its user representation.\n */\n decimals?: number;\n /**\n * The logo uri for the address.\n */\n logoUri?: string;\n /**\n * A wallet or contract address in mixed-case checksum encoding.\n */\n address: string;\n};\n\nexport enum TransactionType {\n BRIDGE = 'Bridge',\n SWAP = 'Swap',\n SEND = 'Send',\n RECEIVE = 'Receive',\n NFT_BUY = 'NFTBuy',\n APPROVE = 'Approve',\n TRANSFER = 'Transfer',\n NFT_SEND = 'NFTSend',\n NFT_RECEIVE = 'NFTReceive',\n AIRDROP = 'Airdrop',\n FILL_ORDER = 'FillOrder',\n UNWRAP = 'Unwrap',\n UNKNOWN = 'UNKNOWN',\n}\n\nexport enum PChainTransactionType {\n ADD_VALIDATOR_TX = 'AddValidatorTx',\n ADD_SUBNET_VALIDATOR_TX = 'AddSubnetValidatorTx',\n ADD_DELEGATOR_TX = 'AddDelegatorTx',\n CREATE_CHAIN_TX = 'CreateChainTx',\n CREATE_SUBNET_TX = 'CreateSubnetTx',\n IMPORT_TX = 'ImportTx',\n EXPORT_TX = 'ExportTx',\n ADVANCE_TIME_TX = 'AdvanceTimeTx',\n REWARD_VALIDATOR_TX = 'RewardValidatorTx',\n REMOVE_SUBNET_VALIDATOR_TX = 'RemoveSubnetValidatorTx',\n TRANSFORM_SUBNET_TX = 'TransformSubnetTx',\n ADD_PERMISSIONLESS_VALIDATOR_TX = 'AddPermissionlessValidatorTx',\n ADD_PERMISSIONLESS_DELEGATOR_TX = 'AddPermissionlessDelegatorTx',\n BASE_TX = 'BaseTx',\n TRANSFER_SUBNET_OWNERSHIP_TX = 'TransferSubnetOwnershipTx',\n UNKNOWN = 'UNKNOWN',\n}\n\nexport enum XChainTransactionType {\n BASE_TX = 'BaseTx',\n CREATE_ASSET_TX = 'CreateAssetTx',\n OPERATION_TX = 'OperationTx',\n IMPORT_TX = 'ImportTx',\n EXPORT_TX = 'ExportTx',\n UNKNOWN = 'UNKNOWN',\n}\n"]}
|