@metamask-previews/transaction-controller 43.0.0-preview-009eef6b → 43.0.0-preview-455ba549
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/dist/constants.cjs +71 -1
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +35 -0
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +35 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +70 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/helpers/MethodDataHelper.cjs +2 -71
- package/dist/helpers/MethodDataHelper.cjs.map +1 -1
- package/dist/helpers/MethodDataHelper.d.cts.map +1 -1
- package/dist/helpers/MethodDataHelper.d.mts.map +1 -1
- package/dist/helpers/MethodDataHelper.mjs +2 -71
- package/dist/helpers/MethodDataHelper.mjs.map +1 -1
- package/package.json +1 -1
package/dist/constants.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ABI_SIMULATION_ERC721_LEGACY = exports.ABI_SIMULATION_ERC20_WRAPPED = exports.GAS_BUFFER_CHAIN_OVERRIDES = exports.CHAIN_IDS = void 0;
|
|
3
|
+
exports.METHOD_REGISTRY_ABI = exports.ABI_SIMULATION_ERC721_LEGACY = exports.ABI_SIMULATION_ERC20_WRAPPED = exports.GAS_BUFFER_CHAIN_OVERRIDES = exports.CHAIN_IDS = void 0;
|
|
4
4
|
exports.CHAIN_IDS = {
|
|
5
5
|
MAINNET: '0x1',
|
|
6
6
|
GOERLI: '0x5',
|
|
@@ -83,4 +83,74 @@ exports.ABI_SIMULATION_ERC721_LEGACY = [
|
|
|
83
83
|
type: 'event',
|
|
84
84
|
},
|
|
85
85
|
];
|
|
86
|
+
exports.METHOD_REGISTRY_ABI = [
|
|
87
|
+
{
|
|
88
|
+
constant: false,
|
|
89
|
+
inputs: [{ name: '_new', type: 'address' }],
|
|
90
|
+
name: 'setOwner',
|
|
91
|
+
outputs: [],
|
|
92
|
+
payable: false,
|
|
93
|
+
type: 'function',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
constant: true,
|
|
97
|
+
inputs: [],
|
|
98
|
+
name: 'totalSignatures',
|
|
99
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
100
|
+
payable: false,
|
|
101
|
+
type: 'function',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
constant: true,
|
|
105
|
+
inputs: [],
|
|
106
|
+
name: 'owner',
|
|
107
|
+
outputs: [{ name: '', type: 'address' }],
|
|
108
|
+
payable: false,
|
|
109
|
+
type: 'function',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
constant: false,
|
|
113
|
+
inputs: [],
|
|
114
|
+
name: 'drain',
|
|
115
|
+
outputs: [],
|
|
116
|
+
payable: false,
|
|
117
|
+
type: 'function',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
constant: true,
|
|
121
|
+
inputs: [{ name: '', type: 'bytes4' }],
|
|
122
|
+
name: 'entries',
|
|
123
|
+
outputs: [{ name: '', type: 'string' }],
|
|
124
|
+
payable: false,
|
|
125
|
+
type: 'function',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
constant: false,
|
|
129
|
+
inputs: [{ name: '_method', type: 'string' }],
|
|
130
|
+
name: 'register',
|
|
131
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
132
|
+
payable: false,
|
|
133
|
+
type: 'function',
|
|
134
|
+
},
|
|
135
|
+
{ inputs: [], type: 'constructor' },
|
|
136
|
+
{
|
|
137
|
+
anonymous: false,
|
|
138
|
+
inputs: [
|
|
139
|
+
{ indexed: true, name: 'creator', type: 'address' },
|
|
140
|
+
{ indexed: true, name: 'signature', type: 'bytes4' },
|
|
141
|
+
{ indexed: false, name: 'method', type: 'string' },
|
|
142
|
+
],
|
|
143
|
+
name: 'Registered',
|
|
144
|
+
type: 'event',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
anonymous: false,
|
|
148
|
+
inputs: [
|
|
149
|
+
{ indexed: true, name: 'old', type: 'address' },
|
|
150
|
+
{ indexed: true, name: 'current', type: 'address' },
|
|
151
|
+
],
|
|
152
|
+
name: 'NewOwner',
|
|
153
|
+
type: 'event',
|
|
154
|
+
},
|
|
155
|
+
];
|
|
86
156
|
//# sourceMappingURL=constants.cjs.map
|
package/dist/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACvB,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,SAAS;IACvB,GAAG,EAAE,MAAM;IACX,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,OAAO;IACzB,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,QAAQ;IACvB,gBAAgB,EAAE,UAAU;IAC5B,OAAO,EAAE,MAAM;IACf,eAAe,EAAE,SAAS;IAC1B,SAAS,EAAE,QAAQ;IACnB,iBAAiB,EAAE,QAAQ;IAC3B,MAAM,EAAE,MAAM;IACd,cAAc,EAAE,OAAO;IACvB,OAAO,EAAE,UAAU;IACnB,YAAY,EAAE,QAAQ;IACtB,aAAa,EAAE,QAAQ;IACvB,aAAa,EAAE,QAAQ;IACvB,QAAQ,EAAE,OAAO;IACjB,gBAAgB,EAAE,OAAO;IACzB,SAAS,EAAE,OAAO;IAClB,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,OAAO;IACnB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,SAAS;IACjB,cAAc,EAAE,SAAS;CACjB,CAAC;AAEE,QAAA,0BAA0B,GAAG;IACxC,CAAC,iBAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;IACvB,CAAC,iBAAS,CAAC,gBAAgB,CAAC,EAAE,CAAC;CAChC,CAAC;AAEF,iEAAiE;AACpD,QAAA,4BAA4B,GAAG;IAC1C;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;YAC9C,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;SACjD;QACD,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;YAChD,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;SACjD;QACD,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,OAAO;KACd;CACF,CAAC;AAEF,iEAAiE;AACpD,QAAA,4BAA4B,GAAG;IAC1C;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;CACF,CAAC","sourcesContent":["export const CHAIN_IDS = {\n MAINNET: '0x1',\n GOERLI: '0x5',\n BASE: '0x2105',\n BASE_TESTNET: '0x14a33',\n BSC: '0x38',\n BSC_TESTNET: '0x61',\n OPTIMISM: '0xa',\n OPTIMISM_TESTNET: '0x1a4',\n OPBNB: '0xcc',\n OPBNB_TESTNET: '0x15eb',\n OPTIMISM_SEPOLIA: '0xaa37dc',\n POLYGON: '0x89',\n POLYGON_TESTNET: '0x13881',\n AVALANCHE: '0xa86a',\n AVALANCHE_TESTNET: '0xa869',\n FANTOM: '0xfa',\n FANTOM_TESTNET: '0xfa2',\n SEPOLIA: '0xaa36a7',\n LINEA_GOERLI: '0xe704',\n LINEA_SEPOLIA: '0xe705',\n LINEA_MAINNET: '0xe708',\n MOONBEAM: '0x504',\n MOONBEAM_TESTNET: '0x507',\n MOONRIVER: '0x505',\n GNOSIS: '0x64',\n ARBITRUM: '0xa4b1',\n ZKSYNC_ERA: '0x144',\n ZORA: '0x76adf1',\n SCROLL: '0x82750',\n SCROLL_SEPOLIA: '0x8274f',\n} as const;\n\nexport const GAS_BUFFER_CHAIN_OVERRIDES = {\n [CHAIN_IDS.OPTIMISM]: 1,\n [CHAIN_IDS.OPTIMISM_SEPOLIA]: 1,\n};\n\n/** Extract of the Wrapped ERC-20 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC20_WRAPPED = [\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'to', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Deposit',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'from', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Withdrawal',\n type: 'event',\n },\n];\n\n/** Extract of the legacy ERC-721 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC721_LEGACY = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n name: '_from',\n type: 'address',\n },\n {\n indexed: false,\n name: '_to',\n type: 'address',\n },\n {\n indexed: false,\n name: '_tokenId',\n type: 'uint256',\n },\n ],\n name: 'Transfer',\n type: 'event',\n },\n];\n"]}
|
|
1
|
+
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"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,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;YAC/C,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SACpD;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;CACF,CAAC","sourcesContent":["export const CHAIN_IDS = {\n MAINNET: '0x1',\n GOERLI: '0x5',\n BASE: '0x2105',\n BASE_TESTNET: '0x14a33',\n BSC: '0x38',\n BSC_TESTNET: '0x61',\n OPTIMISM: '0xa',\n OPTIMISM_TESTNET: '0x1a4',\n OPBNB: '0xcc',\n OPBNB_TESTNET: '0x15eb',\n OPTIMISM_SEPOLIA: '0xaa37dc',\n POLYGON: '0x89',\n POLYGON_TESTNET: '0x13881',\n AVALANCHE: '0xa86a',\n AVALANCHE_TESTNET: '0xa869',\n FANTOM: '0xfa',\n FANTOM_TESTNET: '0xfa2',\n SEPOLIA: '0xaa36a7',\n LINEA_GOERLI: '0xe704',\n LINEA_SEPOLIA: '0xe705',\n LINEA_MAINNET: '0xe708',\n MOONBEAM: '0x504',\n MOONBEAM_TESTNET: '0x507',\n MOONRIVER: '0x505',\n GNOSIS: '0x64',\n ARBITRUM: '0xa4b1',\n ZKSYNC_ERA: '0x144',\n ZORA: '0x76adf1',\n SCROLL: '0x82750',\n SCROLL_SEPOLIA: '0x8274f',\n} as const;\n\nexport const GAS_BUFFER_CHAIN_OVERRIDES = {\n [CHAIN_IDS.OPTIMISM]: 1,\n [CHAIN_IDS.OPTIMISM_SEPOLIA]: 1,\n};\n\n/** Extract of the Wrapped ERC-20 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC20_WRAPPED = [\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'to', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Deposit',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'from', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Withdrawal',\n type: 'event',\n },\n];\n\n/** Extract of the legacy ERC-721 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC721_LEGACY = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n name: '_from',\n type: 'address',\n },\n {\n indexed: false,\n name: '_to',\n type: 'address',\n },\n {\n indexed: false,\n name: '_tokenId',\n type: 'uint256',\n },\n ],\n name: 'Transfer',\n type: 'event',\n },\n];\n\nexport const METHOD_REGISTRY_ABI = [\n {\n constant: false,\n inputs: [{ name: '_new', type: 'address' }],\n name: 'setOwner',\n outputs: [],\n payable: false,\n type: 'function',\n },\n {\n constant: true,\n inputs: [],\n name: 'totalSignatures',\n outputs: [{ name: '', type: 'uint256' }],\n payable: false,\n type: 'function',\n },\n {\n constant: true,\n inputs: [],\n name: 'owner',\n outputs: [{ name: '', type: 'address' }],\n payable: false,\n type: 'function',\n },\n {\n constant: false,\n inputs: [],\n name: 'drain',\n outputs: [],\n payable: false,\n type: 'function',\n },\n {\n constant: true,\n inputs: [{ name: '', type: 'bytes4' }],\n name: 'entries',\n outputs: [{ name: '', type: 'string' }],\n payable: false,\n type: 'function',\n },\n {\n constant: false,\n inputs: [{ name: '_method', type: 'string' }],\n name: 'register',\n outputs: [{ name: '', type: 'bool' }],\n payable: false,\n type: 'function',\n },\n { inputs: [], type: 'constructor' },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'creator', type: 'address' },\n { indexed: true, name: 'signature', type: 'bytes4' },\n { indexed: false, name: 'method', type: 'string' },\n ],\n name: 'Registered',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'old', type: 'address' },\n { indexed: true, name: 'current', type: 'address' },\n ],\n name: 'NewOwner',\n type: 'event',\n },\n];\n"]}
|
package/dist/constants.d.cts
CHANGED
|
@@ -56,4 +56,39 @@ export declare const ABI_SIMULATION_ERC721_LEGACY: {
|
|
|
56
56
|
name: string;
|
|
57
57
|
type: string;
|
|
58
58
|
}[];
|
|
59
|
+
export declare const METHOD_REGISTRY_ABI: ({
|
|
60
|
+
constant: boolean;
|
|
61
|
+
inputs: {
|
|
62
|
+
name: string;
|
|
63
|
+
type: string;
|
|
64
|
+
}[];
|
|
65
|
+
name: string;
|
|
66
|
+
outputs: {
|
|
67
|
+
name: string;
|
|
68
|
+
type: string;
|
|
69
|
+
}[];
|
|
70
|
+
payable: boolean;
|
|
71
|
+
type: string;
|
|
72
|
+
anonymous?: undefined;
|
|
73
|
+
} | {
|
|
74
|
+
inputs: never[];
|
|
75
|
+
type: string;
|
|
76
|
+
constant?: undefined;
|
|
77
|
+
name?: undefined;
|
|
78
|
+
outputs?: undefined;
|
|
79
|
+
payable?: undefined;
|
|
80
|
+
anonymous?: undefined;
|
|
81
|
+
} | {
|
|
82
|
+
anonymous: boolean;
|
|
83
|
+
inputs: {
|
|
84
|
+
indexed: boolean;
|
|
85
|
+
name: string;
|
|
86
|
+
type: string;
|
|
87
|
+
}[];
|
|
88
|
+
name: string;
|
|
89
|
+
type: string;
|
|
90
|
+
constant?: undefined;
|
|
91
|
+
outputs?: undefined;
|
|
92
|
+
payable?: undefined;
|
|
93
|
+
})[];
|
|
59
94
|
//# sourceMappingURL=constants.d.cts.map
|
package/dist/constants.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BZ,CAAC;AAEX,eAAO,MAAM,0BAA0B;;;CAGtC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAmBxC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAuBxC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BZ,CAAC;AAEX,eAAO,MAAM,0BAA0B;;;CAGtC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAmBxC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAuBxC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqE/B,CAAC"}
|
package/dist/constants.d.mts
CHANGED
|
@@ -56,4 +56,39 @@ export declare const ABI_SIMULATION_ERC721_LEGACY: {
|
|
|
56
56
|
name: string;
|
|
57
57
|
type: string;
|
|
58
58
|
}[];
|
|
59
|
+
export declare const METHOD_REGISTRY_ABI: ({
|
|
60
|
+
constant: boolean;
|
|
61
|
+
inputs: {
|
|
62
|
+
name: string;
|
|
63
|
+
type: string;
|
|
64
|
+
}[];
|
|
65
|
+
name: string;
|
|
66
|
+
outputs: {
|
|
67
|
+
name: string;
|
|
68
|
+
type: string;
|
|
69
|
+
}[];
|
|
70
|
+
payable: boolean;
|
|
71
|
+
type: string;
|
|
72
|
+
anonymous?: undefined;
|
|
73
|
+
} | {
|
|
74
|
+
inputs: never[];
|
|
75
|
+
type: string;
|
|
76
|
+
constant?: undefined;
|
|
77
|
+
name?: undefined;
|
|
78
|
+
outputs?: undefined;
|
|
79
|
+
payable?: undefined;
|
|
80
|
+
anonymous?: undefined;
|
|
81
|
+
} | {
|
|
82
|
+
anonymous: boolean;
|
|
83
|
+
inputs: {
|
|
84
|
+
indexed: boolean;
|
|
85
|
+
name: string;
|
|
86
|
+
type: string;
|
|
87
|
+
}[];
|
|
88
|
+
name: string;
|
|
89
|
+
type: string;
|
|
90
|
+
constant?: undefined;
|
|
91
|
+
outputs?: undefined;
|
|
92
|
+
payable?: undefined;
|
|
93
|
+
})[];
|
|
59
94
|
//# sourceMappingURL=constants.d.mts.map
|
package/dist/constants.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BZ,CAAC;AAEX,eAAO,MAAM,0BAA0B;;;CAGtC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAmBxC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAuBxC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BZ,CAAC;AAEX,eAAO,MAAM,0BAA0B;;;CAGtC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAmBxC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAuBxC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqE/B,CAAC"}
|
package/dist/constants.mjs
CHANGED
|
@@ -80,4 +80,74 @@ export const ABI_SIMULATION_ERC721_LEGACY = [
|
|
|
80
80
|
type: 'event',
|
|
81
81
|
},
|
|
82
82
|
];
|
|
83
|
+
export const METHOD_REGISTRY_ABI = [
|
|
84
|
+
{
|
|
85
|
+
constant: false,
|
|
86
|
+
inputs: [{ name: '_new', type: 'address' }],
|
|
87
|
+
name: 'setOwner',
|
|
88
|
+
outputs: [],
|
|
89
|
+
payable: false,
|
|
90
|
+
type: 'function',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
constant: true,
|
|
94
|
+
inputs: [],
|
|
95
|
+
name: 'totalSignatures',
|
|
96
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
97
|
+
payable: false,
|
|
98
|
+
type: 'function',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
constant: true,
|
|
102
|
+
inputs: [],
|
|
103
|
+
name: 'owner',
|
|
104
|
+
outputs: [{ name: '', type: 'address' }],
|
|
105
|
+
payable: false,
|
|
106
|
+
type: 'function',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
constant: false,
|
|
110
|
+
inputs: [],
|
|
111
|
+
name: 'drain',
|
|
112
|
+
outputs: [],
|
|
113
|
+
payable: false,
|
|
114
|
+
type: 'function',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
constant: true,
|
|
118
|
+
inputs: [{ name: '', type: 'bytes4' }],
|
|
119
|
+
name: 'entries',
|
|
120
|
+
outputs: [{ name: '', type: 'string' }],
|
|
121
|
+
payable: false,
|
|
122
|
+
type: 'function',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
constant: false,
|
|
126
|
+
inputs: [{ name: '_method', type: 'string' }],
|
|
127
|
+
name: 'register',
|
|
128
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
129
|
+
payable: false,
|
|
130
|
+
type: 'function',
|
|
131
|
+
},
|
|
132
|
+
{ inputs: [], type: 'constructor' },
|
|
133
|
+
{
|
|
134
|
+
anonymous: false,
|
|
135
|
+
inputs: [
|
|
136
|
+
{ indexed: true, name: 'creator', type: 'address' },
|
|
137
|
+
{ indexed: true, name: 'signature', type: 'bytes4' },
|
|
138
|
+
{ indexed: false, name: 'method', type: 'string' },
|
|
139
|
+
],
|
|
140
|
+
name: 'Registered',
|
|
141
|
+
type: 'event',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
anonymous: false,
|
|
145
|
+
inputs: [
|
|
146
|
+
{ indexed: true, name: 'old', type: 'address' },
|
|
147
|
+
{ indexed: true, name: 'current', type: 'address' },
|
|
148
|
+
],
|
|
149
|
+
name: 'NewOwner',
|
|
150
|
+
type: 'event',
|
|
151
|
+
},
|
|
152
|
+
];
|
|
83
153
|
//# sourceMappingURL=constants.mjs.map
|
package/dist/constants.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,SAAS;IACvB,GAAG,EAAE,MAAM;IACX,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,OAAO;IACzB,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,QAAQ;IACvB,gBAAgB,EAAE,UAAU;IAC5B,OAAO,EAAE,MAAM;IACf,eAAe,EAAE,SAAS;IAC1B,SAAS,EAAE,QAAQ;IACnB,iBAAiB,EAAE,QAAQ;IAC3B,MAAM,EAAE,MAAM;IACd,cAAc,EAAE,OAAO;IACvB,OAAO,EAAE,UAAU;IACnB,YAAY,EAAE,QAAQ;IACtB,aAAa,EAAE,QAAQ;IACvB,aAAa,EAAE,QAAQ;IACvB,QAAQ,EAAE,OAAO;IACjB,gBAAgB,EAAE,OAAO;IACzB,SAAS,EAAE,OAAO;IAClB,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,OAAO;IACnB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,SAAS;IACjB,cAAc,EAAE,SAAS;CACjB,CAAC;AAEX,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;IACvB,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,CAAC;CAChC,CAAC;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;YAC9C,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;SACjD;QACD,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;YAChD,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;SACjD;QACD,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,OAAO;KACd;CACF,CAAC;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;CACF,CAAC","sourcesContent":["export const CHAIN_IDS = {\n MAINNET: '0x1',\n GOERLI: '0x5',\n BASE: '0x2105',\n BASE_TESTNET: '0x14a33',\n BSC: '0x38',\n BSC_TESTNET: '0x61',\n OPTIMISM: '0xa',\n OPTIMISM_TESTNET: '0x1a4',\n OPBNB: '0xcc',\n OPBNB_TESTNET: '0x15eb',\n OPTIMISM_SEPOLIA: '0xaa37dc',\n POLYGON: '0x89',\n POLYGON_TESTNET: '0x13881',\n AVALANCHE: '0xa86a',\n AVALANCHE_TESTNET: '0xa869',\n FANTOM: '0xfa',\n FANTOM_TESTNET: '0xfa2',\n SEPOLIA: '0xaa36a7',\n LINEA_GOERLI: '0xe704',\n LINEA_SEPOLIA: '0xe705',\n LINEA_MAINNET: '0xe708',\n MOONBEAM: '0x504',\n MOONBEAM_TESTNET: '0x507',\n MOONRIVER: '0x505',\n GNOSIS: '0x64',\n ARBITRUM: '0xa4b1',\n ZKSYNC_ERA: '0x144',\n ZORA: '0x76adf1',\n SCROLL: '0x82750',\n SCROLL_SEPOLIA: '0x8274f',\n} as const;\n\nexport const GAS_BUFFER_CHAIN_OVERRIDES = {\n [CHAIN_IDS.OPTIMISM]: 1,\n [CHAIN_IDS.OPTIMISM_SEPOLIA]: 1,\n};\n\n/** Extract of the Wrapped ERC-20 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC20_WRAPPED = [\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'to', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Deposit',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'from', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Withdrawal',\n type: 'event',\n },\n];\n\n/** Extract of the legacy ERC-721 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC721_LEGACY = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n name: '_from',\n type: 'address',\n },\n {\n indexed: false,\n name: '_to',\n type: 'address',\n },\n {\n indexed: false,\n name: '_tokenId',\n type: 'uint256',\n },\n ],\n name: 'Transfer',\n type: 'event',\n },\n];\n"]}
|
|
1
|
+
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,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,EAAE;YACN,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;YAC/C,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SACpD;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;CACF,CAAC","sourcesContent":["export const CHAIN_IDS = {\n MAINNET: '0x1',\n GOERLI: '0x5',\n BASE: '0x2105',\n BASE_TESTNET: '0x14a33',\n BSC: '0x38',\n BSC_TESTNET: '0x61',\n OPTIMISM: '0xa',\n OPTIMISM_TESTNET: '0x1a4',\n OPBNB: '0xcc',\n OPBNB_TESTNET: '0x15eb',\n OPTIMISM_SEPOLIA: '0xaa37dc',\n POLYGON: '0x89',\n POLYGON_TESTNET: '0x13881',\n AVALANCHE: '0xa86a',\n AVALANCHE_TESTNET: '0xa869',\n FANTOM: '0xfa',\n FANTOM_TESTNET: '0xfa2',\n SEPOLIA: '0xaa36a7',\n LINEA_GOERLI: '0xe704',\n LINEA_SEPOLIA: '0xe705',\n LINEA_MAINNET: '0xe708',\n MOONBEAM: '0x504',\n MOONBEAM_TESTNET: '0x507',\n MOONRIVER: '0x505',\n GNOSIS: '0x64',\n ARBITRUM: '0xa4b1',\n ZKSYNC_ERA: '0x144',\n ZORA: '0x76adf1',\n SCROLL: '0x82750',\n SCROLL_SEPOLIA: '0x8274f',\n} as const;\n\nexport const GAS_BUFFER_CHAIN_OVERRIDES = {\n [CHAIN_IDS.OPTIMISM]: 1,\n [CHAIN_IDS.OPTIMISM_SEPOLIA]: 1,\n};\n\n/** Extract of the Wrapped ERC-20 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC20_WRAPPED = [\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'to', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Deposit',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'from', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Withdrawal',\n type: 'event',\n },\n];\n\n/** Extract of the legacy ERC-721 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC721_LEGACY = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n name: '_from',\n type: 'address',\n },\n {\n indexed: false,\n name: '_to',\n type: 'address',\n },\n {\n indexed: false,\n name: '_tokenId',\n type: 'uint256',\n },\n ],\n name: 'Transfer',\n type: 'event',\n },\n];\n\nexport const METHOD_REGISTRY_ABI = [\n {\n constant: false,\n inputs: [{ name: '_new', type: 'address' }],\n name: 'setOwner',\n outputs: [],\n payable: false,\n type: 'function',\n },\n {\n constant: true,\n inputs: [],\n name: 'totalSignatures',\n outputs: [{ name: '', type: 'uint256' }],\n payable: false,\n type: 'function',\n },\n {\n constant: true,\n inputs: [],\n name: 'owner',\n outputs: [{ name: '', type: 'address' }],\n payable: false,\n type: 'function',\n },\n {\n constant: false,\n inputs: [],\n name: 'drain',\n outputs: [],\n payable: false,\n type: 'function',\n },\n {\n constant: true,\n inputs: [{ name: '', type: 'bytes4' }],\n name: 'entries',\n outputs: [{ name: '', type: 'string' }],\n payable: false,\n type: 'function',\n },\n {\n constant: false,\n inputs: [{ name: '_method', type: 'string' }],\n name: 'register',\n outputs: [{ name: '', type: 'bool' }],\n payable: false,\n type: 'function',\n },\n { inputs: [], type: 'constructor' },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'creator', type: 'address' },\n { indexed: true, name: 'signature', type: 'bytes4' },\n { indexed: false, name: 'method', type: 'string' },\n ],\n name: 'Registered',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'old', type: 'address' },\n { indexed: true, name: 'current', type: 'address' },\n ],\n name: 'NewOwner',\n type: 'event',\n },\n];\n"]}
|
|
@@ -22,78 +22,9 @@ const async_mutex_1 = require("async-mutex");
|
|
|
22
22
|
// This package purposefully relies on Node's EventEmitter module.
|
|
23
23
|
// eslint-disable-next-line import-x/no-nodejs-modules
|
|
24
24
|
const events_1 = __importDefault(require("events"));
|
|
25
|
+
const constants_1 = require("../constants.cjs");
|
|
25
26
|
const logger_1 = require("../logger.cjs");
|
|
26
27
|
const log = (0, utils_1.createModuleLogger)(logger_1.projectLogger, 'method-data');
|
|
27
|
-
const methodRegistryAbi = [
|
|
28
|
-
{
|
|
29
|
-
constant: false,
|
|
30
|
-
inputs: [{ name: '_new', type: 'address' }],
|
|
31
|
-
name: 'setOwner',
|
|
32
|
-
outputs: [],
|
|
33
|
-
payable: false,
|
|
34
|
-
type: 'function',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
constant: true,
|
|
38
|
-
inputs: [],
|
|
39
|
-
name: 'totalSignatures',
|
|
40
|
-
outputs: [{ name: '', type: 'uint256' }],
|
|
41
|
-
payable: false,
|
|
42
|
-
type: 'function',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
constant: true,
|
|
46
|
-
inputs: [],
|
|
47
|
-
name: 'owner',
|
|
48
|
-
outputs: [{ name: '', type: 'address' }],
|
|
49
|
-
payable: false,
|
|
50
|
-
type: 'function',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
constant: false,
|
|
54
|
-
inputs: [],
|
|
55
|
-
name: 'drain',
|
|
56
|
-
outputs: [],
|
|
57
|
-
payable: false,
|
|
58
|
-
type: 'function',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
constant: true,
|
|
62
|
-
inputs: [{ name: '', type: 'bytes4' }],
|
|
63
|
-
name: 'entries',
|
|
64
|
-
outputs: [{ name: '', type: 'string' }],
|
|
65
|
-
payable: false,
|
|
66
|
-
type: 'function',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
constant: false,
|
|
70
|
-
inputs: [{ name: '_method', type: 'string' }],
|
|
71
|
-
name: 'register',
|
|
72
|
-
outputs: [{ name: '', type: 'bool' }],
|
|
73
|
-
payable: false,
|
|
74
|
-
type: 'function',
|
|
75
|
-
},
|
|
76
|
-
{ inputs: [], type: 'constructor' },
|
|
77
|
-
{
|
|
78
|
-
anonymous: false,
|
|
79
|
-
inputs: [
|
|
80
|
-
{ indexed: true, name: 'creator', type: 'address' },
|
|
81
|
-
{ indexed: true, name: 'signature', type: 'bytes4' },
|
|
82
|
-
{ indexed: false, name: 'method', type: 'string' },
|
|
83
|
-
],
|
|
84
|
-
name: 'Registered',
|
|
85
|
-
type: 'event',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
anonymous: false,
|
|
89
|
-
inputs: [
|
|
90
|
-
{ indexed: true, name: 'old', type: 'address' },
|
|
91
|
-
{ indexed: true, name: 'current', type: 'address' },
|
|
92
|
-
],
|
|
93
|
-
name: 'NewOwner',
|
|
94
|
-
type: 'event',
|
|
95
|
-
},
|
|
96
|
-
];
|
|
97
28
|
class MethodDataHelper {
|
|
98
29
|
constructor({ getState }) {
|
|
99
30
|
_MethodDataHelper_instances.add(this);
|
|
@@ -115,7 +46,7 @@ class MethodDataHelper {
|
|
|
115
46
|
}
|
|
116
47
|
let iface = __classPrivateFieldGet(this, _MethodDataHelper_interfaceByNetworkClientId, "f").get(networkClientId);
|
|
117
48
|
if (!iface) {
|
|
118
|
-
iface = new abi_1.Interface(
|
|
49
|
+
iface = new abi_1.Interface(constants_1.METHOD_REGISTRY_ABI);
|
|
119
50
|
__classPrivateFieldGet(this, _MethodDataHelper_interfaceByNetworkClientId, "f").set(networkClientId, iface);
|
|
120
51
|
log('Created interface', networkClientId);
|
|
121
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MethodDataHelper.cjs","sourceRoot":"","sources":["../../src/helpers/MethodDataHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,4CAA+C;AAE/C,2CAAqD;AACrD,6CAAoC;AACpC,kEAAkE;AAClE,sDAAsD;AACtD,oDAAkC;AAElC,0CAA0C;AAG1C,MAAM,GAAG,GAA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;gBAC3C,uBAAA,IAAI,oDAA4B,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;gBAC7D,GAAG,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;aAC3C;YAED,MAAM,UAAU,GAAG,MAAM,uBAAA,IAAI,sEAAiB,MAArB,IAAI,EAAkB,cAAc,EAAE,KAAK,CAAC,CAAC;YAEtE,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YAE1B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC;YAExD,OAAO,UAAU,CAAC;SACnB;gBAAS;YACR,WAAW,EAAE,CAAC;SACf;IACH,CAAC;CAuBF;AAzED,4CAyEC;oOArBC,KAAK,4CACH,cAAsB,EACtB,KAAgB;IAEhB,IAAI;QACF,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QAC3D,OAAO;YACL,cAAc,EAAE,gBAAgB,CAAC,MAAM,EAAE;YACzC,oBAAoB,EAAE;gBACpB,IAAI,EAAE,gBAAgB,CAAC,IAAI;gBAC3B,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;aAC5D;SACF,CAAC;KACH;IAAC,MAAM;QACN,GAAG,CAAC,sCAAsC,EAAE,cAAc,CAAC,CAAC;QAC5D,OAAO;YACL,cAAc,EAAE,EAAE;YAClB,oBAAoB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SAC3D,CAAC;KACH;AACH,CAAC","sourcesContent":["import { Interface } from '@ethersproject/abi';\nimport type { NetworkClientId } from '@metamask/network-controller';\nimport { createModuleLogger } from '@metamask/utils';\nimport { Mutex } from 'async-mutex';\n// This package purposefully relies on Node's EventEmitter module.\n// eslint-disable-next-line import-x/no-nodejs-modules\nimport EventEmitter from 'events';\n\nimport { METHOD_REGISTRY_ABI } from '../constants';\nimport { projectLogger } from '../logger';\nimport type { MethodData } from '../TransactionController';\n\nconst log = createModuleLogger(projectLogger, 'method-data');\n\nexport class MethodDataHelper {\n hub: EventEmitter;\n\n #getState: () => Record<string, MethodData>;\n\n #interfaceByNetworkClientId: Map<NetworkClientId, Interface>;\n\n #mutex = new Mutex();\n\n constructor({ getState }: { getState: () => Record<string, MethodData> }) {\n this.hub = new EventEmitter();\n\n this.#getState = getState;\n this.#interfaceByNetworkClientId = new Map();\n }\n\n async lookup(\n fourBytePrefix: string,\n networkClientId: NetworkClientId,\n ): Promise<MethodData> {\n log('lookup', fourBytePrefix, networkClientId);\n\n const releaseLock = await this.#mutex.acquire();\n\n try {\n const cachedResult = this.#getState()[fourBytePrefix];\n\n if (cachedResult) {\n log('Cached', cachedResult);\n return cachedResult;\n }\n\n let iface = this.#interfaceByNetworkClientId.get(networkClientId);\n\n if (!iface) {\n iface = new Interface(METHOD_REGISTRY_ABI);\n this.#interfaceByNetworkClientId.set(networkClientId, iface);\n log('Created interface', networkClientId);\n }\n\n const methodData = await this.#interfaceLookup(fourBytePrefix, iface);\n\n log('Result', methodData);\n\n this.hub.emit('update', { fourBytePrefix, methodData });\n\n return methodData;\n } finally {\n releaseLock();\n }\n }\n\n async #interfaceLookup(\n fourBytePrefix: string,\n iface: Interface,\n ): Promise<MethodData> {\n try {\n const functionFragment = iface.getFunction(fourBytePrefix);\n return {\n registryMethod: functionFragment.format(),\n parsedRegistryMethod: {\n name: functionFragment.name,\n args: functionFragment.inputs.map(({ type }) => ({ type })),\n },\n };\n } catch {\n log('No method found or invalid signature', fourBytePrefix);\n return {\n registryMethod: '',\n parsedRegistryMethod: { name: undefined, args: undefined },\n };\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MethodDataHelper.d.cts","sourceRoot":"","sources":["../../src/helpers/MethodDataHelper.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,eAAe,EAAE,qCAAqC;AAKpE,OAAO,YAAY,eAAe;
|
|
1
|
+
{"version":3,"file":"MethodDataHelper.d.cts","sourceRoot":"","sources":["../../src/helpers/MethodDataHelper.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,eAAe,EAAE,qCAAqC;AAKpE,OAAO,YAAY,eAAe;AAIlC,OAAO,KAAK,EAAE,UAAU,EAAE,qCAAiC;AAI3D,qBAAa,gBAAgB;;IAC3B,GAAG,EAAE,YAAY,CAAC;gBAQN,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;KAAE;IAOlE,MAAM,CACV,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,UAAU,CAAC;CAsDvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MethodDataHelper.d.mts","sourceRoot":"","sources":["../../src/helpers/MethodDataHelper.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,eAAe,EAAE,qCAAqC;AAKpE,OAAO,YAAY,eAAe;
|
|
1
|
+
{"version":3,"file":"MethodDataHelper.d.mts","sourceRoot":"","sources":["../../src/helpers/MethodDataHelper.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,eAAe,EAAE,qCAAqC;AAKpE,OAAO,YAAY,eAAe;AAIlC,OAAO,KAAK,EAAE,UAAU,EAAE,qCAAiC;AAI3D,qBAAa,gBAAgB;;IAC3B,GAAG,EAAE,YAAY,CAAC;gBAQN,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;KAAE;IAOlE,MAAM,CACV,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,UAAU,CAAC;CAsDvB"}
|
|
@@ -16,78 +16,9 @@ import { Mutex } from "async-mutex";
|
|
|
16
16
|
// This package purposefully relies on Node's EventEmitter module.
|
|
17
17
|
// eslint-disable-next-line import-x/no-nodejs-modules
|
|
18
18
|
import EventEmitter from "events";
|
|
19
|
+
import { METHOD_REGISTRY_ABI } from "../constants.mjs";
|
|
19
20
|
import { projectLogger } from "../logger.mjs";
|
|
20
21
|
const log = createModuleLogger(projectLogger, 'method-data');
|
|
21
|
-
const methodRegistryAbi = [
|
|
22
|
-
{
|
|
23
|
-
constant: false,
|
|
24
|
-
inputs: [{ name: '_new', type: 'address' }],
|
|
25
|
-
name: 'setOwner',
|
|
26
|
-
outputs: [],
|
|
27
|
-
payable: false,
|
|
28
|
-
type: 'function',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
constant: true,
|
|
32
|
-
inputs: [],
|
|
33
|
-
name: 'totalSignatures',
|
|
34
|
-
outputs: [{ name: '', type: 'uint256' }],
|
|
35
|
-
payable: false,
|
|
36
|
-
type: 'function',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
constant: true,
|
|
40
|
-
inputs: [],
|
|
41
|
-
name: 'owner',
|
|
42
|
-
outputs: [{ name: '', type: 'address' }],
|
|
43
|
-
payable: false,
|
|
44
|
-
type: 'function',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
constant: false,
|
|
48
|
-
inputs: [],
|
|
49
|
-
name: 'drain',
|
|
50
|
-
outputs: [],
|
|
51
|
-
payable: false,
|
|
52
|
-
type: 'function',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
constant: true,
|
|
56
|
-
inputs: [{ name: '', type: 'bytes4' }],
|
|
57
|
-
name: 'entries',
|
|
58
|
-
outputs: [{ name: '', type: 'string' }],
|
|
59
|
-
payable: false,
|
|
60
|
-
type: 'function',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
constant: false,
|
|
64
|
-
inputs: [{ name: '_method', type: 'string' }],
|
|
65
|
-
name: 'register',
|
|
66
|
-
outputs: [{ name: '', type: 'bool' }],
|
|
67
|
-
payable: false,
|
|
68
|
-
type: 'function',
|
|
69
|
-
},
|
|
70
|
-
{ inputs: [], type: 'constructor' },
|
|
71
|
-
{
|
|
72
|
-
anonymous: false,
|
|
73
|
-
inputs: [
|
|
74
|
-
{ indexed: true, name: 'creator', type: 'address' },
|
|
75
|
-
{ indexed: true, name: 'signature', type: 'bytes4' },
|
|
76
|
-
{ indexed: false, name: 'method', type: 'string' },
|
|
77
|
-
],
|
|
78
|
-
name: 'Registered',
|
|
79
|
-
type: 'event',
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
anonymous: false,
|
|
83
|
-
inputs: [
|
|
84
|
-
{ indexed: true, name: 'old', type: 'address' },
|
|
85
|
-
{ indexed: true, name: 'current', type: 'address' },
|
|
86
|
-
],
|
|
87
|
-
name: 'NewOwner',
|
|
88
|
-
type: 'event',
|
|
89
|
-
},
|
|
90
|
-
];
|
|
91
22
|
export class MethodDataHelper {
|
|
92
23
|
constructor({ getState }) {
|
|
93
24
|
_MethodDataHelper_instances.add(this);
|
|
@@ -109,7 +40,7 @@ export class MethodDataHelper {
|
|
|
109
40
|
}
|
|
110
41
|
let iface = __classPrivateFieldGet(this, _MethodDataHelper_interfaceByNetworkClientId, "f").get(networkClientId);
|
|
111
42
|
if (!iface) {
|
|
112
|
-
iface = new Interface(
|
|
43
|
+
iface = new Interface(METHOD_REGISTRY_ABI);
|
|
113
44
|
__classPrivateFieldGet(this, _MethodDataHelper_interfaceByNetworkClientId, "f").set(networkClientId, iface);
|
|
114
45
|
log('Created interface', networkClientId);
|
|
115
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MethodDataHelper.mjs","sourceRoot":"","sources":["../../src/helpers/MethodDataHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,2BAA2B;AAE/C,OAAO,EAAE,kBAAkB,EAAE,wBAAwB;AAC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,EAAE;YAClB,oBAAoB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SAC3D,CAAC;KACH;AACH,CAAC","sourcesContent":["import { Interface } from '@ethersproject/abi';\nimport type { NetworkClientId } from '@metamask/network-controller';\nimport { createModuleLogger } from '@metamask/utils';\nimport { Mutex } from 'async-mutex';\n// This package purposefully relies on Node's EventEmitter module.\n// eslint-disable-next-line import-x/no-nodejs-modules\nimport EventEmitter from 'events';\n\nimport { METHOD_REGISTRY_ABI } from '../constants';\nimport { projectLogger } from '../logger';\nimport type { MethodData } from '../TransactionController';\n\nconst log = createModuleLogger(projectLogger, 'method-data');\n\nexport class MethodDataHelper {\n hub: EventEmitter;\n\n #getState: () => Record<string, MethodData>;\n\n #interfaceByNetworkClientId: Map<NetworkClientId, Interface>;\n\n #mutex = new Mutex();\n\n constructor({ getState }: { getState: () => Record<string, MethodData> }) {\n this.hub = new EventEmitter();\n\n this.#getState = getState;\n this.#interfaceByNetworkClientId = new Map();\n }\n\n async lookup(\n fourBytePrefix: string,\n networkClientId: NetworkClientId,\n ): Promise<MethodData> {\n log('lookup', fourBytePrefix, networkClientId);\n\n const releaseLock = await this.#mutex.acquire();\n\n try {\n const cachedResult = this.#getState()[fourBytePrefix];\n\n if (cachedResult) {\n log('Cached', cachedResult);\n return cachedResult;\n }\n\n let iface = this.#interfaceByNetworkClientId.get(networkClientId);\n\n if (!iface) {\n iface = new Interface(METHOD_REGISTRY_ABI);\n this.#interfaceByNetworkClientId.set(networkClientId, iface);\n log('Created interface', networkClientId);\n }\n\n const methodData = await this.#interfaceLookup(fourBytePrefix, iface);\n\n log('Result', methodData);\n\n this.hub.emit('update', { fourBytePrefix, methodData });\n\n return methodData;\n } finally {\n releaseLock();\n }\n }\n\n async #interfaceLookup(\n fourBytePrefix: string,\n iface: Interface,\n ): Promise<MethodData> {\n try {\n const functionFragment = iface.getFunction(fourBytePrefix);\n return {\n registryMethod: functionFragment.format(),\n parsedRegistryMethod: {\n name: functionFragment.name,\n args: functionFragment.inputs.map(({ type }) => ({ type })),\n },\n };\n } catch {\n log('No method found or invalid signature', fourBytePrefix);\n return {\n registryMethod: '',\n parsedRegistryMethod: { name: undefined, args: undefined },\n };\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/transaction-controller",
|
|
3
|
-
"version": "43.0.0-preview-
|
|
3
|
+
"version": "43.0.0-preview-455ba549",
|
|
4
4
|
"description": "Stores transactions alongside their periodically updated statuses and manages interactions such as approval and cancellation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|