@snapshot-labs/snapshot.js 0.14.17 → 0.14.19
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/snapshot.cjs.js +9 -48
- package/dist/snapshot.esm.js +9 -48
- package/dist/snapshot.min.js +1 -1
- package/dist/src/sign/types.d.ts +0 -18
- package/package.json +1 -1
- package/src/sign/index.ts +4 -8
- package/src/sign/types.ts +1 -40
- package/src/utils.ts +2 -4
package/dist/snapshot.cjs.js
CHANGED
|
@@ -3889,15 +3889,13 @@ function getEnsSpaceController(id_1, network_1) {
|
|
|
3889
3889
|
return __awaiter(this, arguments, void 0, function* (id, network, options = {}) {
|
|
3890
3890
|
const spaceUri = yield getSpaceUri(id, network, options);
|
|
3891
3891
|
if (spaceUri) {
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
return spaceUri;
|
|
3892
|
+
if (address.isAddress(spaceUri))
|
|
3893
|
+
return address.getAddress(spaceUri);
|
|
3895
3894
|
const uriParts = spaceUri.split('/');
|
|
3896
3895
|
const position = uriParts.includes('testnet') ? 5 : 4;
|
|
3897
3896
|
const address$1 = uriParts[position];
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
return address$1;
|
|
3897
|
+
if (address.isAddress(address$1))
|
|
3898
|
+
return address.getAddress(address$1);
|
|
3901
3899
|
}
|
|
3902
3900
|
return yield getEnsOwner(id, network, options);
|
|
3903
3901
|
});
|
|
@@ -4108,7 +4106,7 @@ const cancelProposal2Types = {
|
|
|
4108
4106
|
{ name: 'from', type: 'string' },
|
|
4109
4107
|
{ name: 'space', type: 'string' },
|
|
4110
4108
|
{ name: 'timestamp', type: 'uint64' },
|
|
4111
|
-
{ name: 'proposal', type: '
|
|
4109
|
+
{ name: 'proposal', type: 'string' }
|
|
4112
4110
|
]
|
|
4113
4111
|
};
|
|
4114
4112
|
const voteTypes = {
|
|
@@ -4147,42 +4145,6 @@ const voteStringTypes = {
|
|
|
4147
4145
|
{ name: 'metadata', type: 'string' }
|
|
4148
4146
|
]
|
|
4149
4147
|
};
|
|
4150
|
-
const vote2Types = {
|
|
4151
|
-
Vote: [
|
|
4152
|
-
{ name: 'from', type: 'string' },
|
|
4153
|
-
{ name: 'space', type: 'string' },
|
|
4154
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
4155
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
4156
|
-
{ name: 'choice', type: 'uint32' },
|
|
4157
|
-
{ name: 'reason', type: 'string' },
|
|
4158
|
-
{ name: 'app', type: 'string' },
|
|
4159
|
-
{ name: 'metadata', type: 'string' }
|
|
4160
|
-
]
|
|
4161
|
-
};
|
|
4162
|
-
const voteArray2Types = {
|
|
4163
|
-
Vote: [
|
|
4164
|
-
{ name: 'from', type: 'string' },
|
|
4165
|
-
{ name: 'space', type: 'string' },
|
|
4166
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
4167
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
4168
|
-
{ name: 'choice', type: 'uint32[]' },
|
|
4169
|
-
{ name: 'reason', type: 'string' },
|
|
4170
|
-
{ name: 'app', type: 'string' },
|
|
4171
|
-
{ name: 'metadata', type: 'string' }
|
|
4172
|
-
]
|
|
4173
|
-
};
|
|
4174
|
-
const voteString2Types = {
|
|
4175
|
-
Vote: [
|
|
4176
|
-
{ name: 'from', type: 'string' },
|
|
4177
|
-
{ name: 'space', type: 'string' },
|
|
4178
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
4179
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
4180
|
-
{ name: 'choice', type: 'string' },
|
|
4181
|
-
{ name: 'reason', type: 'string' },
|
|
4182
|
-
{ name: 'app', type: 'string' },
|
|
4183
|
-
{ name: 'metadata', type: 'string' }
|
|
4184
|
-
]
|
|
4185
|
-
};
|
|
4186
4148
|
const followTypes = {
|
|
4187
4149
|
Follow: [
|
|
4188
4150
|
{ name: 'from', type: 'address' },
|
|
@@ -4373,16 +4335,15 @@ class Client {
|
|
|
4373
4335
|
message.app = '';
|
|
4374
4336
|
if (!message.metadata)
|
|
4375
4337
|
message.metadata = '{}';
|
|
4376
|
-
|
|
4377
|
-
let type = type2 ? vote2Types : voteTypes;
|
|
4338
|
+
let type = voteTypes;
|
|
4378
4339
|
if (['approval', 'ranked-choice'].includes(message.type))
|
|
4379
|
-
type =
|
|
4340
|
+
type = voteArrayTypes;
|
|
4380
4341
|
if (!isShutter && ['quadratic', 'weighted'].includes(message.type)) {
|
|
4381
|
-
type =
|
|
4342
|
+
type = voteStringTypes;
|
|
4382
4343
|
message.choice = JSON.stringify(message.choice);
|
|
4383
4344
|
}
|
|
4384
4345
|
if (isShutter)
|
|
4385
|
-
type =
|
|
4346
|
+
type = voteStringTypes;
|
|
4386
4347
|
delete message.privacy;
|
|
4387
4348
|
// @ts-ignore
|
|
4388
4349
|
delete message.type;
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -3879,15 +3879,13 @@ function getEnsSpaceController(id_1, network_1) {
|
|
|
3879
3879
|
return __awaiter(this, arguments, void 0, function* (id, network, options = {}) {
|
|
3880
3880
|
const spaceUri = yield getSpaceUri(id, network, options);
|
|
3881
3881
|
if (spaceUri) {
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
return spaceUri;
|
|
3882
|
+
if (isAddress(spaceUri))
|
|
3883
|
+
return getAddress(spaceUri);
|
|
3885
3884
|
const uriParts = spaceUri.split('/');
|
|
3886
3885
|
const position = uriParts.includes('testnet') ? 5 : 4;
|
|
3887
3886
|
const address = uriParts[position];
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
return address;
|
|
3887
|
+
if (isAddress(address))
|
|
3888
|
+
return getAddress(address);
|
|
3891
3889
|
}
|
|
3892
3890
|
return yield getEnsOwner(id, network, options);
|
|
3893
3891
|
});
|
|
@@ -4098,7 +4096,7 @@ const cancelProposal2Types = {
|
|
|
4098
4096
|
{ name: 'from', type: 'string' },
|
|
4099
4097
|
{ name: 'space', type: 'string' },
|
|
4100
4098
|
{ name: 'timestamp', type: 'uint64' },
|
|
4101
|
-
{ name: 'proposal', type: '
|
|
4099
|
+
{ name: 'proposal', type: 'string' }
|
|
4102
4100
|
]
|
|
4103
4101
|
};
|
|
4104
4102
|
const voteTypes = {
|
|
@@ -4137,42 +4135,6 @@ const voteStringTypes = {
|
|
|
4137
4135
|
{ name: 'metadata', type: 'string' }
|
|
4138
4136
|
]
|
|
4139
4137
|
};
|
|
4140
|
-
const vote2Types = {
|
|
4141
|
-
Vote: [
|
|
4142
|
-
{ name: 'from', type: 'string' },
|
|
4143
|
-
{ name: 'space', type: 'string' },
|
|
4144
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
4145
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
4146
|
-
{ name: 'choice', type: 'uint32' },
|
|
4147
|
-
{ name: 'reason', type: 'string' },
|
|
4148
|
-
{ name: 'app', type: 'string' },
|
|
4149
|
-
{ name: 'metadata', type: 'string' }
|
|
4150
|
-
]
|
|
4151
|
-
};
|
|
4152
|
-
const voteArray2Types = {
|
|
4153
|
-
Vote: [
|
|
4154
|
-
{ name: 'from', type: 'string' },
|
|
4155
|
-
{ name: 'space', type: 'string' },
|
|
4156
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
4157
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
4158
|
-
{ name: 'choice', type: 'uint32[]' },
|
|
4159
|
-
{ name: 'reason', type: 'string' },
|
|
4160
|
-
{ name: 'app', type: 'string' },
|
|
4161
|
-
{ name: 'metadata', type: 'string' }
|
|
4162
|
-
]
|
|
4163
|
-
};
|
|
4164
|
-
const voteString2Types = {
|
|
4165
|
-
Vote: [
|
|
4166
|
-
{ name: 'from', type: 'string' },
|
|
4167
|
-
{ name: 'space', type: 'string' },
|
|
4168
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
4169
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
4170
|
-
{ name: 'choice', type: 'string' },
|
|
4171
|
-
{ name: 'reason', type: 'string' },
|
|
4172
|
-
{ name: 'app', type: 'string' },
|
|
4173
|
-
{ name: 'metadata', type: 'string' }
|
|
4174
|
-
]
|
|
4175
|
-
};
|
|
4176
4138
|
const followTypes = {
|
|
4177
4139
|
Follow: [
|
|
4178
4140
|
{ name: 'from', type: 'address' },
|
|
@@ -4363,16 +4325,15 @@ class Client {
|
|
|
4363
4325
|
message.app = '';
|
|
4364
4326
|
if (!message.metadata)
|
|
4365
4327
|
message.metadata = '{}';
|
|
4366
|
-
|
|
4367
|
-
let type = type2 ? vote2Types : voteTypes;
|
|
4328
|
+
let type = voteTypes;
|
|
4368
4329
|
if (['approval', 'ranked-choice'].includes(message.type))
|
|
4369
|
-
type =
|
|
4330
|
+
type = voteArrayTypes;
|
|
4370
4331
|
if (!isShutter && ['quadratic', 'weighted'].includes(message.type)) {
|
|
4371
|
-
type =
|
|
4332
|
+
type = voteStringTypes;
|
|
4372
4333
|
message.choice = JSON.stringify(message.choice);
|
|
4373
4334
|
}
|
|
4374
4335
|
if (isShutter)
|
|
4375
|
-
type =
|
|
4336
|
+
type = voteStringTypes;
|
|
4376
4337
|
delete message.privacy;
|
|
4377
4338
|
// @ts-ignore
|
|
4378
4339
|
delete message.type;
|