@avalabs/vm-module-types 0.0.0-test-changeset1-20240714230430 → 0.0.0-test-public-20240801161044
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 +34 -0
- package/dist/account.d.ts +34 -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 +123 -0
- package/dist/balance.d.ts +123 -0
- package/dist/balance.js +3 -0
- package/dist/balance.js.map +1 -0
- package/dist/chunk-2KGTZTXY.cjs +7 -0
- package/dist/chunk-2KGTZTXY.cjs.map +1 -0
- package/dist/chunk-47KTBBRA.cjs +4 -0
- package/dist/chunk-47KTBBRA.cjs.map +1 -0
- package/dist/chunk-4BNYMHOY.js +5 -0
- package/dist/chunk-4BNYMHOY.js.map +1 -0
- package/dist/chunk-4PGCXP4C.cjs +10 -0
- package/dist/chunk-4PGCXP4C.cjs.map +1 -0
- package/dist/chunk-74SNNWSF.cjs +9 -0
- package/dist/chunk-74SNNWSF.cjs.map +1 -0
- package/dist/chunk-7JLXTNPE.js +5 -0
- package/dist/chunk-7JLXTNPE.js.map +1 -0
- package/dist/chunk-7U2R34EQ.js +3 -0
- package/dist/chunk-7U2R34EQ.js.map +1 -0
- package/dist/chunk-7Y6UGMPZ.js +5 -0
- package/dist/chunk-7Y6UGMPZ.js.map +1 -0
- package/dist/chunk-A4YEBDMG.js +7 -0
- package/dist/chunk-A4YEBDMG.js.map +1 -0
- package/dist/chunk-AILYKQEY.cjs +4 -0
- package/dist/chunk-AILYKQEY.cjs.map +1 -0
- package/dist/chunk-B6DAZDIA.cjs +9 -0
- package/dist/chunk-B6DAZDIA.cjs.map +1 -0
- package/dist/chunk-BHB5UV3J.js +3 -0
- package/dist/chunk-BHB5UV3J.js.map +1 -0
- package/dist/chunk-CUVJNZP5.js +3 -0
- package/dist/chunk-CUVJNZP5.js.map +1 -0
- package/dist/chunk-JUV577XH.cjs +4 -0
- package/dist/chunk-JUV577XH.cjs.map +1 -0
- package/dist/chunk-OGQBQHLH.cjs +4 -0
- package/dist/chunk-OGQBQHLH.cjs.map +1 -0
- package/dist/chunk-P6AM7I3B.js +3 -0
- package/dist/chunk-P6AM7I3B.js.map +1 -0
- package/dist/chunk-RIBT5FN6.js +5 -0
- package/dist/chunk-RIBT5FN6.js.map +1 -0
- package/dist/chunk-RKFOXZ35.js +5 -0
- package/dist/chunk-RKFOXZ35.js.map +1 -0
- package/dist/chunk-TCBFAMPS.cjs +7 -0
- package/dist/chunk-TCBFAMPS.cjs.map +1 -0
- package/dist/chunk-VRQJHO4F.cjs +8 -0
- package/dist/chunk-VRQJHO4F.cjs.map +1 -0
- package/dist/chunk-WOO6UGSQ.js +7 -0
- package/dist/chunk-WOO6UGSQ.js.map +1 -0
- package/dist/chunk-YVYCETG2.cjs +8 -0
- package/dist/chunk-YVYCETG2.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 +16 -0
- package/dist/common.cjs.map +1 -0
- package/dist/common.d.cts +40 -0
- package/dist/common.d.ts +40 -0
- package/dist/common.js +3 -0
- package/dist/common.js.map +1 -0
- package/dist/index.cjs +41 -15
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +11 -1
- package/dist/manifest.cjs +12 -0
- package/dist/manifest.cjs.map +1 -0
- package/dist/manifest.d.cts +261 -0
- package/dist/manifest.d.ts +261 -0
- package/dist/manifest.js +3 -0
- package/dist/manifest.js.map +1 -0
- package/dist/module.cjs +6 -0
- package/dist/module.cjs.map +1 -0
- package/dist/module.d.cts +25 -0
- package/dist/module.d.ts +25 -0
- package/dist/module.js +3 -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 +18 -0
- package/dist/network-fee.d.ts +18 -0
- package/dist/network-fee.js +3 -0
- package/dist/network-fee.js.map +1 -0
- package/dist/rpc.cjs +16 -0
- package/dist/rpc.cjs.map +1 -0
- package/dist/rpc.d.cts +137 -0
- package/dist/rpc.d.ts +137 -0
- package/dist/rpc.js +3 -0
- package/dist/rpc.js.map +1 -0
- package/dist/token.cjs +12 -0
- package/dist/token.cjs.map +1 -0
- package/dist/token.d.cts +48 -0
- package/dist/token.d.ts +48 -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 +27 -0
- package/dist/transaction-simulation.d.ts +27 -0
- package/dist/transaction-simulation.js +3 -0
- package/dist/transaction-simulation.js.map +1 -0
- package/package.json +12 -2
- package/.turbo/turbo-build.log +0 -32
- package/.turbo/turbo-lint.log +0 -4
- package/CHANGELOG.md +0 -60
- package/dist/chunk-4RO2H63T.js +0 -7
- package/dist/chunk-4RO2H63T.js.map +0 -1
- package/dist/chunk-L7UO6W6T.cjs +0 -16
- package/dist/chunk-L7UO6W6T.cjs.map +0 -1
- package/dist/types.cjs +0 -40
- package/dist/types.d.cts +0 -516
- package/dist/types.d.ts +0 -516
- package/dist/types.js +0 -3
- package/src/index.ts +0 -1
- package/src/types.ts +0 -328
- 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 chunkTCBFAMPS_cjs = require('./chunk-TCBFAMPS.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, 'WalletType', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkTCBFAMPS_cjs.a; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=account.cjs.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare enum WalletType {
|
|
2
|
+
Mnemonic = "mnemonic",
|
|
3
|
+
Ledger = "ledger",
|
|
4
|
+
LedgerLive = "ledger-live",
|
|
5
|
+
Keystone = "keystone",
|
|
6
|
+
Seedless = "seedless"
|
|
7
|
+
}
|
|
8
|
+
type GetAddressParams = {
|
|
9
|
+
walletType: WalletType;
|
|
10
|
+
accountIndex: number;
|
|
11
|
+
xpub: string;
|
|
12
|
+
xpubXP?: string;
|
|
13
|
+
isTestnet?: boolean;
|
|
14
|
+
};
|
|
15
|
+
type GetAddressResponse = Record<string, string>;
|
|
16
|
+
type PubKeyType = {
|
|
17
|
+
evm: string;
|
|
18
|
+
/**
|
|
19
|
+
* Public keys used for X/P chain are from a different derivation path.
|
|
20
|
+
*/
|
|
21
|
+
xp?: string;
|
|
22
|
+
btcWalletPolicyDetails?: BtcWalletPolicyDetails;
|
|
23
|
+
};
|
|
24
|
+
type BtcWalletPolicyDetails = {
|
|
25
|
+
hmacHex: string;
|
|
26
|
+
/**
|
|
27
|
+
* Extended public key of m/44'/60'/n
|
|
28
|
+
*/
|
|
29
|
+
xpub: string;
|
|
30
|
+
masterFingerprint: string;
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { BtcWalletPolicyDetails, GetAddressParams, GetAddressResponse, PubKeyType, WalletType };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare enum WalletType {
|
|
2
|
+
Mnemonic = "mnemonic",
|
|
3
|
+
Ledger = "ledger",
|
|
4
|
+
LedgerLive = "ledger-live",
|
|
5
|
+
Keystone = "keystone",
|
|
6
|
+
Seedless = "seedless"
|
|
7
|
+
}
|
|
8
|
+
type GetAddressParams = {
|
|
9
|
+
walletType: WalletType;
|
|
10
|
+
accountIndex: number;
|
|
11
|
+
xpub: string;
|
|
12
|
+
xpubXP?: string;
|
|
13
|
+
isTestnet?: boolean;
|
|
14
|
+
};
|
|
15
|
+
type GetAddressResponse = Record<string, string>;
|
|
16
|
+
type PubKeyType = {
|
|
17
|
+
evm: string;
|
|
18
|
+
/**
|
|
19
|
+
* Public keys used for X/P chain are from a different derivation path.
|
|
20
|
+
*/
|
|
21
|
+
xp?: string;
|
|
22
|
+
btcWalletPolicyDetails?: BtcWalletPolicyDetails;
|
|
23
|
+
};
|
|
24
|
+
type BtcWalletPolicyDetails = {
|
|
25
|
+
hmacHex: string;
|
|
26
|
+
/**
|
|
27
|
+
* Extended public key of m/44'/60'/n
|
|
28
|
+
*/
|
|
29
|
+
xpub: string;
|
|
30
|
+
masterFingerprint: string;
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { BtcWalletPolicyDetails, GetAddressParams, GetAddressResponse, PubKeyType, WalletType };
|
package/dist/account.js
ADDED
package/dist/balance.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Network, Storage } from './common.cjs';
|
|
2
|
+
import { NetworkContractToken, TokenType, NetworkToken } from './token.cjs';
|
|
3
|
+
import { PChainBalance, XChainBalances } from '@avalabs/glacier-sdk';
|
|
4
|
+
|
|
5
|
+
type GetBalancesParams = {
|
|
6
|
+
addresses: string[];
|
|
7
|
+
network: Network;
|
|
8
|
+
customTokens?: NetworkContractToken[];
|
|
9
|
+
currency: string;
|
|
10
|
+
storage?: Storage;
|
|
11
|
+
};
|
|
12
|
+
type TokenBalanceData = {
|
|
13
|
+
type: TokenType;
|
|
14
|
+
name: string;
|
|
15
|
+
symbol: string;
|
|
16
|
+
balance: bigint;
|
|
17
|
+
balanceDisplayValue: string;
|
|
18
|
+
balanceInCurrency?: number;
|
|
19
|
+
balanceCurrencyDisplayValue?: string;
|
|
20
|
+
};
|
|
21
|
+
type TokenMarketData = {
|
|
22
|
+
priceInCurrency?: number;
|
|
23
|
+
priceChanges?: {
|
|
24
|
+
percentage?: number;
|
|
25
|
+
value?: number;
|
|
26
|
+
};
|
|
27
|
+
marketCap?: number;
|
|
28
|
+
change24?: number;
|
|
29
|
+
vol24?: number;
|
|
30
|
+
};
|
|
31
|
+
type NetworkTokenWithBalance = TokenBalanceDataWithDecimals & NetworkToken & TokenMarketData & {
|
|
32
|
+
coingeckoId: string;
|
|
33
|
+
type: TokenType.NATIVE;
|
|
34
|
+
};
|
|
35
|
+
interface TokenBalanceDataWithDecimals extends TokenBalanceData {
|
|
36
|
+
decimals: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* EVM TokenWithBalance interface.
|
|
40
|
+
*/
|
|
41
|
+
type TokenWithBalanceERC20 = TokenBalanceDataWithDecimals & TokenMarketData & NetworkContractToken & {
|
|
42
|
+
type: TokenType.ERC20;
|
|
43
|
+
};
|
|
44
|
+
type TokenWithBalanceEVM = NetworkTokenWithBalance | TokenWithBalanceERC20;
|
|
45
|
+
/**
|
|
46
|
+
* Bitcoin TokenWithBalance interface.
|
|
47
|
+
*/
|
|
48
|
+
interface BitcoinInputUTXO {
|
|
49
|
+
txHash: string;
|
|
50
|
+
txHex?: string;
|
|
51
|
+
index: number;
|
|
52
|
+
value: number;
|
|
53
|
+
script: string;
|
|
54
|
+
blockHeight: number;
|
|
55
|
+
confirmations: number;
|
|
56
|
+
confirmedTime?: string;
|
|
57
|
+
}
|
|
58
|
+
interface BitcoinInputUTXOWithOptionalScript extends Omit<BitcoinInputUTXO, 'script'> {
|
|
59
|
+
script?: string;
|
|
60
|
+
}
|
|
61
|
+
interface TokenWithBalanceBTC extends NetworkTokenWithBalance {
|
|
62
|
+
logoUri: string;
|
|
63
|
+
utxos: BitcoinInputUTXOWithOptionalScript[];
|
|
64
|
+
utxosUnconfirmed?: BitcoinInputUTXOWithOptionalScript[];
|
|
65
|
+
unconfirmedBalance?: bigint;
|
|
66
|
+
unconfirmedBalanceDisplayValue?: string;
|
|
67
|
+
unconfirmedBalanceCurrencyDisplayValue?: string;
|
|
68
|
+
unconfirmedBalanceInCurrency?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Avalanche TokenWithBalance interface.
|
|
72
|
+
*/
|
|
73
|
+
interface TokenWithBalancePVM extends NetworkTokenWithBalance {
|
|
74
|
+
available?: bigint;
|
|
75
|
+
availableInCurrency?: number;
|
|
76
|
+
availableDisplayValue?: string;
|
|
77
|
+
availableCurrencyDisplayValue?: string;
|
|
78
|
+
utxos?: PChainBalance;
|
|
79
|
+
balancePerType: {
|
|
80
|
+
lockedStaked: number;
|
|
81
|
+
lockedStakeable: number;
|
|
82
|
+
lockedPlatform: number;
|
|
83
|
+
atomicMemoryLocked: number;
|
|
84
|
+
atomicMemoryUnlocked: number;
|
|
85
|
+
unlockedUnstaked: number;
|
|
86
|
+
unlockedStaked: number;
|
|
87
|
+
pendingStaked: number;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
interface TokenWithBalanceAVM extends NetworkTokenWithBalance {
|
|
91
|
+
available?: bigint;
|
|
92
|
+
availableInCurrency?: number;
|
|
93
|
+
availableDisplayValue?: string;
|
|
94
|
+
availableCurrencyDisplayValue?: string;
|
|
95
|
+
utxos?: XChainBalances;
|
|
96
|
+
balancePerType: {
|
|
97
|
+
locked: number;
|
|
98
|
+
unlocked: number;
|
|
99
|
+
atomicMemoryUnlocked: number;
|
|
100
|
+
atomicMemoryLocked: number;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
interface NftTokenWithBalance extends Omit<NetworkTokenWithBalance, 'type'> {
|
|
104
|
+
type: TokenType.ERC721 | TokenType.ERC1155;
|
|
105
|
+
address: string;
|
|
106
|
+
description: string;
|
|
107
|
+
logoUri: string;
|
|
108
|
+
logoSmall: string;
|
|
109
|
+
name: string;
|
|
110
|
+
symbol: string;
|
|
111
|
+
tokenId: string;
|
|
112
|
+
attributes: TokenAttribute[];
|
|
113
|
+
collectionName: string;
|
|
114
|
+
updatedAt?: number;
|
|
115
|
+
}
|
|
116
|
+
interface TokenAttribute {
|
|
117
|
+
name: string;
|
|
118
|
+
value: string;
|
|
119
|
+
}
|
|
120
|
+
type TokenWithBalance = TokenWithBalanceEVM | TokenWithBalanceBTC | TokenWithBalancePVM | TokenWithBalanceAVM | NftTokenWithBalance;
|
|
121
|
+
type GetBalancesResponse = Record<string, Record<string, TokenWithBalance>>;
|
|
122
|
+
|
|
123
|
+
export { GetBalancesParams, GetBalancesResponse, NetworkTokenWithBalance, NftTokenWithBalance, TokenAttribute, TokenBalanceData, TokenMarketData, TokenWithBalance, TokenWithBalanceAVM, TokenWithBalanceBTC, TokenWithBalanceERC20, TokenWithBalanceEVM, TokenWithBalancePVM };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Network, Storage } from './common.js';
|
|
2
|
+
import { NetworkContractToken, TokenType, NetworkToken } from './token.js';
|
|
3
|
+
import { PChainBalance, XChainBalances } from '@avalabs/glacier-sdk';
|
|
4
|
+
|
|
5
|
+
type GetBalancesParams = {
|
|
6
|
+
addresses: string[];
|
|
7
|
+
network: Network;
|
|
8
|
+
customTokens?: NetworkContractToken[];
|
|
9
|
+
currency: string;
|
|
10
|
+
storage?: Storage;
|
|
11
|
+
};
|
|
12
|
+
type TokenBalanceData = {
|
|
13
|
+
type: TokenType;
|
|
14
|
+
name: string;
|
|
15
|
+
symbol: string;
|
|
16
|
+
balance: bigint;
|
|
17
|
+
balanceDisplayValue: string;
|
|
18
|
+
balanceInCurrency?: number;
|
|
19
|
+
balanceCurrencyDisplayValue?: string;
|
|
20
|
+
};
|
|
21
|
+
type TokenMarketData = {
|
|
22
|
+
priceInCurrency?: number;
|
|
23
|
+
priceChanges?: {
|
|
24
|
+
percentage?: number;
|
|
25
|
+
value?: number;
|
|
26
|
+
};
|
|
27
|
+
marketCap?: number;
|
|
28
|
+
change24?: number;
|
|
29
|
+
vol24?: number;
|
|
30
|
+
};
|
|
31
|
+
type NetworkTokenWithBalance = TokenBalanceDataWithDecimals & NetworkToken & TokenMarketData & {
|
|
32
|
+
coingeckoId: string;
|
|
33
|
+
type: TokenType.NATIVE;
|
|
34
|
+
};
|
|
35
|
+
interface TokenBalanceDataWithDecimals extends TokenBalanceData {
|
|
36
|
+
decimals: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* EVM TokenWithBalance interface.
|
|
40
|
+
*/
|
|
41
|
+
type TokenWithBalanceERC20 = TokenBalanceDataWithDecimals & TokenMarketData & NetworkContractToken & {
|
|
42
|
+
type: TokenType.ERC20;
|
|
43
|
+
};
|
|
44
|
+
type TokenWithBalanceEVM = NetworkTokenWithBalance | TokenWithBalanceERC20;
|
|
45
|
+
/**
|
|
46
|
+
* Bitcoin TokenWithBalance interface.
|
|
47
|
+
*/
|
|
48
|
+
interface BitcoinInputUTXO {
|
|
49
|
+
txHash: string;
|
|
50
|
+
txHex?: string;
|
|
51
|
+
index: number;
|
|
52
|
+
value: number;
|
|
53
|
+
script: string;
|
|
54
|
+
blockHeight: number;
|
|
55
|
+
confirmations: number;
|
|
56
|
+
confirmedTime?: string;
|
|
57
|
+
}
|
|
58
|
+
interface BitcoinInputUTXOWithOptionalScript extends Omit<BitcoinInputUTXO, 'script'> {
|
|
59
|
+
script?: string;
|
|
60
|
+
}
|
|
61
|
+
interface TokenWithBalanceBTC extends NetworkTokenWithBalance {
|
|
62
|
+
logoUri: string;
|
|
63
|
+
utxos: BitcoinInputUTXOWithOptionalScript[];
|
|
64
|
+
utxosUnconfirmed?: BitcoinInputUTXOWithOptionalScript[];
|
|
65
|
+
unconfirmedBalance?: bigint;
|
|
66
|
+
unconfirmedBalanceDisplayValue?: string;
|
|
67
|
+
unconfirmedBalanceCurrencyDisplayValue?: string;
|
|
68
|
+
unconfirmedBalanceInCurrency?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Avalanche TokenWithBalance interface.
|
|
72
|
+
*/
|
|
73
|
+
interface TokenWithBalancePVM extends NetworkTokenWithBalance {
|
|
74
|
+
available?: bigint;
|
|
75
|
+
availableInCurrency?: number;
|
|
76
|
+
availableDisplayValue?: string;
|
|
77
|
+
availableCurrencyDisplayValue?: string;
|
|
78
|
+
utxos?: PChainBalance;
|
|
79
|
+
balancePerType: {
|
|
80
|
+
lockedStaked: number;
|
|
81
|
+
lockedStakeable: number;
|
|
82
|
+
lockedPlatform: number;
|
|
83
|
+
atomicMemoryLocked: number;
|
|
84
|
+
atomicMemoryUnlocked: number;
|
|
85
|
+
unlockedUnstaked: number;
|
|
86
|
+
unlockedStaked: number;
|
|
87
|
+
pendingStaked: number;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
interface TokenWithBalanceAVM extends NetworkTokenWithBalance {
|
|
91
|
+
available?: bigint;
|
|
92
|
+
availableInCurrency?: number;
|
|
93
|
+
availableDisplayValue?: string;
|
|
94
|
+
availableCurrencyDisplayValue?: string;
|
|
95
|
+
utxos?: XChainBalances;
|
|
96
|
+
balancePerType: {
|
|
97
|
+
locked: number;
|
|
98
|
+
unlocked: number;
|
|
99
|
+
atomicMemoryUnlocked: number;
|
|
100
|
+
atomicMemoryLocked: number;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
interface NftTokenWithBalance extends Omit<NetworkTokenWithBalance, 'type'> {
|
|
104
|
+
type: TokenType.ERC721 | TokenType.ERC1155;
|
|
105
|
+
address: string;
|
|
106
|
+
description: string;
|
|
107
|
+
logoUri: string;
|
|
108
|
+
logoSmall: string;
|
|
109
|
+
name: string;
|
|
110
|
+
symbol: string;
|
|
111
|
+
tokenId: string;
|
|
112
|
+
attributes: TokenAttribute[];
|
|
113
|
+
collectionName: string;
|
|
114
|
+
updatedAt?: number;
|
|
115
|
+
}
|
|
116
|
+
interface TokenAttribute {
|
|
117
|
+
name: string;
|
|
118
|
+
value: string;
|
|
119
|
+
}
|
|
120
|
+
type TokenWithBalance = TokenWithBalanceEVM | TokenWithBalanceBTC | TokenWithBalancePVM | TokenWithBalanceAVM | NftTokenWithBalance;
|
|
121
|
+
type GetBalancesResponse = Record<string, Record<string, TokenWithBalance>>;
|
|
122
|
+
|
|
123
|
+
export { GetBalancesParams, GetBalancesResponse, NetworkTokenWithBalance, NftTokenWithBalance, TokenAttribute, TokenBalanceData, TokenMarketData, TokenWithBalance, TokenWithBalanceAVM, TokenWithBalanceBTC, TokenWithBalanceERC20, TokenWithBalanceEVM, TokenWithBalancePVM };
|
package/dist/balance.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/token.ts"],"names":["TokenType"],"mappings":"AAAO,IAAKA,OACVA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,OAAS,SALCA,OAAA","sourcesContent":["export enum TokenType {\n NATIVE = 'NATIVE',\n ERC20 = 'ERC20',\n ERC721 = 'ERC721',\n ERC1155 = 'ERC1155',\n NONERC = 'NONERC',\n}\n\nexport interface NetworkToken {\n name: string;\n symbol: string;\n decimals: number;\n logoUri?: string;\n description?: string;\n}\n\nexport type NetworkContractToken = ERC20Token | ERC1155Token | ERC721Token | NONERCToken;\n\nexport interface ERC20Token {\n address: string;\n chainId?: number;\n color?: string;\n type: TokenType.ERC20;\n decimals: number;\n logoUri?: string;\n name: string;\n symbol: string;\n}\n\nexport interface ERC1155Token {\n address: string;\n type: TokenType.ERC1155;\n logoUri?: string;\n name?: string;\n symbol?: string;\n}\n\nexport interface ERC721Token {\n address: string;\n type: TokenType.ERC721;\n logoUri?: string;\n name?: string;\n symbol?: string;\n}\n\nexport interface NONERCToken {\n address: string;\n type: TokenType.NONERC;\n logoUri?: string;\n name?: string;\n symbol?: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/common.ts"],"names":["NetworkVMType","Environment"],"mappings":"AAsBO,IAAKA,OACVA,EAAA,IAAM,MACNA,EAAA,QAAU,UACVA,EAAA,IAAM,MACNA,EAAA,IAAM,MACNA,EAAA,QAAU,UALAA,OAAA,IAiBAC,OACVA,EAAA,WAAa,aACbA,EAAA,IAAM,MAFIA,OAAA","sourcesContent":["import type { NetworkToken } from './token';\n\nexport type Network = {\n isTestnet?: boolean;\n chainId: number;\n chainName: string;\n rpcUrl: string;\n utilityAddresses?: {\n multicall: string;\n };\n networkToken: NetworkToken;\n pricingProviders?: {\n coingecko: {\n assetPlatformId?: string;\n nativeTokenId?: string;\n };\n };\n explorerUrl?: string;\n logoUri?: string;\n vmName: NetworkVMType;\n};\n\nexport enum NetworkVMType {\n EVM = 'EVM',\n BITCOIN = 'BITCOIN',\n AVM = 'AVM',\n PVM = 'PVM',\n CoreEth = 'CoreEth',\n}\n\nexport type Storage = {\n get: <T>(id: string) => T | undefined;\n set: <T>(id: string, data: T) => void;\n};\n\nexport type Caip2ChainId = string;\n\nexport type Hex = `0x${string}`;\n\nexport enum Environment {\n PRODUCTION = 'production',\n DEV = 'dev',\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
var l=zod.object({price:zod.number().optional().nullable(),change24:zod.number().optional().nullable(),marketCap:zod.number().optional().nullable(),vol24:zod.number().optional().nullable()}),n=zod.record(l),c=zod.record(n),a=zod.record(zod.record(zod.number().nullable().optional()));
|
|
6
|
+
|
|
7
|
+
exports.a = c;
|
|
8
|
+
exports.b = a;
|
|
9
|
+
//# sourceMappingURL=out.js.map
|
|
10
|
+
//# sourceMappingURL=chunk-4PGCXP4C.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/coingecko.ts"],"names":["number","object","record","SimplePriceInCurrency","SimplePriceInCurrencyResponseSchema","SimplePriceResponseSchema","RawSimplePriceResponseSchema"],"mappings":"AAAA,OAAS,UAAAA,EAAQ,UAAAC,EAAQ,UAAAC,MAAiB,MAE1C,IAAMC,EAAwBF,EAAO,CACnC,MAAOD,EAAO,EAAE,SAAS,EAAE,SAAS,EACpC,SAAUA,EAAO,EAAE,SAAS,EAAE,SAAS,EACvC,UAAWA,EAAO,EAAE,SAAS,EAAE,SAAS,EACxC,MAAOA,EAAO,EAAE,SAAS,EAAE,SAAS,CACtC,CAAC,EAEKI,EAAsCF,EAAOC,CAAqB,EAC3DE,EAA4BH,EAAOE,CAAmC,EAGtEE,EAA+BJ,EAAOA,EAAOF,EAAO,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,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
var n=zod.object({checksum:zod.string(),location:zod.object({npm:zod.object({filePath:zod.string(),packageName:zod.string(),registry:zod.string()})})}),o=zod.object({name:zod.string(),version:zod.string(),description:zod.string(),sources:zod.object({module:n,provider:n.optional()}),network:zod.object({chainIds:zod.string().array(),namespaces:zod.string().array()}),cointype:zod.string(),permissions:zod.object({rpc:zod.object({dapps:zod.boolean(),methods:zod.string().array()})}),manifestVersion:zod.string()}),c=r=>o.safeParse(r);
|
|
6
|
+
|
|
7
|
+
exports.a = c;
|
|
8
|
+
//# sourceMappingURL=out.js.map
|
|
9
|
+
//# sourceMappingURL=chunk-74SNNWSF.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/manifest.ts"],"names":["boolean","object","string","sourceSchema","manifestSchema","parseManifest","params"],"mappings":"AAAA,OAAS,WAAAA,EAAS,UAAAC,EAAQ,UAAAC,MAAiB,MAE3C,IAAMC,EAAeF,EAAO,CAC1B,SAAUC,EAAO,EACjB,SAAUD,EAAO,CACf,IAAKA,EAAO,CACV,SAAUC,EAAO,EACjB,YAAaA,EAAO,EACpB,SAAUA,EAAO,CACnB,CAAC,CACH,CAAC,CACH,CAAC,EAEKE,EAAiBH,EAAO,CAC5B,KAAMC,EAAO,EACb,QAASA,EAAO,EAChB,YAAaA,EAAO,EACpB,QAASD,EAAO,CACd,OAAQE,EACR,SAAUA,EAAa,SAAS,CAClC,CAAC,EACD,QAASF,EAAO,CACd,SAAUC,EAAO,EAAE,MAAM,EACzB,WAAYA,EAAO,EAAE,MAAM,CAC7B,CAAC,EACD,SAAUA,EAAO,EACjB,YAAaD,EAAO,CAClB,IAAKA,EAAO,CACV,MAAOD,EAAQ,EACf,QAASE,EAAO,EAAE,MAAM,CAC1B,CAAC,CACH,CAAC,EACD,gBAAiBA,EAAO,CAC1B,CAAC,EAIYG,EAAiBC,GACrBF,EAAe,UAAUE,CAAM","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 }),\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,5 @@
|
|
|
1
|
+
var A=(r=>(r.BRIDGE="Bridge",r.SWAP="Swap",r.SEND="Send",r.RECEIVE="Receive",r.NFT_BUY="NFTBuy",r.APPROVE="Approve",r.TRANSFER="Transfer",r.NFT_SEND="NFTSend",r.NFT_RECEIVE="NFTReceive",r.AIRDROP="Airdrop",r.FILL_ORDER="FillOrder",r.UNWRAP="Unwrap",r.UNKNOWN="UNKNOWN",r))(A||{}),o=(e=>(e.ADD_VALIDATOR_TX="AddValidatorTx",e.ADD_SUBNET_VALIDATOR_TX="AddSubnetValidatorTx",e.ADD_DELEGATOR_TX="AddDelegatorTx",e.CREATE_CHAIN_TX="CreateChainTx",e.CREATE_SUBNET_TX="CreateSubnetTx",e.IMPORT_TX="ImportTx",e.EXPORT_TX="ExportTx",e.ADVANCE_TIME_TX="AdvanceTimeTx",e.REWARD_VALIDATOR_TX="RewardValidatorTx",e.REMOVE_SUBNET_VALIDATOR_TX="RemoveSubnetValidatorTx",e.TRANSFORM_SUBNET_TX="TransformSubnetTx",e.ADD_PERMISSIONLESS_VALIDATOR_TX="AddPermissionlessValidatorTx",e.ADD_PERMISSIONLESS_DELEGATOR_TX="AddPermissionlessDelegatorTx",e.BASE_TX="BaseTx",e.TRANSFER_SUBNET_OWNERSHIP_TX="TransferSubnetOwnershipTx",e.UNKNOWN="UNKNOWN",e))(o||{}),E=(t=>(t.BASE_TX="BaseTx",t.CREATE_ASSET_TX="CreateAssetTx",t.OPERATION_TX="OperationTx",t.IMPORT_TX="ImportTx",t.EXPORT_TX="ExportTx",t.UNKNOWN="UNKNOWN",t))(E||{});
|
|
2
|
+
|
|
3
|
+
export { A as a, o as b, E as c };
|
|
4
|
+
//# sourceMappingURL=out.js.map
|
|
5
|
+
//# sourceMappingURL=chunk-7JLXTNPE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transaction-history.ts"],"names":["TransactionType","PChainTransactionType","XChainTransactionType"],"mappings":"AAsEO,IAAKA,OACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,QAAU,SACVA,EAAA,QAAU,UACVA,EAAA,SAAW,WACXA,EAAA,SAAW,UACXA,EAAA,YAAc,aACdA,EAAA,QAAU,UACVA,EAAA,WAAa,YACbA,EAAA,OAAS,SACTA,EAAA,QAAU,UAbAA,OAAA,IAgBAC,OACVA,EAAA,iBAAmB,iBACnBA,EAAA,wBAA0B,uBAC1BA,EAAA,iBAAmB,iBACnBA,EAAA,gBAAkB,gBAClBA,EAAA,iBAAmB,iBACnBA,EAAA,UAAY,WACZA,EAAA,UAAY,WACZA,EAAA,gBAAkB,gBAClBA,EAAA,oBAAsB,oBACtBA,EAAA,2BAA6B,0BAC7BA,EAAA,oBAAsB,oBACtBA,EAAA,gCAAkC,+BAClCA,EAAA,gCAAkC,+BAClCA,EAAA,QAAU,SACVA,EAAA,6BAA+B,4BAC/BA,EAAA,QAAU,UAhBAA,OAAA,IAmBAC,OACVA,EAAA,QAAU,SACVA,EAAA,gBAAkB,gBAClBA,EAAA,aAAe,cACfA,EAAA,UAAY,WACZA,EAAA,UAAY,WACZA,EAAA,QAAU,UANAA,OAAA","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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/token.ts"],"names":["TokenType"],"mappings":"AAAO,IAAKA,OACVA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,OAAS,SALCA,OAAA","sourcesContent":["export enum TokenType {\n NATIVE = 'NATIVE',\n ERC20 = 'ERC20',\n ERC721 = 'ERC721',\n ERC1155 = 'ERC1155',\n NONERC = 'NONERC',\n}\n\nexport interface NetworkToken {\n name: string;\n symbol: string;\n decimals: number;\n logoUri?: string;\n description?: string;\n}\n\nexport type NetworkContractToken = ERC20Token | ERC1155Token | ERC721Token | NONERCToken;\n\nexport interface ERC20Token {\n address: string;\n chainId?: number;\n color?: string;\n type: TokenType.ERC20;\n decimals: number;\n logoUri?: string;\n name: string;\n symbol: string;\n}\n\nexport interface ERC1155Token {\n address: string;\n type: TokenType.ERC1155;\n logoUri?: string;\n name?: string;\n symbol?: string;\n}\n\nexport interface ERC721Token {\n address: string;\n type: TokenType.ERC721;\n logoUri?: string;\n name?: string;\n symbol?: string;\n}\n\nexport interface NONERCToken {\n address: string;\n type: TokenType.NONERC;\n logoUri?: string;\n name?: string;\n symbol?: string;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { object, string, boolean } from 'zod';
|
|
2
|
+
|
|
3
|
+
var n=object({checksum:string(),location:object({npm:object({filePath:string(),packageName:string(),registry:string()})})}),o=object({name:string(),version:string(),description:string(),sources:object({module:n,provider:n.optional()}),network:object({chainIds:string().array(),namespaces:string().array()}),cointype:string(),permissions:object({rpc:object({dapps:boolean(),methods:string().array()})}),manifestVersion:string()}),c=r=>o.safeParse(r);
|
|
4
|
+
|
|
5
|
+
export { c as a };
|
|
6
|
+
//# sourceMappingURL=out.js.map
|
|
7
|
+
//# sourceMappingURL=chunk-A4YEBDMG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/manifest.ts"],"names":["boolean","object","string","sourceSchema","manifestSchema","parseManifest","params"],"mappings":"AAAA,OAAS,WAAAA,EAAS,UAAAC,EAAQ,UAAAC,MAAiB,MAE3C,IAAMC,EAAeF,EAAO,CAC1B,SAAUC,EAAO,EACjB,SAAUD,EAAO,CACf,IAAKA,EAAO,CACV,SAAUC,EAAO,EACjB,YAAaA,EAAO,EACpB,SAAUA,EAAO,CACnB,CAAC,CACH,CAAC,CACH,CAAC,EAEKE,EAAiBH,EAAO,CAC5B,KAAMC,EAAO,EACb,QAASA,EAAO,EAChB,YAAaA,EAAO,EACpB,QAASD,EAAO,CACd,OAAQE,EACR,SAAUA,EAAa,SAAS,CAClC,CAAC,EACD,QAASF,EAAO,CACd,SAAUC,EAAO,EAAE,MAAM,EACzB,WAAYA,EAAO,EAAE,MAAM,CAC7B,CAAC,EACD,SAAUA,EAAO,EACjB,YAAaD,EAAO,CAClB,IAAKA,EAAO,CACV,MAAOD,EAAQ,EACf,QAASE,EAAO,EAAE,MAAM,CAC1B,CAAC,CACH,CAAC,EACD,gBAAiBA,EAAO,CAC1B,CAAC,EAIYG,EAAiBC,GACrBF,EAAe,UAAUE,CAAM","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 }),\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,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var A=(r=>(r.BRIDGE="Bridge",r.SWAP="Swap",r.SEND="Send",r.RECEIVE="Receive",r.NFT_BUY="NFTBuy",r.APPROVE="Approve",r.TRANSFER="Transfer",r.NFT_SEND="NFTSend",r.NFT_RECEIVE="NFTReceive",r.AIRDROP="Airdrop",r.FILL_ORDER="FillOrder",r.UNWRAP="Unwrap",r.UNKNOWN="UNKNOWN",r))(A||{}),o=(e=>(e.ADD_VALIDATOR_TX="AddValidatorTx",e.ADD_SUBNET_VALIDATOR_TX="AddSubnetValidatorTx",e.ADD_DELEGATOR_TX="AddDelegatorTx",e.CREATE_CHAIN_TX="CreateChainTx",e.CREATE_SUBNET_TX="CreateSubnetTx",e.IMPORT_TX="ImportTx",e.EXPORT_TX="ExportTx",e.ADVANCE_TIME_TX="AdvanceTimeTx",e.REWARD_VALIDATOR_TX="RewardValidatorTx",e.REMOVE_SUBNET_VALIDATOR_TX="RemoveSubnetValidatorTx",e.TRANSFORM_SUBNET_TX="TransformSubnetTx",e.ADD_PERMISSIONLESS_VALIDATOR_TX="AddPermissionlessValidatorTx",e.ADD_PERMISSIONLESS_DELEGATOR_TX="AddPermissionlessDelegatorTx",e.BASE_TX="BaseTx",e.TRANSFER_SUBNET_OWNERSHIP_TX="TransferSubnetOwnershipTx",e.UNKNOWN="UNKNOWN",e))(o||{}),E=(t=>(t.BASE_TX="BaseTx",t.CREATE_ASSET_TX="CreateAssetTx",t.OPERATION_TX="OperationTx",t.IMPORT_TX="ImportTx",t.EXPORT_TX="ExportTx",t.UNKNOWN="UNKNOWN",t))(E||{});
|
|
4
|
+
|
|
5
|
+
exports.a = A;
|
|
6
|
+
exports.b = o;
|
|
7
|
+
exports.c = E;
|
|
8
|
+
//# sourceMappingURL=out.js.map
|
|
9
|
+
//# sourceMappingURL=chunk-B6DAZDIA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transaction-history.ts"],"names":["TransactionType","PChainTransactionType","XChainTransactionType"],"mappings":"AAsEO,IAAKA,OACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,QAAU,SACVA,EAAA,QAAU,UACVA,EAAA,SAAW,WACXA,EAAA,SAAW,UACXA,EAAA,YAAc,aACdA,EAAA,QAAU,UACVA,EAAA,WAAa,YACbA,EAAA,OAAS,SACTA,EAAA,QAAU,UAbAA,OAAA,IAgBAC,OACVA,EAAA,iBAAmB,iBACnBA,EAAA,wBAA0B,uBAC1BA,EAAA,iBAAmB,iBACnBA,EAAA,gBAAkB,gBAClBA,EAAA,iBAAmB,iBACnBA,EAAA,UAAY,WACZA,EAAA,UAAY,WACZA,EAAA,gBAAkB,gBAClBA,EAAA,oBAAsB,oBACtBA,EAAA,2BAA6B,0BAC7BA,EAAA,oBAAsB,oBACtBA,EAAA,gCAAkC,+BAClCA,EAAA,gCAAkC,+BAClCA,EAAA,QAAU,SACVA,EAAA,6BAA+B,4BAC/BA,EAAA,QAAU,UAhBAA,OAAA,IAmBAC,OACVA,EAAA,QAAU,SACVA,EAAA,gBAAkB,gBAClBA,EAAA,aAAe,cACfA,EAAA,UAAY,WACZA,EAAA,UAAY,WACZA,EAAA,QAAU,UANAA,OAAA","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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/account.ts"],"names":["WalletType"],"mappings":"AAAO,IAAKA,OAEVA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,WAAa,cACbA,EAAA,SAAW,WACXA,EAAA,SAAW,WANDA,OAAA","sourcesContent":["export enum WalletType {\n // Primary wallet types\n Mnemonic = 'mnemonic',\n Ledger = 'ledger',\n LedgerLive = 'ledger-live',\n Keystone = 'keystone',\n Seedless = 'seedless',\n}\n\nexport type GetAddressParams = {\n walletType: WalletType;\n accountIndex: number;\n xpub: string;\n xpubXP?: string;\n isTestnet?: boolean;\n};\n\nexport type GetAddressResponse = Record<string, string>;\n\nexport type PubKeyType = {\n evm: string;\n /**\n * Public keys used for X/P chain are from a different derivation path.\n */\n xp?: string;\n btcWalletPolicyDetails?: BtcWalletPolicyDetails;\n};\n\nexport type BtcWalletPolicyDetails = {\n hmacHex: string;\n /**\n * Extended public key of m/44'/60'/n\n */\n xpub: string;\n masterFingerprint: string;\n name: string;\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var r=(e=>(e.ETH_SEND_TRANSACTION="eth_sendTransaction",e.SIGN_TYPED_DATA_V3="eth_signTypedData_v3",e.SIGN_TYPED_DATA_V4="eth_signTypedData_v4",e.SIGN_TYPED_DATA_V1="eth_signTypedData_v1",e.SIGN_TYPED_DATA="eth_signTypedData",e.PERSONAL_SIGN="personal_sign",e.ETH_SIGN="eth_sign",e))(r||{}),a=(t=>(t.WARNING="Warning",t.DANGER="Danger",t.INFO="Info",t))(a||{});
|
|
2
|
+
|
|
3
|
+
export { r as a, a as b };
|
|
4
|
+
//# sourceMappingURL=out.js.map
|
|
5
|
+
//# sourceMappingURL=chunk-RKFOXZ35.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rpc.ts"],"names":["RpcMethod","AlertType"],"mappings":"AAKO,IAAKA,OAEVA,EAAA,qBAAuB,sBACvBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,gBAAkB,oBAClBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WARDA,OAAA,IAsFAC,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAHGA,OAAA","sourcesContent":["import type { TransactionRequest } from 'ethers';\nimport type { Caip2ChainId, Hex } from './common';\nimport type { JsonRpcError, EthereumProviderError, OptionalDataWithOptionalCause } from '@metamask/rpc-errors';\nimport type { BalanceChange, TokenApprovals } from './transaction-simulation';\n\nexport enum RpcMethod {\n /* EVM */\n ETH_SEND_TRANSACTION = 'eth_sendTransaction',\n SIGN_TYPED_DATA_V3 = 'eth_signTypedData_v3',\n SIGN_TYPED_DATA_V4 = 'eth_signTypedData_v4',\n SIGN_TYPED_DATA_V1 = 'eth_signTypedData_v1',\n SIGN_TYPED_DATA = 'eth_signTypedData',\n PERSONAL_SIGN = 'personal_sign',\n ETH_SIGN = 'eth_sign',\n}\n\nexport type DappInfo = {\n name: string;\n url: string;\n icon: string;\n};\n\nexport type RpcRequest = {\n requestId: string;\n sessionId: string;\n method: RpcMethod;\n chainId: Caip2ChainId;\n params: unknown;\n dappInfo: DappInfo;\n context?: Record<string, unknown>; // for storing additional context information that's only relevant to the consumer\n};\n\nexport type RpcError =\n | JsonRpcError<OptionalDataWithOptionalCause>\n | EthereumProviderError<OptionalDataWithOptionalCause>;\n\nexport type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> =\n | {\n result: R;\n }\n | {\n error: E;\n };\n\nexport interface MessageTypeProperty {\n name: string;\n type: string;\n}\n\nexport interface MessageTypes {\n EIP712Domain: MessageTypeProperty[];\n [additionalProperties: string]: MessageTypeProperty[];\n}\n\nexport interface TypedData<T extends MessageTypes> {\n types: T;\n primaryType: keyof T;\n domain: Record<string, unknown>;\n message: Record<string, unknown>;\n}\n\nexport type TypedDataV1 = { name: string; type: string; value: unknown }[];\n\nexport type DisplayData = {\n title: string;\n dAppInfo?: {\n name: string;\n action: string;\n logoUri?: string;\n };\n network: {\n chainId: number;\n name: string;\n logoUri?: string;\n };\n account?: string;\n messageDetails?: string;\n transactionDetails?: {\n website: string;\n from: string;\n to: string;\n data?: string;\n type?: string;\n };\n networkFeeSelector?: boolean;\n disclaimer?: string;\n alert?: Alert;\n balanceChange?: BalanceChange;\n tokenApprovals?: TokenApprovals;\n};\n\nexport enum AlertType {\n WARNING = 'Warning',\n DANGER = 'Danger',\n INFO = 'Info',\n}\n\nexport type AlertDetails = {\n title: string;\n description: string;\n detailedDescription?: string;\n actionTitles?: {\n proceed: string;\n reject: string;\n };\n};\n\nexport type Alert = {\n type: AlertType;\n details: AlertDetails;\n};\n\nexport type SigningData =\n | {\n type: RpcMethod.ETH_SEND_TRANSACTION;\n account: string;\n chainId: number;\n data: TransactionRequest;\n }\n | {\n type: RpcMethod.ETH_SIGN | RpcMethod.PERSONAL_SIGN;\n account: string;\n chainId: number;\n data: string;\n }\n | {\n type: RpcMethod.SIGN_TYPED_DATA | RpcMethod.SIGN_TYPED_DATA_V1;\n account: string;\n chainId: number;\n data: TypedData<MessageTypes> | TypedDataV1;\n }\n | {\n type: RpcMethod.SIGN_TYPED_DATA_V3 | RpcMethod.SIGN_TYPED_DATA_V4;\n account: string;\n chainId: number;\n data: TypedData<MessageTypes>;\n };\n\nexport type ApprovalParams = {\n request: RpcRequest;\n displayData: DisplayData;\n signingData: SigningData;\n};\n\nexport type ApprovalResponse =\n | {\n result: Hex;\n }\n | {\n error: RpcError;\n };\n\nexport interface ApprovalController {\n requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;\n onTransactionConfirmed: (txHash: Hex) => void;\n onTransactionReverted: (txHash: Hex) => void;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/account.ts"],"names":["WalletType"],"mappings":"AAAO,IAAKA,OAEVA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,WAAa,cACbA,EAAA,SAAW,WACXA,EAAA,SAAW,WANDA,OAAA","sourcesContent":["export enum WalletType {\n // Primary wallet types\n Mnemonic = 'mnemonic',\n Ledger = 'ledger',\n LedgerLive = 'ledger-live',\n Keystone = 'keystone',\n Seedless = 'seedless',\n}\n\nexport type GetAddressParams = {\n walletType: WalletType;\n accountIndex: number;\n xpub: string;\n xpubXP?: string;\n isTestnet?: boolean;\n};\n\nexport type GetAddressResponse = Record<string, string>;\n\nexport type PubKeyType = {\n evm: string;\n /**\n * Public keys used for X/P chain are from a different derivation path.\n */\n xp?: string;\n btcWalletPolicyDetails?: BtcWalletPolicyDetails;\n};\n\nexport type BtcWalletPolicyDetails = {\n hmacHex: string;\n /**\n * Extended public key of m/44'/60'/n\n */\n xpub: string;\n masterFingerprint: string;\n name: string;\n};\n"]}
|