@0xtorch/evm 0.0.29 → 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 +4 -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 +2 -1
- package/_cjs/decoder/decode.js.map +1 -1
- package/_cjs/decoder/parseErc1155TransferSingleLogs.js +2 -1
- package/_cjs/decoder/parseErc1155TransferSingleLogs.js.map +1 -1
- package/_cjs/decoder/parseErc721TransferLogs.js +2 -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 +5 -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 +3 -2
- package/_esm/decoder/decode.js.map +1 -1
- package/_esm/decoder/parseErc1155TransferSingleLogs.js +3 -2
- package/_esm/decoder/parseErc1155TransferSingleLogs.js.map +1 -1
- package/_esm/decoder/parseErc721TransferLogs.js +3 -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/decoder/parseErc1155TransferSingleLogs.d.ts.map +1 -1
- package/_types/decoder/parseErc721TransferLogs.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 +6 -2
- package/analyzer/json/schemas/generator.ts +1 -0
- package/decoder/decode.ts +3 -2
- package/decoder/parseErc1155TransferSingleLogs.ts +3 -2
- package/decoder/parseErc721TransferLogs.ts +3 -2
- package/index.ts +6 -1
- package/package.json +2 -2
- 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/_types/utils/create.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Hex, LowerHex } from '../types';
|
|
1
|
+
import type { Erc1155NftId, Erc721NftId, Hex, LowerHex } from '../types';
|
|
2
2
|
type CreateEvmAddressIdParameters = {
|
|
3
3
|
readonly chainId: number;
|
|
4
4
|
readonly address: LowerHex;
|
|
@@ -17,11 +17,18 @@ export declare const createEvmCurrencyId: ({ chainId, address, }: {
|
|
|
17
17
|
readonly chainId: number;
|
|
18
18
|
readonly address: LowerHex;
|
|
19
19
|
}) => `evm_${number}_0x${Lowercase<string>}`;
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const createErc721NftId: ({ chainId, address, tokenId, }: {
|
|
21
21
|
readonly chainId: number;
|
|
22
22
|
readonly address: LowerHex;
|
|
23
23
|
tokenId: bigint;
|
|
24
|
-
}) =>
|
|
24
|
+
}) => Erc721NftId;
|
|
25
|
+
export declare const isErc721NftId: (value: string) => value is `evm_721_${number}_0x${Lowercase<string>}_${bigint}`;
|
|
26
|
+
export declare const createErc1155NftId: ({ chainId, address, tokenId, }: {
|
|
27
|
+
readonly chainId: number;
|
|
28
|
+
readonly address: LowerHex;
|
|
29
|
+
tokenId: bigint;
|
|
30
|
+
}) => Erc1155NftId;
|
|
31
|
+
export declare const isErc1155NftId: (value: string) => value is `evm_1155_${number}_0x${Lowercase<string>}_${bigint}`;
|
|
25
32
|
export declare const getEvmAddressDataOfEvmAddressId: (id: string) => GetEvmAddressDataOfEvmAddressIdReturnType;
|
|
26
33
|
type IncludesEvmAddressIdParameters = {
|
|
27
34
|
readonly addresses: readonly LowerHex[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../utils/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../utils/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGxE,KAAK,4BAA4B,GAAG;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,kBAAkB,0BAG5B,4BAA4B,WAAwC,CAAA;AAEvE,KAAK,+BAA+B,GAAG;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,eAAe,EAAE,GAAG,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,qBAAqB,kCAG/B,+BAA+B,WACe,CAAA;AAEjD,KAAK,yCAAyC,GAAG;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,mBAAmB;sBAIZ,MAAM;sBACN,QAAQ;MACxB,OAAO,MAAM,MAAM,UAAU,MAAM,CAAC,EAAiC,CAAA;AAEzE,eAAO,MAAM,iBAAiB;sBAKV,MAAM;sBACN,QAAQ;aACjB,MAAM;MACb,WAAyD,CAAA;AAE7D,eAAO,MAAM,aAAa,UAAW,MAAM,kEACO,CAAA;AAElD,eAAO,MAAM,kBAAkB;sBAKX,MAAM;sBACN,QAAQ;aACjB,MAAM;MACb,YAA2D,CAAA;AAE/D,eAAO,MAAM,cAAc,UAAW,MAAM,mEACO,CAAA;AAEnD,eAAO,MAAM,+BAA+B,OACtC,MAAM,KACT,yCASF,CAAA;AAED,KAAK,8BAA8B,GAAG;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAA;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,oBAAoB,uBAG9B,8BAA8B,YAMhC,CAAA"}
|
package/_types/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { bigIntMax, bigIntMin } from './bigint';
|
|
2
|
-
export { createEvmActionSource, createEvmAddressId, createEvmCurrencyId,
|
|
2
|
+
export { createErc1155NftId, createErc721NftId, createEvmActionSource, createEvmAddressId, createEvmCurrencyId, isErc1155NftId, isErc721NftId, } from './create';
|
|
3
3
|
export { checkTimeout } from './timeout';
|
|
4
4
|
export type { Prettify } from './types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,aAAa,GACd,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -2,7 +2,7 @@ import type { CryptoCurrencyPrice, Nft } from '@0xtorch/core'
|
|
|
2
2
|
import type { Chain } from '../../../chains'
|
|
3
3
|
import type { LowerHex, TransactionDecoded } from '../../../types'
|
|
4
4
|
import { isHex, toLowerHex } from '../../../types'
|
|
5
|
-
import {
|
|
5
|
+
import { createErc1155NftId, createErc721NftId } from '../../../utils'
|
|
6
6
|
import type { Target, TargetAssetComponent } from '../types'
|
|
7
7
|
import { getErc1155Component } from './erc1155'
|
|
8
8
|
import { getLogArgumentComponent } from './logArgument'
|
|
@@ -124,11 +124,15 @@ export const createTargetAssetByTargetAssetComponent = <
|
|
|
124
124
|
}
|
|
125
125
|
return {
|
|
126
126
|
type: 'Nft',
|
|
127
|
-
id:
|
|
127
|
+
id:
|
|
128
|
+
component.tokenType === 'erc721'
|
|
129
|
+
? createErc721NftId({ chainId: chain.id, address, tokenId })
|
|
130
|
+
: createErc1155NftId({ chainId: chain.id, address, tokenId }),
|
|
128
131
|
name: undefined,
|
|
129
132
|
symbol: undefined,
|
|
130
133
|
image: undefined,
|
|
131
134
|
metadata: undefined,
|
|
135
|
+
updatedAt: 0,
|
|
132
136
|
}
|
|
133
137
|
}
|
|
134
138
|
}
|
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,
|
|
@@ -288,6 +288,7 @@ const getErcTransfers = (
|
|
|
288
288
|
symbol: undefined,
|
|
289
289
|
image: undefined,
|
|
290
290
|
metadata: undefined,
|
|
291
|
+
updatedAt: 0,
|
|
291
292
|
},
|
|
292
293
|
}),
|
|
293
294
|
),
|
|
@@ -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,
|
|
@@ -44,6 +44,7 @@ export const parseErc1155TransferSingleLogs = (
|
|
|
44
44
|
symbol: undefined,
|
|
45
45
|
image: undefined,
|
|
46
46
|
metadata: undefined,
|
|
47
|
+
updatedAt: 0,
|
|
47
48
|
},
|
|
48
49
|
}
|
|
49
50
|
})
|
|
@@ -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,
|
|
@@ -44,6 +44,7 @@ export const parseErc721TransferLogs = (
|
|
|
44
44
|
symbol: undefined,
|
|
45
45
|
image: undefined,
|
|
46
46
|
metadata: undefined,
|
|
47
|
+
updatedAt: 0,
|
|
47
48
|
},
|
|
48
49
|
}
|
|
49
50
|
})
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xtorch/evm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"description": "Cryptorch EVM extension",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cryptorch",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@0xtorch/big-decimal": "^0.0.10",
|
|
41
|
-
"@0xtorch/core": "^0.0.
|
|
41
|
+
"@0xtorch/core": "^0.0.28",
|
|
42
42
|
"@supercharge/promise-pool": "^3.1.1",
|
|
43
43
|
"viem": "^2.9.16",
|
|
44
44
|
"zod": "^3.22.4"
|
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'
|