@avalabs/vm-module-types 0.0.22 → 0.1.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.
Files changed (48) hide show
  1. package/LICENSE +9 -0
  2. package/dist/account.cjs +12 -0
  3. package/dist/account.cjs.map +1 -0
  4. package/dist/account.d.cts +34 -0
  5. package/dist/account.d.ts +34 -0
  6. package/dist/account.js +3 -0
  7. package/dist/account.js.map +1 -0
  8. package/dist/balance.d.cts +4 -5
  9. package/dist/balance.d.ts +4 -5
  10. package/dist/{chunk-H6ZZE5M7.js → chunk-7JLXTNPE.js} +1 -1
  11. package/dist/chunk-7JLXTNPE.js.map +1 -0
  12. package/dist/{chunk-BFBDZPL3.cjs → chunk-B6DAZDIA.cjs} +1 -1
  13. package/dist/chunk-B6DAZDIA.cjs.map +1 -0
  14. package/dist/chunk-RIBT5FN6.js +5 -0
  15. package/dist/chunk-RIBT5FN6.js.map +1 -0
  16. package/dist/chunk-TCBFAMPS.cjs +7 -0
  17. package/dist/chunk-TCBFAMPS.cjs.map +1 -0
  18. package/dist/coingecko.d.cts +4 -4
  19. package/dist/coingecko.d.ts +4 -4
  20. package/dist/index.cjs +18 -13
  21. package/dist/index.d.cts +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +3 -2
  24. package/dist/module.d.cts +2 -2
  25. package/dist/module.d.ts +2 -2
  26. package/dist/transaction-history.cjs +4 -4
  27. package/dist/transaction-history.d.cts +1 -1
  28. package/dist/transaction-history.d.ts +1 -1
  29. package/dist/transaction-history.js +1 -1
  30. package/package.json +6 -1
  31. package/.turbo/turbo-build.log +0 -130
  32. package/.turbo/turbo-lint.log +0 -4
  33. package/CHANGELOG.md +0 -102
  34. package/dist/chunk-BFBDZPL3.cjs.map +0 -1
  35. package/dist/chunk-H6ZZE5M7.js.map +0 -1
  36. package/src/balance.ts +0 -146
  37. package/src/coingecko.ts +0 -15
  38. package/src/common.ts +0 -43
  39. package/src/index.ts +0 -10
  40. package/src/manifest.ts +0 -40
  41. package/src/module.ts +0 -17
  42. package/src/network-fee.ts +0 -7
  43. package/src/rpc.ts +0 -157
  44. package/src/token.ts +0 -52
  45. package/src/transaction-history.ts +0 -113
  46. package/src/transaction-simulation.ts +0 -29
  47. package/tsconfig.json +0 -8
  48. package/tsup.config.ts +0 -4
@@ -1,130 +0,0 @@
1
-
2
- > @avalabs/vm-module-types@0.0.22 build /home/runner/work/vm-modules/vm-modules/packages/types
3
- > tsup
4
-
5
- CLI Building entry: src/balance.ts, src/coingecko.ts, src/common.ts, src/index.ts, src/manifest.ts, src/module.ts, src/network-fee.ts, src/rpc.ts, src/token.ts, src/transaction-history.ts, src/transaction-simulation.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v7.2.0
8
- CLI Using tsup config: /home/runner/work/vm-modules/vm-modules/packages/types/tsup.config.ts
9
- CLI Target: es2021
10
- CLI Cleaning output folder
11
- CJS Build start
12
- ESM Build start
13
- Generated an empty chunk: "chunk-P6AM7I3B".
14
- Generated an empty chunk: "chunk-BHB5UV3J".
15
- Generated an empty chunk: "chunk-CUVJNZP5".
16
- Generated an empty chunk: "chunk-7U2R34EQ".
17
- Generated an empty chunk: "chunk-47KTBBRA".
18
- Generated an empty chunk: "chunk-JUV577XH".
19
- Generated an empty chunk: "chunk-OGQBQHLH".
20
- Generated an empty chunk: "chunk-AILYKQEY".
21
- ESM dist/chunk-7Y6UGMPZ.js 207.00 B
22
- ESM dist/chunk-H6ZZE5M7.js 1.18 KB
23
- ESM dist/chunk-P6AM7I3B.js 75.00 B
24
- ESM dist/chunk-BHB5UV3J.js 75.00 B
25
- ESM dist/chunk-4BNYMHOY.js 257.00 B
26
- ESM dist/chunk-CUVJNZP5.js 75.00 B
27
- ESM dist/chunk-7U2R34EQ.js 75.00 B
28
- ESM dist/chunk-RKFOXZ35.js 464.00 B
29
- ESM dist/token.js 119.00 B
30
- ESM dist/transaction-history.js 195.00 B
31
- ESM dist/transaction-simulation.js 112.00 B
32
- ESM dist/balance.js 97.00 B
33
- ESM dist/coingecko.js 174.00 B
34
- ESM dist/common.js 142.00 B
35
- ESM dist/index.js 664.00 B
36
- ESM dist/chunk-WOO6UGSQ.js 394.00 B
37
- ESM dist/manifest.js 126.00 B
38
- ESM dist/chunk-A4YEBDMG.js 592.00 B
39
- ESM dist/module.js 96.00 B
40
- ESM dist/network-fee.js 101.00 B
41
- ESM dist/rpc.js 133.00 B
42
- ESM dist/chunk-7Y6UGMPZ.js.map 1.18 KB
43
- ESM dist/chunk-H6ZZE5M7.js.map 3.69 KB
44
- ESM dist/chunk-P6AM7I3B.js.map 51.00 B
45
- ESM dist/chunk-BHB5UV3J.js.map 51.00 B
46
- ESM dist/chunk-4BNYMHOY.js.map 1.08 KB
47
- ESM dist/chunk-CUVJNZP5.js.map 51.00 B
48
- ESM dist/chunk-7U2R34EQ.js.map 51.00 B
49
- ESM dist/chunk-RKFOXZ35.js.map 4.03 KB
50
- ESM dist/token.js.map 51.00 B
51
- ESM dist/transaction-history.js.map 51.00 B
52
- ESM dist/transaction-simulation.js.map 51.00 B
53
- ESM dist/balance.js.map 51.00 B
54
- ESM dist/coingecko.js.map 51.00 B
55
- ESM dist/common.js.map 51.00 B
56
- ESM dist/index.js.map 51.00 B
57
- ESM dist/chunk-WOO6UGSQ.js.map 1.24 KB
58
- ESM dist/manifest.js.map 51.00 B
59
- ESM dist/chunk-A4YEBDMG.js.map 1.65 KB
60
- ESM dist/module.js.map 51.00 B
61
- ESM dist/network-fee.js.map 51.00 B
62
- ESM dist/rpc.js.map 51.00 B
63
- ESM ⚡️ Build success in 1511ms
64
- CJS dist/chunk-2KGTZTXY.cjs 219.00 B
65
- CJS dist/chunk-BFBDZPL3.cjs 1.21 KB
66
- CJS dist/chunk-47KTBBRA.cjs 90.00 B
67
- CJS dist/chunk-JUV577XH.cjs 90.00 B
68
- CJS dist/chunk-VRQJHO4F.cjs 276.00 B
69
- CJS dist/chunk-OGQBQHLH.cjs 90.00 B
70
- CJS dist/chunk-AILYKQEY.cjs 90.00 B
71
- CJS dist/chunk-YVYCETG2.cjs 483.00 B
72
- CJS dist/token.cjs 260.00 B
73
- CJS dist/transaction-history.cjs 542.00 B
74
- CJS dist/transaction-simulation.cjs 132.00 B
75
- CJS dist/balance.cjs 117.00 B
76
- CJS dist/coingecko.cjs 418.00 B
77
- CJS dist/common.cjs 386.00 B
78
- CJS dist/index.cjs 1.90 KB
79
- CJS dist/chunk-4PGCXP4C.cjs 433.00 B
80
- CJS dist/manifest.cjs 267.00 B
81
- CJS dist/chunk-74SNNWSF.cjs 667.00 B
82
- CJS dist/module.cjs 116.00 B
83
- CJS dist/network-fee.cjs 121.00 B
84
- CJS dist/rpc.cjs 377.00 B
85
- CJS dist/chunk-2KGTZTXY.cjs.map 1.18 KB
86
- CJS dist/chunk-BFBDZPL3.cjs.map 3.69 KB
87
- CJS dist/chunk-47KTBBRA.cjs.map 51.00 B
88
- CJS dist/chunk-JUV577XH.cjs.map 51.00 B
89
- CJS dist/chunk-VRQJHO4F.cjs.map 1.08 KB
90
- CJS dist/chunk-OGQBQHLH.cjs.map 51.00 B
91
- CJS dist/chunk-AILYKQEY.cjs.map 51.00 B
92
- CJS dist/chunk-YVYCETG2.cjs.map 4.03 KB
93
- CJS dist/token.cjs.map 51.00 B
94
- CJS dist/transaction-history.cjs.map 51.00 B
95
- CJS dist/transaction-simulation.cjs.map 51.00 B
96
- CJS dist/balance.cjs.map 51.00 B
97
- CJS dist/coingecko.cjs.map 51.00 B
98
- CJS dist/common.cjs.map 51.00 B
99
- CJS dist/index.cjs.map 51.00 B
100
- CJS dist/chunk-4PGCXP4C.cjs.map 1.24 KB
101
- CJS dist/manifest.cjs.map 51.00 B
102
- CJS dist/chunk-74SNNWSF.cjs.map 1.65 KB
103
- CJS dist/module.cjs.map 51.00 B
104
- CJS dist/network-fee.cjs.map 51.00 B
105
- CJS dist/rpc.cjs.map 51.00 B
106
- CJS ⚡️ Build success in 1538ms
107
- DTS Build start
108
- DTS ⚡️ Build success in 10239ms
109
- DTS dist/index.d.cts 1.43 KB
110
- DTS dist/coingecko.d.cts 1.09 KB
111
- DTS dist/module.d.cts 1.04 KB
112
- DTS dist/balance.d.cts 3.81 KB
113
- DTS dist/manifest.d.cts 6.95 KB
114
- DTS dist/network-fee.d.cts 361.00 B
115
- DTS dist/rpc.d.cts 3.65 KB
116
- DTS dist/transaction-history.d.cts 2.88 KB
117
- DTS dist/common.d.cts 902.00 B
118
- DTS dist/transaction-simulation.d.cts 642.00 B
119
- DTS dist/token.d.cts 1.05 KB
120
- DTS dist/index.d.ts 1.42 KB
121
- DTS dist/coingecko.d.ts 1.09 KB
122
- DTS dist/module.d.ts 1.04 KB
123
- DTS dist/balance.d.ts 3.80 KB
124
- DTS dist/manifest.d.ts 6.95 KB
125
- DTS dist/network-fee.d.ts 361.00 B
126
- DTS dist/rpc.d.ts 3.65 KB
127
- DTS dist/transaction-history.d.ts 2.88 KB
128
- DTS dist/common.d.ts 901.00 B
129
- DTS dist/transaction-simulation.d.ts 641.00 B
130
- DTS dist/token.d.ts 1.05 KB
@@ -1,4 +0,0 @@
1
-
2
- > @avalabs/vm-module-types@0.0.22 lint /home/runner/work/vm-modules/vm-modules/packages/types
3
- > eslint "src/**/*.ts"
4
-
package/CHANGELOG.md DELETED
@@ -1,102 +0,0 @@
1
- # @avalabs/vm-module-types
2
-
3
- ## 0.0.22
4
-
5
- ## 0.0.21
6
-
7
- ## 0.0.20
8
-
9
- ### Patch Changes
10
-
11
- - 9bfa82d: Implement balance fetching for BitcoinModule
12
-
13
- ## 0.0.19
14
-
15
- ### Patch Changes
16
-
17
- - 5af458b: Add getBalances to avalanche-module
18
-
19
- ## 0.0.18
20
-
21
- ## 0.0.17
22
-
23
- ### Patch Changes
24
-
25
- - 3590edf: Transaction parsing, validation and simulation for EVM
26
-
27
- ## 0.0.16
28
-
29
- ### Patch Changes
30
-
31
- - bc48457: add support for all eth_sign methods
32
-
33
- ## 0.0.15
34
-
35
- ### Patch Changes
36
-
37
- - f536d58: add module functions to evm-module
38
-
39
- ## 0.0.14
40
-
41
- ### Patch Changes
42
-
43
- - 0593258: add getBalances to evm-module
44
-
45
- ## 0.0.13
46
-
47
- ### Patch Changes
48
-
49
- - af68c81: Add getTransactionHistory to avalanche module
50
- - d9fa0f5: added getNetworkFee to avalanche module
51
-
52
- ## 0.0.12
53
-
54
- ### Patch Changes
55
-
56
- - cd97708: fix: build types package
57
- - d0c2cc9: make module interface more consistent
58
- - 7bc6c6e: add eth_sendTransaction handler
59
-
60
- ## 0.0.11
61
-
62
- ## 0.0.10
63
-
64
- ### Patch Changes
65
-
66
- - 60f36fa: add getTokens function
67
-
68
- ## 0.0.9
69
-
70
- ### Patch Changes
71
-
72
- - 6ffa356: add module functions to evm-module
73
-
74
- ## 0.0.8
75
-
76
- ### Patch Changes
77
-
78
- - d1d080f: test release
79
-
80
- ## 0.0.7
81
-
82
- ### Patch Changes
83
-
84
- - bb98621: Move types to @avalabs/vm-module-types
85
-
86
- ## 0.0.6
87
-
88
- ### Patch Changes
89
-
90
- - 1122704: test release
91
-
92
- ## 0.0.3
93
-
94
- ### Patch Changes
95
-
96
- - 0b0c52e: Move types to @avalabs/vm-module-types
97
-
98
- ## 0.0.2
99
-
100
- ### Patch Changes
101
-
102
- - 4b7d5e9: Move types from packages-internal/types to packages/types
@@ -1 +0,0 @@
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;\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"]}
@@ -1 +0,0 @@
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;\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"]}
package/src/balance.ts DELETED
@@ -1,146 +0,0 @@
1
- import type { Storage, Network } from './common';
2
- import type { NetworkContractToken, NetworkToken, TokenType } from './token';
3
- import type BN from 'bn.js';
4
- import type { PChainBalance, XChainBalances } from '@avalabs/glacier-sdk';
5
-
6
- export type GetBalancesParams = {
7
- addresses: string[];
8
- network: Network;
9
- customTokens?: NetworkContractToken[];
10
- currency: string;
11
- storage?: Storage;
12
- };
13
-
14
- export type TokenBalanceData = {
15
- type: TokenType;
16
- name: string;
17
- symbol: string;
18
- balance: BN;
19
- balanceDisplayValue: string;
20
- balanceInCurrency?: number;
21
- balanceCurrencyDisplayValue?: string;
22
- };
23
-
24
- export type TokenMarketData = {
25
- priceInCurrency?: number;
26
- priceChanges?: {
27
- percentage?: number;
28
- value?: number;
29
- };
30
- marketCap?: number;
31
- change24?: number;
32
- vol24?: number;
33
- };
34
-
35
- export type NetworkTokenWithBalance = TokenBalanceDataWithDecimals &
36
- NetworkToken &
37
- TokenMarketData & {
38
- coingeckoId: string;
39
- type: TokenType.NATIVE;
40
- };
41
-
42
- interface TokenBalanceDataWithDecimals extends TokenBalanceData {
43
- decimals: number;
44
- }
45
-
46
- /**
47
- * EVM TokenWithBalance interface.
48
- */
49
- export type TokenWithBalanceERC20 = TokenBalanceDataWithDecimals &
50
- TokenMarketData &
51
- NetworkContractToken & {
52
- type: TokenType.ERC20;
53
- };
54
-
55
- export type TokenWithBalanceEVM = NetworkTokenWithBalance | TokenWithBalanceERC20;
56
-
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
-
71
- interface BitcoinInputUTXOWithOptionalScript extends Omit<BitcoinInputUTXO, 'script'> {
72
- script?: string;
73
- }
74
-
75
- export interface TokenWithBalanceBTC extends NetworkTokenWithBalance {
76
- logoUri: string;
77
- utxos: BitcoinInputUTXOWithOptionalScript[];
78
- utxosUnconfirmed?: BitcoinInputUTXOWithOptionalScript[];
79
- unconfirmedBalance?: BN;
80
- unconfirmedBalanceDisplayValue?: string;
81
- unconfirmedBalanceCurrencyDisplayValue?: string;
82
- unconfirmedBalanceInCurrency?: number;
83
- }
84
-
85
- /**
86
- * Avalanche TokenWithBalance interface.
87
- */
88
- export interface TokenWithBalancePVM extends NetworkTokenWithBalance {
89
- available?: BN;
90
- availableInCurrency?: number;
91
- availableDisplayValue?: string;
92
- availableCurrencyDisplayValue?: string;
93
- utxos?: PChainBalance;
94
- balancePerType: {
95
- lockedStaked: number;
96
- lockedStakeable: number;
97
- lockedPlatform: number;
98
- atomicMemoryLocked: number;
99
- atomicMemoryUnlocked: number;
100
- unlockedUnstaked: number;
101
- unlockedStaked: number;
102
- pendingStaked: number;
103
- };
104
- }
105
-
106
- export interface TokenWithBalanceAVM extends NetworkTokenWithBalance {
107
- available?: BN;
108
- availableInCurrency?: number;
109
- availableDisplayValue?: string;
110
- availableCurrencyDisplayValue?: string;
111
- utxos?: XChainBalances;
112
- balancePerType: {
113
- locked: number;
114
- unlocked: number;
115
- atomicMemoryUnlocked: number;
116
- atomicMemoryLocked: number;
117
- };
118
- }
119
-
120
- export interface NftTokenWithBalance extends Omit<NetworkTokenWithBalance, 'type'> {
121
- type: TokenType.ERC721 | TokenType.ERC1155;
122
- address: string;
123
- description: string;
124
- logoUri: string;
125
- logoSmall: string;
126
- name: string;
127
- symbol: string;
128
- tokenId: string;
129
- attributes: TokenAttribute[];
130
- collectionName: string;
131
- updatedAt?: number;
132
- }
133
-
134
- export interface TokenAttribute {
135
- name: string;
136
- value: string;
137
- }
138
-
139
- export type TokenWithBalance =
140
- | TokenWithBalanceEVM
141
- | TokenWithBalanceBTC
142
- | TokenWithBalancePVM
143
- | TokenWithBalanceAVM
144
- | NftTokenWithBalance;
145
-
146
- export type GetBalancesResponse = Record<string, Record<string, TokenWithBalance>>;
package/src/coingecko.ts DELETED
@@ -1,15 +0,0 @@
1
- import { number, object, record, z } from 'zod';
2
-
3
- const SimplePriceInCurrency = object({
4
- price: number().optional().nullable(),
5
- change24: number().optional().nullable(),
6
- marketCap: number().optional().nullable(),
7
- vol24: number().optional().nullable(),
8
- });
9
-
10
- const SimplePriceInCurrencyResponseSchema = record(SimplePriceInCurrency);
11
- export const SimplePriceResponseSchema = record(SimplePriceInCurrencyResponseSchema);
12
- export type SimplePriceResponse = z.infer<typeof SimplePriceResponseSchema>;
13
-
14
- export const RawSimplePriceResponseSchema = record(record(number().nullable().optional()));
15
- export type RawSimplePriceResponse = z.infer<typeof RawSimplePriceResponseSchema>;
package/src/common.ts DELETED
@@ -1,43 +0,0 @@
1
- import type { NetworkToken } from './token';
2
-
3
- export type Network = {
4
- isTestnet?: boolean;
5
- chainId: number;
6
- chainName: string;
7
- rpcUrl: string;
8
- utilityAddresses?: {
9
- multicall: string;
10
- };
11
- networkToken: NetworkToken;
12
- pricingProviders?: {
13
- coingecko: {
14
- assetPlatformId?: string;
15
- nativeTokenId?: string;
16
- };
17
- };
18
- explorerUrl?: string;
19
- logoUri?: string;
20
- vmName: NetworkVMType;
21
- };
22
-
23
- export enum NetworkVMType {
24
- EVM = 'EVM',
25
- BITCOIN = 'BITCOIN',
26
- AVM = 'AVM',
27
- PVM = 'PVM',
28
- CoreEth = 'CoreEth',
29
- }
30
-
31
- export type Storage = {
32
- get: <T>(id: string) => T | undefined;
33
- set: <T>(id: string, data: T) => void;
34
- };
35
-
36
- export type Caip2ChainId = string;
37
-
38
- export type Hex = `0x${string}`;
39
-
40
- export enum Environment {
41
- PRODUCTION = 'production',
42
- DEV = 'dev',
43
- }
package/src/index.ts DELETED
@@ -1,10 +0,0 @@
1
- export * from './common';
2
- export * from './coingecko';
3
- export * from './balance';
4
- export * from './manifest';
5
- export * from './module';
6
- export * from './network-fee';
7
- export * from './rpc';
8
- export * from './token';
9
- export * from './transaction-history';
10
- export * from './transaction-simulation';
package/src/manifest.ts DELETED
@@ -1,40 +0,0 @@
1
- import { boolean, object, string, z } from 'zod';
2
-
3
- const sourceSchema = object({
4
- checksum: string(),
5
- location: object({
6
- npm: object({
7
- filePath: string(),
8
- packageName: string(),
9
- registry: string(),
10
- }),
11
- }),
12
- });
13
-
14
- const 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
- }),
32
- }),
33
- manifestVersion: string(),
34
- });
35
-
36
- export type Manifest = z.infer<typeof manifestSchema>;
37
-
38
- export const parseManifest = (params: unknown): z.SafeParseReturnType<unknown, Manifest> => {
39
- return manifestSchema.safeParse(params);
40
- };
package/src/module.ts DELETED
@@ -1,17 +0,0 @@
1
- import type { GetBalancesParams, GetBalancesResponse } from './balance';
2
- import type { Network } from './common';
3
- import type { Manifest } from './manifest';
4
- import type { NetworkFees } from './network-fee';
5
- import type { RpcRequest, RpcResponse } from './rpc';
6
- import type { NetworkContractToken } from './token';
7
- import type { GetTransactionHistory, TransactionHistoryResponse } from './transaction-history';
8
-
9
- export interface Module {
10
- getManifest: () => Manifest | undefined;
11
- getBalances: (params: GetBalancesParams) => Promise<GetBalancesResponse>;
12
- getTransactionHistory: (params: GetTransactionHistory) => Promise<TransactionHistoryResponse>;
13
- getNetworkFee: (network: Network) => Promise<NetworkFees>;
14
- getAddress: () => Promise<string>;
15
- getTokens: (network: Network) => Promise<NetworkContractToken[]>;
16
- onRpcRequest: (request: RpcRequest, chain: Network) => Promise<RpcResponse>;
17
- }
@@ -1,7 +0,0 @@
1
- export type NetworkFees = {
2
- low: { maxFeePerGas: bigint; maxPriorityFeePerGas?: bigint };
3
- medium: { maxFeePerGas: bigint; maxPriorityFeePerGas?: bigint };
4
- high: { maxFeePerGas: bigint; maxPriorityFeePerGas?: bigint };
5
- baseFee?: bigint;
6
- isFixedFee: boolean;
7
- };