@0xsequence/provider 2.0.19 → 2.0.20
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/0xsequence-provider.cjs.d.ts +1 -1
- package/dist/0xsequence-provider.cjs.dev.js +25 -23
- package/dist/0xsequence-provider.cjs.prod.js +25 -23
- package/dist/0xsequence-provider.esm.js +25 -23
- package/package.json +16 -16
- package/src/init.ts +1 -0
- package/src/transports/wallet-request-handler.ts +13 -1
- package/src/types.ts +2 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./declarations/src/index";
|
|
1
|
+
export * from "./declarations/src/index.js";
|
|
2
2
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMHhzZXF1ZW5jZS1wcm92aWRlci5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4vZGVjbGFyYXRpb25zL3NyYy9pbmRleC5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
|
|
@@ -50,18 +50,13 @@ function isCreateContractCall(data) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function _extends() {
|
|
53
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
54
|
-
for (var
|
|
55
|
-
var
|
|
56
|
-
for (var
|
|
57
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
58
|
-
target[key] = source[key];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
53
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
54
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
55
|
+
var t = arguments[e];
|
|
56
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
61
57
|
}
|
|
62
|
-
return
|
|
63
|
-
};
|
|
64
|
-
return _extends.apply(this, arguments);
|
|
58
|
+
return n;
|
|
59
|
+
}, _extends.apply(null, arguments);
|
|
65
60
|
}
|
|
66
61
|
|
|
67
62
|
function isProviderTransport(transport) {
|
|
@@ -2410,7 +2405,13 @@ class WalletRequestHandler {
|
|
|
2410
2405
|
if (!provider) {
|
|
2411
2406
|
throw new Error(`WalletRequestHandler: wallet provider is not configured for chainId ${request.chainId}`);
|
|
2412
2407
|
}
|
|
2413
|
-
|
|
2408
|
+
|
|
2409
|
+
// NOTE: we cannot use `instanceof ethers.JsonRpcProvider` because despite that we know
|
|
2410
|
+
// its the proper type, its not resolving properly at runtime during the pupeteer e2e tests.
|
|
2411
|
+
// Switching to the type guard function below is safer and more reliable.
|
|
2412
|
+
//
|
|
2413
|
+
// const jsonRpcProvider = provider instanceof ethers.JsonRpcProvider ? provider : undefined
|
|
2414
|
+
const jsonRpcProvider = isJsonRpcProvider(provider) ? provider : undefined;
|
|
2414
2415
|
switch (request.method) {
|
|
2415
2416
|
case 'net_version':
|
|
2416
2417
|
{
|
|
@@ -2931,18 +2932,18 @@ function getLegacyWalletState(chainId, status) {
|
|
|
2931
2932
|
};
|
|
2932
2933
|
}
|
|
2933
2934
|
const permittedJsonRpcMethods = ['net_version', 'eth_chainId', 'eth_getBalance', 'eth_getTransactionCount', 'eth_blockNumber', 'eth_getBlockByNumber', 'eth_getBlockByHash', 'eth_getTransactionByHash', 'eth_getCode', 'eth_estimateGas', 'eth_gasPrice', 'sequence_getWalletContext', 'sequence_getNetworks', 'sequence_setDefaultNetwork'];
|
|
2935
|
+
function isJsonRpcProvider(provider) {
|
|
2936
|
+
return provider && typeof provider === 'object' && typeof provider.send === 'function' && typeof provider.getNetwork === 'function';
|
|
2937
|
+
}
|
|
2934
2938
|
|
|
2935
|
-
function _objectWithoutPropertiesLoose(
|
|
2936
|
-
if (
|
|
2937
|
-
var
|
|
2938
|
-
var
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
target[key] = source[key];
|
|
2944
|
-
}
|
|
2945
|
-
return target;
|
|
2939
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
2940
|
+
if (null == r) return {};
|
|
2941
|
+
var t = {};
|
|
2942
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
2943
|
+
if (e.includes(n)) continue;
|
|
2944
|
+
t[n] = r[n];
|
|
2945
|
+
}
|
|
2946
|
+
return t;
|
|
2946
2947
|
}
|
|
2947
2948
|
|
|
2948
2949
|
class SequenceSigner {
|
|
@@ -4181,6 +4182,7 @@ const initWallet = (projectAccessKey, partialConfig) => {
|
|
|
4181
4182
|
// Find any new networks that aren't already defined in sequence.js
|
|
4182
4183
|
// and add them to the list of networks, (they must have a rpcUrl and chainId)
|
|
4183
4184
|
const newNetworks = (_config$networks$filt = (_config$networks = config.networks) == null ? void 0 : _config$networks.filter(n => {
|
|
4185
|
+
// eslint-disable-next-line
|
|
4184
4186
|
n.rpcUrl !== undefined && n.chainId !== undefined && !network.allNetworks.find(an => an.chainId === n.chainId);
|
|
4185
4187
|
})) != null ? _config$networks$filt : [];
|
|
4186
4188
|
|
|
@@ -50,18 +50,13 @@ function isCreateContractCall(data) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function _extends() {
|
|
53
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
54
|
-
for (var
|
|
55
|
-
var
|
|
56
|
-
for (var
|
|
57
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
58
|
-
target[key] = source[key];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
53
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
54
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
55
|
+
var t = arguments[e];
|
|
56
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
61
57
|
}
|
|
62
|
-
return
|
|
63
|
-
};
|
|
64
|
-
return _extends.apply(this, arguments);
|
|
58
|
+
return n;
|
|
59
|
+
}, _extends.apply(null, arguments);
|
|
65
60
|
}
|
|
66
61
|
|
|
67
62
|
function isProviderTransport(transport) {
|
|
@@ -2410,7 +2405,13 @@ class WalletRequestHandler {
|
|
|
2410
2405
|
if (!provider) {
|
|
2411
2406
|
throw new Error(`WalletRequestHandler: wallet provider is not configured for chainId ${request.chainId}`);
|
|
2412
2407
|
}
|
|
2413
|
-
|
|
2408
|
+
|
|
2409
|
+
// NOTE: we cannot use `instanceof ethers.JsonRpcProvider` because despite that we know
|
|
2410
|
+
// its the proper type, its not resolving properly at runtime during the pupeteer e2e tests.
|
|
2411
|
+
// Switching to the type guard function below is safer and more reliable.
|
|
2412
|
+
//
|
|
2413
|
+
// const jsonRpcProvider = provider instanceof ethers.JsonRpcProvider ? provider : undefined
|
|
2414
|
+
const jsonRpcProvider = isJsonRpcProvider(provider) ? provider : undefined;
|
|
2414
2415
|
switch (request.method) {
|
|
2415
2416
|
case 'net_version':
|
|
2416
2417
|
{
|
|
@@ -2931,18 +2932,18 @@ function getLegacyWalletState(chainId, status) {
|
|
|
2931
2932
|
};
|
|
2932
2933
|
}
|
|
2933
2934
|
const permittedJsonRpcMethods = ['net_version', 'eth_chainId', 'eth_getBalance', 'eth_getTransactionCount', 'eth_blockNumber', 'eth_getBlockByNumber', 'eth_getBlockByHash', 'eth_getTransactionByHash', 'eth_getCode', 'eth_estimateGas', 'eth_gasPrice', 'sequence_getWalletContext', 'sequence_getNetworks', 'sequence_setDefaultNetwork'];
|
|
2935
|
+
function isJsonRpcProvider(provider) {
|
|
2936
|
+
return provider && typeof provider === 'object' && typeof provider.send === 'function' && typeof provider.getNetwork === 'function';
|
|
2937
|
+
}
|
|
2934
2938
|
|
|
2935
|
-
function _objectWithoutPropertiesLoose(
|
|
2936
|
-
if (
|
|
2937
|
-
var
|
|
2938
|
-
var
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
target[key] = source[key];
|
|
2944
|
-
}
|
|
2945
|
-
return target;
|
|
2939
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
2940
|
+
if (null == r) return {};
|
|
2941
|
+
var t = {};
|
|
2942
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
2943
|
+
if (e.includes(n)) continue;
|
|
2944
|
+
t[n] = r[n];
|
|
2945
|
+
}
|
|
2946
|
+
return t;
|
|
2946
2947
|
}
|
|
2947
2948
|
|
|
2948
2949
|
class SequenceSigner {
|
|
@@ -4181,6 +4182,7 @@ const initWallet = (projectAccessKey, partialConfig) => {
|
|
|
4181
4182
|
// Find any new networks that aren't already defined in sequence.js
|
|
4182
4183
|
// and add them to the list of networks, (they must have a rpcUrl and chainId)
|
|
4183
4184
|
const newNetworks = (_config$networks$filt = (_config$networks = config.networks) == null ? void 0 : _config$networks.filter(n => {
|
|
4185
|
+
// eslint-disable-next-line
|
|
4184
4186
|
n.rpcUrl !== undefined && n.chainId !== undefined && !network.allNetworks.find(an => an.chainId === n.chainId);
|
|
4185
4187
|
})) != null ? _config$networks$filt : [];
|
|
4186
4188
|
|
|
@@ -46,18 +46,13 @@ function isCreateContractCall(data) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
function _extends() {
|
|
49
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
50
|
-
for (var
|
|
51
|
-
var
|
|
52
|
-
for (var
|
|
53
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
54
|
-
target[key] = source[key];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
49
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
50
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
51
|
+
var t = arguments[e];
|
|
52
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
57
53
|
}
|
|
58
|
-
return
|
|
59
|
-
};
|
|
60
|
-
return _extends.apply(this, arguments);
|
|
54
|
+
return n;
|
|
55
|
+
}, _extends.apply(null, arguments);
|
|
61
56
|
}
|
|
62
57
|
|
|
63
58
|
function isProviderTransport(transport) {
|
|
@@ -2406,7 +2401,13 @@ class WalletRequestHandler {
|
|
|
2406
2401
|
if (!provider) {
|
|
2407
2402
|
throw new Error(`WalletRequestHandler: wallet provider is not configured for chainId ${request.chainId}`);
|
|
2408
2403
|
}
|
|
2409
|
-
|
|
2404
|
+
|
|
2405
|
+
// NOTE: we cannot use `instanceof ethers.JsonRpcProvider` because despite that we know
|
|
2406
|
+
// its the proper type, its not resolving properly at runtime during the pupeteer e2e tests.
|
|
2407
|
+
// Switching to the type guard function below is safer and more reliable.
|
|
2408
|
+
//
|
|
2409
|
+
// const jsonRpcProvider = provider instanceof ethers.JsonRpcProvider ? provider : undefined
|
|
2410
|
+
const jsonRpcProvider = isJsonRpcProvider(provider) ? provider : undefined;
|
|
2410
2411
|
switch (request.method) {
|
|
2411
2412
|
case 'net_version':
|
|
2412
2413
|
{
|
|
@@ -2927,18 +2928,18 @@ function getLegacyWalletState(chainId, status) {
|
|
|
2927
2928
|
};
|
|
2928
2929
|
}
|
|
2929
2930
|
const permittedJsonRpcMethods = ['net_version', 'eth_chainId', 'eth_getBalance', 'eth_getTransactionCount', 'eth_blockNumber', 'eth_getBlockByNumber', 'eth_getBlockByHash', 'eth_getTransactionByHash', 'eth_getCode', 'eth_estimateGas', 'eth_gasPrice', 'sequence_getWalletContext', 'sequence_getNetworks', 'sequence_setDefaultNetwork'];
|
|
2931
|
+
function isJsonRpcProvider(provider) {
|
|
2932
|
+
return provider && typeof provider === 'object' && typeof provider.send === 'function' && typeof provider.getNetwork === 'function';
|
|
2933
|
+
}
|
|
2930
2934
|
|
|
2931
|
-
function _objectWithoutPropertiesLoose(
|
|
2932
|
-
if (
|
|
2933
|
-
var
|
|
2934
|
-
var
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
target[key] = source[key];
|
|
2940
|
-
}
|
|
2941
|
-
return target;
|
|
2935
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
2936
|
+
if (null == r) return {};
|
|
2937
|
+
var t = {};
|
|
2938
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
2939
|
+
if (e.includes(n)) continue;
|
|
2940
|
+
t[n] = r[n];
|
|
2941
|
+
}
|
|
2942
|
+
return t;
|
|
2942
2943
|
}
|
|
2943
2944
|
|
|
2944
2945
|
class SequenceSigner {
|
|
@@ -4177,6 +4178,7 @@ const initWallet = (projectAccessKey, partialConfig) => {
|
|
|
4177
4178
|
// Find any new networks that aren't already defined in sequence.js
|
|
4178
4179
|
// and add them to the list of networks, (they must have a rpcUrl and chainId)
|
|
4179
4180
|
const newNetworks = (_config$networks$filt = (_config$networks = config.networks) == null ? void 0 : _config$networks.filter(n => {
|
|
4181
|
+
// eslint-disable-next-line
|
|
4180
4182
|
n.rpcUrl !== undefined && n.chainId !== undefined && !allNetworks.find(an => an.chainId === n.chainId);
|
|
4181
4183
|
})) != null ? _config$networks$filt : [];
|
|
4182
4184
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/provider",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.20",
|
|
4
4
|
"description": "provider sub-package for Sequence",
|
|
5
5
|
"repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -8,27 +8,27 @@
|
|
|
8
8
|
"module": "dist/0xsequence-provider.esm.js",
|
|
9
9
|
"author": "Horizon Blockchain Games",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"ethers": ">=6"
|
|
13
|
+
},
|
|
11
14
|
"dependencies": {
|
|
12
|
-
"@databeat/tracker": "^0.9.
|
|
15
|
+
"@databeat/tracker": "^0.9.3",
|
|
13
16
|
"eventemitter2": "^6.4.5",
|
|
14
17
|
"webextension-polyfill": "^0.10.0",
|
|
15
|
-
"@0xsequence/abi": "2.0.
|
|
16
|
-
"@0xsequence/
|
|
17
|
-
"@0xsequence/
|
|
18
|
-
"@0xsequence/
|
|
19
|
-
"@0xsequence/
|
|
20
|
-
"@0xsequence/
|
|
21
|
-
"@0xsequence/
|
|
22
|
-
"@0xsequence/
|
|
23
|
-
"@0xsequence/
|
|
24
|
-
},
|
|
25
|
-
"peerDependencies": {
|
|
26
|
-
"ethers": ">=6"
|
|
18
|
+
"@0xsequence/abi": "2.0.20",
|
|
19
|
+
"@0xsequence/network": "2.0.20",
|
|
20
|
+
"@0xsequence/migration": "2.0.20",
|
|
21
|
+
"@0xsequence/relayer": "2.0.20",
|
|
22
|
+
"@0xsequence/core": "2.0.20",
|
|
23
|
+
"@0xsequence/wallet": "2.0.20",
|
|
24
|
+
"@0xsequence/auth": "2.0.20",
|
|
25
|
+
"@0xsequence/utils": "2.0.20",
|
|
26
|
+
"@0xsequence/account": "2.0.20"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/webextension-polyfill": "^0.10.0",
|
|
30
|
-
"ethers": "
|
|
31
|
-
"hardhat": "^2.
|
|
30
|
+
"ethers": "6.13.4",
|
|
31
|
+
"hardhat": "^2.22.14"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"src",
|
package/src/init.ts
CHANGED
|
@@ -89,6 +89,7 @@ export const initWallet = (projectAccessKey: string, partialConfig?: Partial<Pro
|
|
|
89
89
|
// Find any new networks that aren't already defined in sequence.js
|
|
90
90
|
// and add them to the list of networks, (they must have a rpcUrl and chainId)
|
|
91
91
|
const newNetworks = (config.networks?.filter(n => {
|
|
92
|
+
// eslint-disable-next-line
|
|
92
93
|
n.rpcUrl !== undefined && n.chainId !== undefined && !allNetworks.find(an => an.chainId === n.chainId)
|
|
93
94
|
}) ?? []) as NetworkConfig[]
|
|
94
95
|
|
|
@@ -262,7 +262,13 @@ export class WalletRequestHandler implements EIP1193Provider, ProviderMessageReq
|
|
|
262
262
|
if (!provider) {
|
|
263
263
|
throw new Error(`WalletRequestHandler: wallet provider is not configured for chainId ${request.chainId}`)
|
|
264
264
|
}
|
|
265
|
-
|
|
265
|
+
|
|
266
|
+
// NOTE: we cannot use `instanceof ethers.JsonRpcProvider` because despite that we know
|
|
267
|
+
// its the proper type, its not resolving properly at runtime during the pupeteer e2e tests.
|
|
268
|
+
// Switching to the type guard function below is safer and more reliable.
|
|
269
|
+
//
|
|
270
|
+
// const jsonRpcProvider = provider instanceof ethers.JsonRpcProvider ? provider : undefined
|
|
271
|
+
const jsonRpcProvider = isJsonRpcProvider(provider) ? provider : undefined
|
|
266
272
|
|
|
267
273
|
switch (request.method) {
|
|
268
274
|
case 'net_version': {
|
|
@@ -899,3 +905,9 @@ const permittedJsonRpcMethods = [
|
|
|
899
905
|
'sequence_getNetworks',
|
|
900
906
|
'sequence_setDefaultNetwork'
|
|
901
907
|
]
|
|
908
|
+
|
|
909
|
+
function isJsonRpcProvider(provider: any): provider is ethers.JsonRpcProvider {
|
|
910
|
+
return (
|
|
911
|
+
provider && typeof provider === 'object' && typeof provider.send === 'function' && typeof provider.getNetwork === 'function'
|
|
912
|
+
)
|
|
913
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -352,6 +352,8 @@ export interface TypedEventEmitter<Events> {
|
|
|
352
352
|
|
|
353
353
|
emit<E extends keyof Events>(event: E, ...args: Arguments<Events[E]>): boolean
|
|
354
354
|
eventNames(): (keyof Events | string | symbol)[]
|
|
355
|
+
|
|
356
|
+
// eslint-disable-next-line
|
|
355
357
|
listeners<E extends keyof Events>(event: E): Function[]
|
|
356
358
|
listenerCount<E extends keyof Events>(event: E): number
|
|
357
359
|
}
|