@0xtorch/evm 0.0.30 → 0.0.31
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/_cjs/analyzer/json/components/targetAsset.js +3 -1
- package/_cjs/analyzer/json/components/targetAsset.js.map +1 -1
- package/_cjs/analyzer/json/schemas/generator.js +1 -0
- package/_cjs/analyzer/json/schemas/generator.js.map +1 -1
- package/_cjs/decoder/decode.js +1 -1
- package/_cjs/decoder/decode.js.map +1 -1
- package/_cjs/decoder/parseErc1155TransferSingleLogs.js +1 -1
- package/_cjs/decoder/parseErc1155TransferSingleLogs.js.map +1 -1
- package/_cjs/decoder/parseErc721TransferLogs.js +1 -1
- package/_cjs/decoder/parseErc721TransferLogs.js.map +1 -1
- package/_cjs/index.js +5 -2
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/create.js +9 -3
- package/_cjs/utils/create.js.map +1 -1
- package/_cjs/utils/index.js +5 -2
- package/_cjs/utils/index.js.map +1 -1
- package/_esm/analyzer/json/components/targetAsset.js +4 -2
- package/_esm/analyzer/json/components/targetAsset.js.map +1 -1
- package/_esm/analyzer/json/schemas/generator.js +1 -0
- package/_esm/analyzer/json/schemas/generator.js.map +1 -1
- package/_esm/decoder/decode.js +2 -2
- package/_esm/decoder/decode.js.map +1 -1
- package/_esm/decoder/parseErc1155TransferSingleLogs.js +2 -2
- package/_esm/decoder/parseErc1155TransferSingleLogs.js.map +1 -1
- package/_esm/decoder/parseErc721TransferLogs.js +2 -2
- package/_esm/decoder/parseErc721TransferLogs.js.map +1 -1
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/utils/create.js +4 -1
- package/_esm/utils/create.js.map +1 -1
- package/_esm/utils/index.js +1 -1
- package/_esm/utils/index.js.map +1 -1
- package/_types/analyzer/json/components/targetAsset.d.ts.map +1 -1
- package/_types/analyzer/json/schemas/generator.d.ts +3 -0
- package/_types/analyzer/json/schemas/generator.d.ts.map +1 -1
- package/_types/index.d.ts +2 -2
- package/_types/index.d.ts.map +1 -1
- package/_types/types/erc1155.d.ts +1 -0
- package/_types/types/erc1155.d.ts.map +1 -1
- package/_types/types/erc721.d.ts +1 -0
- package/_types/types/erc721.d.ts.map +1 -1
- package/_types/types/index.d.ts +2 -2
- package/_types/types/index.d.ts.map +1 -1
- package/_types/utils/create.d.ts +10 -3
- package/_types/utils/create.d.ts.map +1 -1
- package/_types/utils/index.d.ts +1 -1
- package/_types/utils/index.d.ts.map +1 -1
- package/analyzer/json/components/targetAsset.ts +5 -2
- package/analyzer/json/schemas/generator.ts +1 -0
- package/decoder/decode.ts +2 -2
- package/decoder/parseErc1155TransferSingleLogs.ts +2 -2
- package/decoder/parseErc721TransferLogs.ts +2 -2
- package/index.ts +6 -1
- package/package.json +1 -1
- package/types/erc1155.ts +2 -0
- package/types/erc721.ts +2 -0
- package/types/index.ts +2 -2
- package/utils/create.ts +19 -4
- package/utils/index.ts +4 -1
package/decoder/decode.ts
CHANGED
|
@@ -23,7 +23,7 @@ import type {
|
|
|
23
23
|
TransactionDecoded,
|
|
24
24
|
} from '../types'
|
|
25
25
|
import { parsedLogSchema, toLowerHex } from '../types'
|
|
26
|
-
import { checkTimeout,
|
|
26
|
+
import { checkTimeout, createErc1155NftId, createEvmCurrencyId } from '../utils'
|
|
27
27
|
import { parseErc1155TransferSingleLogs } from './parseErc1155TransferSingleLogs'
|
|
28
28
|
import { parseErc20TransferLogs } from './parseErc20TransferLogs'
|
|
29
29
|
import { parseErc721TransferLogs } from './parseErc721TransferLogs'
|
|
@@ -279,7 +279,7 @@ const getErcTransfers = (
|
|
|
279
279
|
value: log.args.values[index],
|
|
280
280
|
nft: {
|
|
281
281
|
type: 'Nft',
|
|
282
|
-
id:
|
|
282
|
+
id: createErc1155NftId({
|
|
283
283
|
chainId: chain.id,
|
|
284
284
|
address: toLowerHex(log.address),
|
|
285
285
|
tokenId: id,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Log } from 'viem'
|
|
2
2
|
import type { Erc1155Transfer } from '../types'
|
|
3
3
|
import { toLowerHex } from '../types'
|
|
4
|
-
import {
|
|
4
|
+
import { createErc1155NftId } from '../utils'
|
|
5
5
|
|
|
6
6
|
const transferSingleSignature =
|
|
7
7
|
'0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62'
|
|
@@ -35,7 +35,7 @@ export const parseErc1155TransferSingleLogs = (
|
|
|
35
35
|
value: BigInt(`0x${log.data.slice(66, 130)}`),
|
|
36
36
|
nft: {
|
|
37
37
|
type: 'Nft',
|
|
38
|
-
id:
|
|
38
|
+
id: createErc1155NftId({
|
|
39
39
|
chainId,
|
|
40
40
|
address: toLowerHex(log.address),
|
|
41
41
|
tokenId: id,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Log } from 'viem'
|
|
2
2
|
import type { Erc721Transfer, LowerHex } from '../types'
|
|
3
3
|
import { toLowerHex } from '../types'
|
|
4
|
-
import {
|
|
4
|
+
import { createErc721NftId } from '../utils'
|
|
5
5
|
|
|
6
6
|
const signature =
|
|
7
7
|
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
|
|
@@ -35,7 +35,7 @@ export const parseErc721TransferLogs = (
|
|
|
35
35
|
tokenId,
|
|
36
36
|
nft: {
|
|
37
37
|
type: 'Nft',
|
|
38
|
-
id:
|
|
38
|
+
id: createErc721NftId({
|
|
39
39
|
chainId,
|
|
40
40
|
address: toLowerHex(log.address),
|
|
41
41
|
tokenId,
|
package/index.ts
CHANGED
|
@@ -103,10 +103,12 @@ export {
|
|
|
103
103
|
} from './getTransactionFull'
|
|
104
104
|
export { isHex, parsedLogSchema, toLowerHex } from './types'
|
|
105
105
|
export type {
|
|
106
|
+
Erc1155NftId,
|
|
106
107
|
Erc1155Token,
|
|
107
108
|
Erc1155Transfer,
|
|
108
109
|
Erc20Token,
|
|
109
110
|
Erc20Transfer,
|
|
111
|
+
Erc721NftId,
|
|
110
112
|
Erc721Token,
|
|
111
113
|
Erc721Transfer,
|
|
112
114
|
EvmAccount,
|
|
@@ -121,8 +123,11 @@ export type {
|
|
|
121
123
|
TransactionSource,
|
|
122
124
|
} from './types'
|
|
123
125
|
export {
|
|
126
|
+
createErc1155NftId,
|
|
127
|
+
createErc721NftId,
|
|
124
128
|
createEvmActionSource,
|
|
125
129
|
createEvmAddressId,
|
|
126
130
|
createEvmCurrencyId,
|
|
127
|
-
|
|
131
|
+
isErc1155NftId,
|
|
132
|
+
isErc721NftId,
|
|
128
133
|
} from './utils'
|
package/package.json
CHANGED
package/types/erc1155.ts
CHANGED
package/types/erc721.ts
CHANGED
package/types/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type { Erc1155Token, Erc1155Transfer } from './erc1155'
|
|
1
|
+
export type { Erc1155NftId, Erc1155Token, Erc1155Transfer } from './erc1155'
|
|
2
2
|
export type { Erc20Token, Erc20Transfer } from './erc20'
|
|
3
|
-
export type { Erc721Token, Erc721Transfer } from './erc721'
|
|
3
|
+
export type { Erc721NftId, Erc721Token, Erc721Transfer } from './erc721'
|
|
4
4
|
export type { EvmAccount } from './evmAccount'
|
|
5
5
|
export { isHex, toLowerHex } from './hex'
|
|
6
6
|
export type { Hex, LowerHex } from './hex'
|
package/utils/create.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Hex, LowerHex } from '../types'
|
|
1
|
+
import type { Erc1155NftId, Erc721NftId, Hex, LowerHex } from '../types'
|
|
2
2
|
import { isHex, toLowerHex } from '../types'
|
|
3
3
|
|
|
4
4
|
type CreateEvmAddressIdParameters = {
|
|
@@ -35,7 +35,7 @@ export const createEvmCurrencyId = ({
|
|
|
35
35
|
readonly address: LowerHex
|
|
36
36
|
}): `evm_${number}_0x${Lowercase<string>}` => `evm_${chainId}_${address}`
|
|
37
37
|
|
|
38
|
-
export const
|
|
38
|
+
export const createErc721NftId = ({
|
|
39
39
|
chainId,
|
|
40
40
|
address,
|
|
41
41
|
tokenId,
|
|
@@ -43,8 +43,23 @@ export const createEvmNftId = ({
|
|
|
43
43
|
readonly chainId: number
|
|
44
44
|
readonly address: LowerHex
|
|
45
45
|
tokenId: bigint
|
|
46
|
-
}): `
|
|
47
|
-
|
|
46
|
+
}): Erc721NftId => `evm_721_${chainId}_${address}_${tokenId}`
|
|
47
|
+
|
|
48
|
+
export const isErc721NftId = (value: string): value is Erc721NftId =>
|
|
49
|
+
/^evm_721_\d+_0x[\dA-Fa-f]{40}_\d+$/.test(value)
|
|
50
|
+
|
|
51
|
+
export const createErc1155NftId = ({
|
|
52
|
+
chainId,
|
|
53
|
+
address,
|
|
54
|
+
tokenId,
|
|
55
|
+
}: {
|
|
56
|
+
readonly chainId: number
|
|
57
|
+
readonly address: LowerHex
|
|
58
|
+
tokenId: bigint
|
|
59
|
+
}): Erc1155NftId => `evm_1155_${chainId}_${address}_${tokenId}`
|
|
60
|
+
|
|
61
|
+
export const isErc1155NftId = (value: string): value is Erc1155NftId =>
|
|
62
|
+
/^evm_1155_\d+_0x[\dA-Fa-f]{40}_\d+$/.test(value)
|
|
48
63
|
|
|
49
64
|
export const getEvmAddressDataOfEvmAddressId = (
|
|
50
65
|
id: string,
|
package/utils/index.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { bigIntMax, bigIntMin } from './bigint'
|
|
2
2
|
export {
|
|
3
|
+
createErc1155NftId,
|
|
4
|
+
createErc721NftId,
|
|
3
5
|
createEvmActionSource,
|
|
4
6
|
createEvmAddressId,
|
|
5
7
|
createEvmCurrencyId,
|
|
6
|
-
|
|
8
|
+
isErc1155NftId,
|
|
9
|
+
isErc721NftId,
|
|
7
10
|
} from './create'
|
|
8
11
|
export { checkTimeout } from './timeout'
|
|
9
12
|
export type { Prettify } from './types'
|