@snapshot-labs/snapshot.js 0.4.108 → 0.5.0-beta.1
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/LICENSE +0 -0
- package/dist/sign/index.d.ts +2 -1
- package/dist/snapshot.cjs.js +17 -14
- package/dist/snapshot.esm.js +17 -14
- package/dist/snapshot.min.js +3 -3
- package/package.json +1 -1
- package/src/networks.json +8 -8
- package/src/sign/index.ts +8 -3
- package/src/utils/dist/provider.js +47 -0
package/LICENSE
CHANGED
|
File without changes
|
package/dist/sign/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export declare const domain: {
|
|
|
7
7
|
};
|
|
8
8
|
export default class Client {
|
|
9
9
|
readonly address: string;
|
|
10
|
-
|
|
10
|
+
readonly options: any;
|
|
11
|
+
constructor(address?: string, options?: {});
|
|
11
12
|
sign(web3: Web3Provider | Wallet, address: string, message: any, types: any): Promise<unknown>;
|
|
12
13
|
send(envelop: any): Promise<unknown>;
|
|
13
14
|
space(web3: Web3Provider | Wallet, address: string, message: Space): Promise<unknown>;
|
package/dist/snapshot.cjs.js
CHANGED
|
@@ -300,12 +300,14 @@ var domain = {
|
|
|
300
300
|
// chainId: 1
|
|
301
301
|
};
|
|
302
302
|
var Client = /** @class */ (function () {
|
|
303
|
-
function Client(address) {
|
|
303
|
+
function Client(address, options) {
|
|
304
304
|
if (address === void 0) { address = constants.livenet.sequencer; }
|
|
305
|
+
if (options === void 0) { options = {}; }
|
|
305
306
|
address = address.replace(constants.livenet.hub, constants.livenet.sequencer);
|
|
306
307
|
address = address.replace(constants.testnet.hub, constants.testnet.sequencer);
|
|
307
308
|
address = address.replace(constants.local.hub, constants.local.sequencer);
|
|
308
309
|
this.address = address;
|
|
310
|
+
this.options = options;
|
|
309
311
|
}
|
|
310
312
|
Client.prototype.sign = function (web3, address$1, message, types) {
|
|
311
313
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -323,18 +325,19 @@ var Client = /** @class */ (function () {
|
|
|
323
325
|
case 1:
|
|
324
326
|
sig = _a.sent();
|
|
325
327
|
return [4 /*yield*/, this.send({ address: checksumAddress, sig: sig, data: data })];
|
|
326
|
-
case 2:
|
|
327
|
-
//console.log('Sign', { address: checksumAddress, sig, data });
|
|
328
|
-
return [2 /*return*/, _a.sent()];
|
|
328
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
329
329
|
}
|
|
330
330
|
});
|
|
331
331
|
});
|
|
332
332
|
};
|
|
333
333
|
Client.prototype.send = function (envelop) {
|
|
334
334
|
return __awaiter(this, void 0, void 0, function () {
|
|
335
|
-
var init;
|
|
336
|
-
var _this = this;
|
|
335
|
+
var address, init;
|
|
337
336
|
return __generator(this, function (_a) {
|
|
337
|
+
address = this.address;
|
|
338
|
+
console.log('sig', envelop.sig);
|
|
339
|
+
if (envelop.sig === '0x' && this.options.relayerURL)
|
|
340
|
+
address = this.options.relayerURL;
|
|
338
341
|
init = {
|
|
339
342
|
method: 'POST',
|
|
340
343
|
headers: {
|
|
@@ -344,7 +347,7 @@ var Client = /** @class */ (function () {
|
|
|
344
347
|
body: JSON.stringify(envelop)
|
|
345
348
|
};
|
|
346
349
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
347
|
-
fetch__default['default'](
|
|
350
|
+
fetch__default['default'](address, init)
|
|
348
351
|
.then(function (res) {
|
|
349
352
|
if (res.ok)
|
|
350
353
|
return resolve(res.json());
|
|
@@ -2612,21 +2615,21 @@ var networks = {
|
|
|
2612
2615
|
},
|
|
2613
2616
|
logo: "ipfs://QmVH3uyPQDcrPC1DMUWCb7HayMv1oMAiKehuWwP2C2fdgM"
|
|
2614
2617
|
},
|
|
2615
|
-
"
|
|
2616
|
-
key: "
|
|
2618
|
+
"1072": {
|
|
2619
|
+
key: "1072",
|
|
2617
2620
|
name: "Shimmer EVM Testnet",
|
|
2618
2621
|
shortName: "ShimmerEVM",
|
|
2619
|
-
chainId:
|
|
2622
|
+
chainId: 1072,
|
|
2620
2623
|
network: "testnet",
|
|
2621
2624
|
testnet: true,
|
|
2622
|
-
multicall: "
|
|
2625
|
+
multicall: "0x751d21047C116413895c259f3f305e38C10B7cF6",
|
|
2623
2626
|
rpc: [
|
|
2624
|
-
"https://
|
|
2627
|
+
"https://archive.evm.testnet.shimmer.network/v1/chains/rms1pr75wa5xuepg2hew44vnr28wz5h6n6x99zptk2g68sp2wuu2karywgrztx3/evm"
|
|
2625
2628
|
],
|
|
2626
2629
|
explorer: {
|
|
2627
2630
|
url: "https://explorer.evm.testnet.shimmer.network/"
|
|
2628
2631
|
},
|
|
2629
|
-
start:
|
|
2632
|
+
start: 10614,
|
|
2630
2633
|
logo: "ipfs://QmYGxmEhV6djksUk97pdE9TmL6DXm9KW8BP7pwUv8pqp8r"
|
|
2631
2634
|
},
|
|
2632
2635
|
"1088": {
|
|
@@ -3626,7 +3629,7 @@ var networks = {
|
|
|
3626
3629
|
url: "https://goerli.basescan.org/"
|
|
3627
3630
|
},
|
|
3628
3631
|
start: 1151797,
|
|
3629
|
-
logo: "ipfs://
|
|
3632
|
+
logo: "ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv"
|
|
3630
3633
|
},
|
|
3631
3634
|
"333888": {
|
|
3632
3635
|
key: "333888",
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -291,12 +291,14 @@ var domain = {
|
|
|
291
291
|
// chainId: 1
|
|
292
292
|
};
|
|
293
293
|
var Client = /** @class */ (function () {
|
|
294
|
-
function Client(address) {
|
|
294
|
+
function Client(address, options) {
|
|
295
295
|
if (address === void 0) { address = constants.livenet.sequencer; }
|
|
296
|
+
if (options === void 0) { options = {}; }
|
|
296
297
|
address = address.replace(constants.livenet.hub, constants.livenet.sequencer);
|
|
297
298
|
address = address.replace(constants.testnet.hub, constants.testnet.sequencer);
|
|
298
299
|
address = address.replace(constants.local.hub, constants.local.sequencer);
|
|
299
300
|
this.address = address;
|
|
301
|
+
this.options = options;
|
|
300
302
|
}
|
|
301
303
|
Client.prototype.sign = function (web3, address, message, types) {
|
|
302
304
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -314,18 +316,19 @@ var Client = /** @class */ (function () {
|
|
|
314
316
|
case 1:
|
|
315
317
|
sig = _a.sent();
|
|
316
318
|
return [4 /*yield*/, this.send({ address: checksumAddress, sig: sig, data: data })];
|
|
317
|
-
case 2:
|
|
318
|
-
//console.log('Sign', { address: checksumAddress, sig, data });
|
|
319
|
-
return [2 /*return*/, _a.sent()];
|
|
319
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
320
320
|
}
|
|
321
321
|
});
|
|
322
322
|
});
|
|
323
323
|
};
|
|
324
324
|
Client.prototype.send = function (envelop) {
|
|
325
325
|
return __awaiter(this, void 0, void 0, function () {
|
|
326
|
-
var init;
|
|
327
|
-
var _this = this;
|
|
326
|
+
var address, init;
|
|
328
327
|
return __generator(this, function (_a) {
|
|
328
|
+
address = this.address;
|
|
329
|
+
console.log('sig', envelop.sig);
|
|
330
|
+
if (envelop.sig === '0x' && this.options.relayerURL)
|
|
331
|
+
address = this.options.relayerURL;
|
|
329
332
|
init = {
|
|
330
333
|
method: 'POST',
|
|
331
334
|
headers: {
|
|
@@ -335,7 +338,7 @@ var Client = /** @class */ (function () {
|
|
|
335
338
|
body: JSON.stringify(envelop)
|
|
336
339
|
};
|
|
337
340
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
338
|
-
fetch(
|
|
341
|
+
fetch(address, init)
|
|
339
342
|
.then(function (res) {
|
|
340
343
|
if (res.ok)
|
|
341
344
|
return resolve(res.json());
|
|
@@ -2603,21 +2606,21 @@ var networks = {
|
|
|
2603
2606
|
},
|
|
2604
2607
|
logo: "ipfs://QmVH3uyPQDcrPC1DMUWCb7HayMv1oMAiKehuWwP2C2fdgM"
|
|
2605
2608
|
},
|
|
2606
|
-
"
|
|
2607
|
-
key: "
|
|
2609
|
+
"1072": {
|
|
2610
|
+
key: "1072",
|
|
2608
2611
|
name: "Shimmer EVM Testnet",
|
|
2609
2612
|
shortName: "ShimmerEVM",
|
|
2610
|
-
chainId:
|
|
2613
|
+
chainId: 1072,
|
|
2611
2614
|
network: "testnet",
|
|
2612
2615
|
testnet: true,
|
|
2613
|
-
multicall: "
|
|
2616
|
+
multicall: "0x751d21047C116413895c259f3f305e38C10B7cF6",
|
|
2614
2617
|
rpc: [
|
|
2615
|
-
"https://
|
|
2618
|
+
"https://archive.evm.testnet.shimmer.network/v1/chains/rms1pr75wa5xuepg2hew44vnr28wz5h6n6x99zptk2g68sp2wuu2karywgrztx3/evm"
|
|
2616
2619
|
],
|
|
2617
2620
|
explorer: {
|
|
2618
2621
|
url: "https://explorer.evm.testnet.shimmer.network/"
|
|
2619
2622
|
},
|
|
2620
|
-
start:
|
|
2623
|
+
start: 10614,
|
|
2621
2624
|
logo: "ipfs://QmYGxmEhV6djksUk97pdE9TmL6DXm9KW8BP7pwUv8pqp8r"
|
|
2622
2625
|
},
|
|
2623
2626
|
"1088": {
|
|
@@ -3617,7 +3620,7 @@ var networks = {
|
|
|
3617
3620
|
url: "https://goerli.basescan.org/"
|
|
3618
3621
|
},
|
|
3619
3622
|
start: 1151797,
|
|
3620
|
-
logo: "ipfs://
|
|
3623
|
+
logo: "ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv"
|
|
3621
3624
|
},
|
|
3622
3625
|
"333888": {
|
|
3623
3626
|
key: "333888",
|