omnipin 1.5.2 → 1.6.0
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/cli.js +205 -88
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4151,6 +4151,12 @@ class MissingCLIArgsError extends Error {
|
|
|
4151
4151
|
super(`Missing CLI arguments: ${args.join(", ")}`);
|
|
4152
4152
|
}
|
|
4153
4153
|
}
|
|
4154
|
+
class InvalidLabelhashError extends Error {
|
|
4155
|
+
name = "InvalidLabelhashError";
|
|
4156
|
+
constructor({ labelhash: labelhash2, details }) {
|
|
4157
|
+
super(`${labelhash2}: ${details}`);
|
|
4158
|
+
}
|
|
4159
|
+
}
|
|
4154
4160
|
var responseStatus = (status) => {
|
|
4155
4161
|
if (status < 300)
|
|
4156
4162
|
return styleText("bgGreen", status.toString());
|
|
@@ -12702,10 +12708,10 @@ function from12(abiItem, options = {}) {
|
|
|
12702
12708
|
...prepare3 ? { hash: getSignatureHash(item) } : {}
|
|
12703
12709
|
};
|
|
12704
12710
|
}
|
|
12705
|
-
function fromAbi(
|
|
12711
|
+
function fromAbi(abi14, name62, options) {
|
|
12706
12712
|
const { args = [], prepare: prepare3 = true } = options ?? {};
|
|
12707
12713
|
const isSelector = validate(name62, { strict: false });
|
|
12708
|
-
const abiItems =
|
|
12714
|
+
const abiItems = abi14.filter((abiItem2) => {
|
|
12709
12715
|
if (isSelector) {
|
|
12710
12716
|
if (abiItem2.type === "function" || abiItem2.type === "error")
|
|
12711
12717
|
return getSelector(abiItem2) === slice(name62, 0, 4);
|
|
@@ -12777,8 +12783,8 @@ function fromAbi(abi12, name62, options) {
|
|
|
12777
12783
|
function getSelector(...parameters) {
|
|
12778
12784
|
const abiItem = (() => {
|
|
12779
12785
|
if (Array.isArray(parameters[0])) {
|
|
12780
|
-
const [
|
|
12781
|
-
return fromAbi(
|
|
12786
|
+
const [abi14, name62] = parameters;
|
|
12787
|
+
return fromAbi(abi14, name62);
|
|
12782
12788
|
}
|
|
12783
12789
|
return parameters[0];
|
|
12784
12790
|
})();
|
|
@@ -12787,8 +12793,8 @@ function getSelector(...parameters) {
|
|
|
12787
12793
|
function getSignature(...parameters) {
|
|
12788
12794
|
const abiItem = (() => {
|
|
12789
12795
|
if (Array.isArray(parameters[0])) {
|
|
12790
|
-
const [
|
|
12791
|
-
return fromAbi(
|
|
12796
|
+
const [abi14, name62] = parameters;
|
|
12797
|
+
return fromAbi(abi14, name62);
|
|
12792
12798
|
}
|
|
12793
12799
|
return parameters[0];
|
|
12794
12800
|
})();
|
|
@@ -12802,8 +12808,8 @@ function getSignature(...parameters) {
|
|
|
12802
12808
|
function getSignatureHash(...parameters) {
|
|
12803
12809
|
const abiItem = (() => {
|
|
12804
12810
|
if (Array.isArray(parameters[0])) {
|
|
12805
|
-
const [
|
|
12806
|
-
return fromAbi(
|
|
12811
|
+
const [abi14, name62] = parameters;
|
|
12812
|
+
return fromAbi(abi14, name62);
|
|
12807
12813
|
}
|
|
12808
12814
|
return parameters[0];
|
|
12809
12815
|
})();
|
|
@@ -13647,8 +13653,8 @@ class InvalidTypeError extends BaseError {
|
|
|
13647
13653
|
function decode9(...parameters) {
|
|
13648
13654
|
const [abiError, data, options = {}] = (() => {
|
|
13649
13655
|
if (Array.isArray(parameters[0])) {
|
|
13650
|
-
const [
|
|
13651
|
-
return [fromAbi2(
|
|
13656
|
+
const [abi14, name62, data2, options2] = parameters;
|
|
13657
|
+
return [fromAbi2(abi14, name62), data2, options2];
|
|
13652
13658
|
}
|
|
13653
13659
|
return parameters;
|
|
13654
13660
|
})();
|
|
@@ -13667,7 +13673,7 @@ function decode9(...parameters) {
|
|
|
13667
13673
|
function from14(abiError, options = {}) {
|
|
13668
13674
|
return from12(abiError, options);
|
|
13669
13675
|
}
|
|
13670
|
-
function fromAbi2(
|
|
13676
|
+
function fromAbi2(abi14, name62, options) {
|
|
13671
13677
|
if (name62 === "Error")
|
|
13672
13678
|
return solidityError;
|
|
13673
13679
|
if (name62 === "Panic")
|
|
@@ -13679,7 +13685,7 @@ function fromAbi2(abi12, name62, options) {
|
|
|
13679
13685
|
if (selector === solidityPanicSelector)
|
|
13680
13686
|
return solidityPanic;
|
|
13681
13687
|
}
|
|
13682
|
-
const item = fromAbi(
|
|
13688
|
+
const item = fromAbi(abi14, name62, options);
|
|
13683
13689
|
if (item.type !== "error")
|
|
13684
13690
|
throw new NotFoundError({ name: name62, type: "error" });
|
|
13685
13691
|
return item;
|
|
@@ -14432,8 +14438,8 @@ var waitForTransaction = async (provider, hash2) => {
|
|
|
14432
14438
|
function decodeResult(...parameters) {
|
|
14433
14439
|
const [abiFunction, data, options = {}] = (() => {
|
|
14434
14440
|
if (Array.isArray(parameters[0])) {
|
|
14435
|
-
const [
|
|
14436
|
-
return [fromAbi3(
|
|
14441
|
+
const [abi14, name62, data2, options2] = parameters;
|
|
14442
|
+
return [fromAbi3(abi14, name62), data2, options2];
|
|
14437
14443
|
}
|
|
14438
14444
|
return parameters;
|
|
14439
14445
|
})();
|
|
@@ -14450,8 +14456,8 @@ function decodeResult(...parameters) {
|
|
|
14450
14456
|
function encodeData2(...parameters) {
|
|
14451
14457
|
const [abiFunction, args = []] = (() => {
|
|
14452
14458
|
if (Array.isArray(parameters[0])) {
|
|
14453
|
-
const [
|
|
14454
|
-
return [fromAbi3(
|
|
14459
|
+
const [abi14, name62, args3] = parameters;
|
|
14460
|
+
return [fromAbi3(abi14, name62, { args: args3 }), args3];
|
|
14455
14461
|
}
|
|
14456
14462
|
const [abiFunction2, args2] = parameters;
|
|
14457
14463
|
return [abiFunction2, args2];
|
|
@@ -14464,8 +14470,8 @@ function encodeData2(...parameters) {
|
|
|
14464
14470
|
const data = args.length > 0 ? encode7(item.inputs, args) : void 0;
|
|
14465
14471
|
return data ? concat(selector, data) : selector;
|
|
14466
14472
|
}
|
|
14467
|
-
function fromAbi3(
|
|
14468
|
-
const item = fromAbi(
|
|
14473
|
+
function fromAbi3(abi14, name62, options) {
|
|
14474
|
+
const item = fromAbi(abi14, name62, options);
|
|
14469
14475
|
if (item.type !== "function")
|
|
14470
14476
|
throw new NotFoundError({ name: name62, type: "function" });
|
|
14471
14477
|
return item;
|
|
@@ -15203,7 +15209,8 @@ var uploadPieceToDataSet = async ({
|
|
|
15203
15209
|
const dataSet = await getDataSet({ dataSetId: datasetId, chain });
|
|
15204
15210
|
clientDataSetId = dataSet.clientDataSetId;
|
|
15205
15211
|
}
|
|
15206
|
-
|
|
15212
|
+
if (verbose)
|
|
15213
|
+
logger.info(`Client data set ID: ${clientDataSetId}`);
|
|
15207
15214
|
const payload = getSignPayload({
|
|
15208
15215
|
types: {
|
|
15209
15216
|
AddPieces: [
|
|
@@ -15351,18 +15358,22 @@ var uploadToFilecoin = async ({
|
|
|
15351
15358
|
providerAddress,
|
|
15352
15359
|
chain
|
|
15353
15360
|
});
|
|
15354
|
-
|
|
15361
|
+
if (verbose)
|
|
15362
|
+
logger.info(`Filecoin SP ID: ${providerId}`);
|
|
15355
15363
|
const payee = await getProviderPayee({ id: providerId, chain });
|
|
15356
|
-
|
|
15364
|
+
if (verbose)
|
|
15365
|
+
logger.info(`Filecoin SP Payee: ${payee}`);
|
|
15357
15366
|
const { perMonth } = await getServicePrice({ size: size42, chain });
|
|
15358
15367
|
logger.info(`Price for storage: ${format(perMonth, 18)} USDfc/month`);
|
|
15359
|
-
|
|
15368
|
+
if (verbose)
|
|
15369
|
+
logger.info("Looking up existing datasets");
|
|
15360
15370
|
const dataSets = await getClientDataSets({ address, chain });
|
|
15361
15371
|
let datasetId;
|
|
15362
15372
|
let clientDataSetId;
|
|
15363
15373
|
const providerDataSets = dataSets.filter((set) => set.providerId === providerId);
|
|
15364
15374
|
if (providerDataSets.length === 0) {
|
|
15365
|
-
|
|
15375
|
+
if (verbose)
|
|
15376
|
+
logger.info("No dataset found. Creating.");
|
|
15366
15377
|
const {
|
|
15367
15378
|
clientDataSetId: clientId,
|
|
15368
15379
|
hash: hash3,
|
|
@@ -29130,6 +29141,12 @@ function unwrapLabelhash(label) {
|
|
|
29130
29141
|
return null;
|
|
29131
29142
|
return hash2;
|
|
29132
29143
|
}
|
|
29144
|
+
function labelhash(label) {
|
|
29145
|
+
const result2 = new Uint8Array(32).fill(0);
|
|
29146
|
+
if (!label)
|
|
29147
|
+
return fromBytes(result2);
|
|
29148
|
+
return unwrapLabelhash(label) || keccak256(fromString(label));
|
|
29149
|
+
}
|
|
29133
29150
|
function namehash(name12) {
|
|
29134
29151
|
let result2 = new Uint8Array(32).fill(0);
|
|
29135
29152
|
if (!name12)
|
|
@@ -29145,6 +29162,151 @@ function namehash(name12) {
|
|
|
29145
29162
|
function normalize(name12) {
|
|
29146
29163
|
return ens_normalize(name12);
|
|
29147
29164
|
}
|
|
29165
|
+
var abi12 = {
|
|
29166
|
+
constant: true,
|
|
29167
|
+
inputs: [
|
|
29168
|
+
{
|
|
29169
|
+
name: "node",
|
|
29170
|
+
type: "bytes32"
|
|
29171
|
+
}
|
|
29172
|
+
],
|
|
29173
|
+
name: "addr",
|
|
29174
|
+
outputs: [
|
|
29175
|
+
{
|
|
29176
|
+
name: "addr",
|
|
29177
|
+
type: "address"
|
|
29178
|
+
}
|
|
29179
|
+
],
|
|
29180
|
+
payable: false,
|
|
29181
|
+
stateMutability: "view",
|
|
29182
|
+
type: "function"
|
|
29183
|
+
};
|
|
29184
|
+
var encodeEnsAddressRecordRequest = (name12) => encodeData2(abi12, [namehash(name12)]);
|
|
29185
|
+
var abi13 = {
|
|
29186
|
+
inputs: [
|
|
29187
|
+
{
|
|
29188
|
+
name: "name",
|
|
29189
|
+
type: "bytes"
|
|
29190
|
+
},
|
|
29191
|
+
{
|
|
29192
|
+
name: "data",
|
|
29193
|
+
type: "bytes"
|
|
29194
|
+
}
|
|
29195
|
+
],
|
|
29196
|
+
name: "resolve",
|
|
29197
|
+
outputs: [
|
|
29198
|
+
{
|
|
29199
|
+
name: "data",
|
|
29200
|
+
type: "bytes"
|
|
29201
|
+
},
|
|
29202
|
+
{
|
|
29203
|
+
name: "resolver",
|
|
29204
|
+
type: "address"
|
|
29205
|
+
}
|
|
29206
|
+
],
|
|
29207
|
+
stateMutability: "view",
|
|
29208
|
+
type: "function"
|
|
29209
|
+
};
|
|
29210
|
+
function encodeLabelhash(hash2) {
|
|
29211
|
+
if (!hash2.startsWith("0x"))
|
|
29212
|
+
throw new InvalidLabelhashError({
|
|
29213
|
+
labelhash: hash2,
|
|
29214
|
+
details: "Expected labelhash to start with 0x"
|
|
29215
|
+
});
|
|
29216
|
+
if (hash2.length !== 66)
|
|
29217
|
+
throw new InvalidLabelhashError({
|
|
29218
|
+
labelhash: hash2,
|
|
29219
|
+
details: "Expected labelhash to have a length of 66"
|
|
29220
|
+
});
|
|
29221
|
+
return `[${hash2.slice(2)}]`;
|
|
29222
|
+
}
|
|
29223
|
+
function packetToBytes(packet) {
|
|
29224
|
+
const value = packet.replace(/^\.|\.$/gm, "");
|
|
29225
|
+
if (value.length === 0)
|
|
29226
|
+
return new Uint8Array(1);
|
|
29227
|
+
const bytes2 = new Uint8Array(fromString2(value).byteLength + 2);
|
|
29228
|
+
let offset = 0;
|
|
29229
|
+
const list3 = value.split(".");
|
|
29230
|
+
for (let i = 0; i < list3.length; i += 1) {
|
|
29231
|
+
let encoded = fromString2(list3[i]);
|
|
29232
|
+
if (encoded.byteLength > 255)
|
|
29233
|
+
encoded = fromString2(encodeLabelhash(labelhash(list3[i])));
|
|
29234
|
+
bytes2[offset] = encoded.length;
|
|
29235
|
+
bytes2.set(encoded, offset + 1);
|
|
29236
|
+
offset += encoded.length + 1;
|
|
29237
|
+
}
|
|
29238
|
+
if (bytes2.byteLength !== offset + 1)
|
|
29239
|
+
return bytes2.slice(0, offset + 1);
|
|
29240
|
+
return bytes2;
|
|
29241
|
+
}
|
|
29242
|
+
var resolveEnsName = async ({
|
|
29243
|
+
provider,
|
|
29244
|
+
name: name12
|
|
29245
|
+
}) => {
|
|
29246
|
+
const result2 = await provider.request({
|
|
29247
|
+
method: "eth_call",
|
|
29248
|
+
params: [
|
|
29249
|
+
{
|
|
29250
|
+
data: encodeData2(abi13, [
|
|
29251
|
+
toHex(packetToBytes(name12)),
|
|
29252
|
+
encodeEnsAddressRecordRequest(name12)
|
|
29253
|
+
]),
|
|
29254
|
+
to: "0xeEeEEEeE14D718C2B47D9923Deab1335E144EeEe"
|
|
29255
|
+
},
|
|
29256
|
+
"latest"
|
|
29257
|
+
]
|
|
29258
|
+
});
|
|
29259
|
+
return `0x${decodeResult(abi13, result2)[0].slice(-40)}`;
|
|
29260
|
+
};
|
|
29261
|
+
function parseEip3770Address(fullAddress) {
|
|
29262
|
+
const parts = fullAddress.split(":");
|
|
29263
|
+
const address = checksum2(parts.length > 1 ? parts[1] : parts[0]);
|
|
29264
|
+
const prefix2 = parts.length > 1 ? parts[0] : "";
|
|
29265
|
+
return { prefix: prefix2, address };
|
|
29266
|
+
}
|
|
29267
|
+
function validateEthereumAddress(address) {
|
|
29268
|
+
if (!validate4(address))
|
|
29269
|
+
throw new Error(`Invalid Ethereum address ${address}`);
|
|
29270
|
+
}
|
|
29271
|
+
var isValidEip3770NetworkPrefix = (prefix2) => networks.some(({ shortName }) => shortName === prefix2);
|
|
29272
|
+
function getEip3770NetworkPrefixFromChainId(chainId) {
|
|
29273
|
+
const network = networks.find((network2) => chainId === network2.chainId);
|
|
29274
|
+
if (!network)
|
|
29275
|
+
throw new Error("No network prefix supported for the current chainId");
|
|
29276
|
+
return network.shortName;
|
|
29277
|
+
}
|
|
29278
|
+
function validateEip3770NetworkPrefix(prefix2, currentChainId) {
|
|
29279
|
+
const isCurrentNetworkPrefix = prefix2 === getEip3770NetworkPrefixFromChainId(currentChainId);
|
|
29280
|
+
if (!isValidEip3770NetworkPrefix(prefix2) || !isCurrentNetworkPrefix) {
|
|
29281
|
+
throw new Error("The network prefix must match the current network");
|
|
29282
|
+
}
|
|
29283
|
+
}
|
|
29284
|
+
function getEip3770Address({
|
|
29285
|
+
fullAddress,
|
|
29286
|
+
chainId
|
|
29287
|
+
}) {
|
|
29288
|
+
const { address, prefix: prefix2 } = parseEip3770Address(fullAddress);
|
|
29289
|
+
validateEthereumAddress(address);
|
|
29290
|
+
if (prefix2)
|
|
29291
|
+
validateEip3770NetworkPrefix(prefix2, chainId);
|
|
29292
|
+
return { address, prefix: prefix2 };
|
|
29293
|
+
}
|
|
29294
|
+
var networks = [
|
|
29295
|
+
{ chainId: 1, shortName: "eth" },
|
|
29296
|
+
{ chainId: 11155111, shortName: "sep" }
|
|
29297
|
+
];
|
|
29298
|
+
var getExactAddress = async ({
|
|
29299
|
+
addressOrEns,
|
|
29300
|
+
provider,
|
|
29301
|
+
chain
|
|
29302
|
+
}) => {
|
|
29303
|
+
if (addressOrEns.endsWith(".eth"))
|
|
29304
|
+
return await resolveEnsName({ name: addressOrEns, provider });
|
|
29305
|
+
return getEip3770Address({
|
|
29306
|
+
fullAddress: addressOrEns,
|
|
29307
|
+
chainId: chain.id
|
|
29308
|
+
}).address;
|
|
29309
|
+
};
|
|
29148
29310
|
var varint6 = __toESM(require_varint(), 1);
|
|
29149
29311
|
var IFPS_CODEC = 227;
|
|
29150
29312
|
var SWARM_CODEC = 228;
|
|
@@ -29265,43 +29427,6 @@ var getNonce = {
|
|
|
29265
29427
|
}
|
|
29266
29428
|
]
|
|
29267
29429
|
};
|
|
29268
|
-
function parseEip3770Address(fullAddress) {
|
|
29269
|
-
const parts = fullAddress.split(":");
|
|
29270
|
-
const address = checksum2(parts.length > 1 ? parts[1] : parts[0]);
|
|
29271
|
-
const prefix2 = parts.length > 1 ? parts[0] : "";
|
|
29272
|
-
return { prefix: prefix2, address };
|
|
29273
|
-
}
|
|
29274
|
-
function validateEthereumAddress(address) {
|
|
29275
|
-
if (!validate4(address))
|
|
29276
|
-
throw new Error(`Invalid Ethereum address ${address}`);
|
|
29277
|
-
}
|
|
29278
|
-
var isValidEip3770NetworkPrefix = (prefix2) => networks.some(({ shortName }) => shortName === prefix2);
|
|
29279
|
-
function getEip3770NetworkPrefixFromChainId(chainId) {
|
|
29280
|
-
const network = networks.find((network2) => chainId === network2.chainId);
|
|
29281
|
-
if (!network)
|
|
29282
|
-
throw new Error("No network prefix supported for the current chainId");
|
|
29283
|
-
return network.shortName;
|
|
29284
|
-
}
|
|
29285
|
-
function validateEip3770NetworkPrefix(prefix2, currentChainId) {
|
|
29286
|
-
const isCurrentNetworkPrefix = prefix2 === getEip3770NetworkPrefixFromChainId(currentChainId);
|
|
29287
|
-
if (!isValidEip3770NetworkPrefix(prefix2) || !isCurrentNetworkPrefix) {
|
|
29288
|
-
throw new Error("The network prefix must match the current network");
|
|
29289
|
-
}
|
|
29290
|
-
}
|
|
29291
|
-
function getEip3770Address({
|
|
29292
|
-
fullAddress,
|
|
29293
|
-
chainId
|
|
29294
|
-
}) {
|
|
29295
|
-
const { address, prefix: prefix2 } = parseEip3770Address(fullAddress);
|
|
29296
|
-
validateEthereumAddress(address);
|
|
29297
|
-
if (prefix2)
|
|
29298
|
-
validateEip3770NetworkPrefix(prefix2, chainId);
|
|
29299
|
-
return { address, prefix: prefix2 };
|
|
29300
|
-
}
|
|
29301
|
-
var networks = [
|
|
29302
|
-
{ chainId: 1, shortName: "eth" },
|
|
29303
|
-
{ chainId: 11155111, shortName: "sep" }
|
|
29304
|
-
];
|
|
29305
29430
|
var chainToSafeApiUrl = (chainName) => `https://safe-transaction-${chainName}.safe.global`;
|
|
29306
29431
|
var zeroAddress = "0x0000000000000000000000000000000000000000";
|
|
29307
29432
|
var prepareSafeTransactionData = async ({
|
|
@@ -29344,11 +29469,6 @@ var generateSafeTransactionSignature = async ({
|
|
|
29344
29469
|
chainId,
|
|
29345
29470
|
privateKey
|
|
29346
29471
|
}) => {
|
|
29347
|
-
const { address: safeAddressWithoutPrefix } = getEip3770Address({
|
|
29348
|
-
fullAddress: safeAddress,
|
|
29349
|
-
chainId
|
|
29350
|
-
});
|
|
29351
|
-
const { address: to2 } = getEip3770Address({ fullAddress: txData.to, chainId });
|
|
29352
29472
|
const payload = getSignPayload({
|
|
29353
29473
|
types: {
|
|
29354
29474
|
EIP712Domain: [
|
|
@@ -29377,10 +29497,10 @@ var generateSafeTransactionSignature = async ({
|
|
|
29377
29497
|
primaryType: "SafeTx",
|
|
29378
29498
|
domain: {
|
|
29379
29499
|
chainId: BigInt(chainId),
|
|
29380
|
-
verifyingContract:
|
|
29500
|
+
verifyingContract: safeAddress
|
|
29381
29501
|
},
|
|
29382
29502
|
message: {
|
|
29383
|
-
to:
|
|
29503
|
+
to: txData.to,
|
|
29384
29504
|
value: 0n,
|
|
29385
29505
|
data: txData.data ?? "0x",
|
|
29386
29506
|
operation: txData.operation,
|
|
@@ -29400,19 +29520,14 @@ var proposeTransaction = async ({
|
|
|
29400
29520
|
chainName,
|
|
29401
29521
|
address,
|
|
29402
29522
|
safeTxHash,
|
|
29403
|
-
senderSignature
|
|
29404
|
-
chainId
|
|
29523
|
+
senderSignature
|
|
29405
29524
|
}) => {
|
|
29406
29525
|
Object.defineProperty(BigInt.prototype, "toJSON", {
|
|
29407
29526
|
get() {
|
|
29408
29527
|
return () => String(this);
|
|
29409
29528
|
}
|
|
29410
29529
|
});
|
|
29411
|
-
const
|
|
29412
|
-
fullAddress: safeAddress,
|
|
29413
|
-
chainId
|
|
29414
|
-
});
|
|
29415
|
-
const res = await fetch(`${chainToSafeApiUrl(chainName)}/api/v1/safes/${safe}/multisig-transactions/`, {
|
|
29530
|
+
const res = await fetch(`${chainToSafeApiUrl(chainName)}/api/v1/safes/${safeAddress}/multisig-transactions/`, {
|
|
29416
29531
|
method: "POST",
|
|
29417
29532
|
body: JSON.stringify({
|
|
29418
29533
|
...txData,
|
|
@@ -29503,7 +29618,7 @@ var ensAction = async ({
|
|
|
29503
29618
|
chain: chainName = "mainnet",
|
|
29504
29619
|
safe: safeAddress,
|
|
29505
29620
|
"rpc-url": rpcUrl,
|
|
29506
|
-
"resolver-address":
|
|
29621
|
+
"resolver-address": _resolverAddress,
|
|
29507
29622
|
"roles-mod-address": rolesModAddress,
|
|
29508
29623
|
"dry-run": dryRun
|
|
29509
29624
|
} = options;
|
|
@@ -29536,18 +29651,19 @@ var ensAction = async ({
|
|
|
29536
29651
|
return;
|
|
29537
29652
|
}
|
|
29538
29653
|
const address = fromPublicKey(getPublicKey({ privateKey: pk }));
|
|
29539
|
-
|
|
29540
|
-
|
|
29654
|
+
if (options.verbose)
|
|
29655
|
+
logger.info(`Validating transaction for wallet ${address}`);
|
|
29656
|
+
const from25 = safeAddress ? await getExactAddress({ chain, addressOrEns: safeAddress, provider }) : address;
|
|
29541
29657
|
const data = encodeData2(setContentHash, [node, `0x${contentHash}`]);
|
|
29542
29658
|
if (options.verbose)
|
|
29543
29659
|
console.log("Transaction encoded data:", data);
|
|
29544
|
-
const
|
|
29545
|
-
if (
|
|
29660
|
+
const resolverAddress = _resolverAddress || chains2[chainName].contracts.publicResolver.address;
|
|
29661
|
+
if (resolverAddress === chains2[chainName].contracts.publicResolver.address && !domain.endsWith(".eth"))
|
|
29546
29662
|
throw new Error("Domain must end with .eth");
|
|
29547
29663
|
if (safeAddress) {
|
|
29548
29664
|
logger.info(`Preparing a transaction for Safe ${safeAddress} on ${chainName}`);
|
|
29549
29665
|
const { address: safe } = getEip3770Address({
|
|
29550
|
-
fullAddress:
|
|
29666
|
+
fullAddress: from25,
|
|
29551
29667
|
chainId: chain.id
|
|
29552
29668
|
});
|
|
29553
29669
|
const nonce = toBigInt(await provider.request({
|
|
@@ -29565,7 +29681,7 @@ var ensAction = async ({
|
|
|
29565
29681
|
const txData = {
|
|
29566
29682
|
nonce,
|
|
29567
29683
|
operation: 0,
|
|
29568
|
-
to:
|
|
29684
|
+
to: resolverAddress,
|
|
29569
29685
|
data,
|
|
29570
29686
|
value: 0n
|
|
29571
29687
|
};
|
|
@@ -29577,7 +29693,7 @@ var ensAction = async ({
|
|
|
29577
29693
|
await execTransactionWithRole({
|
|
29578
29694
|
provider,
|
|
29579
29695
|
data,
|
|
29580
|
-
resolverAddress
|
|
29696
|
+
resolverAddress,
|
|
29581
29697
|
rolesModAddress,
|
|
29582
29698
|
from: address,
|
|
29583
29699
|
privateKey: pk,
|
|
@@ -29587,23 +29703,24 @@ var ensAction = async ({
|
|
|
29587
29703
|
} else {
|
|
29588
29704
|
const { safeTxHash } = await prepareSafeTransactionData({
|
|
29589
29705
|
txData,
|
|
29590
|
-
safeAddress,
|
|
29706
|
+
safeAddress: from25,
|
|
29591
29707
|
chainId: chain.id,
|
|
29592
29708
|
provider
|
|
29593
29709
|
});
|
|
29594
29710
|
logger.info(`Signing a Safe transaction with a hash ${safeTxHash}`);
|
|
29595
29711
|
const senderSignature = await generateSafeTransactionSignature({
|
|
29596
|
-
safeAddress,
|
|
29712
|
+
safeAddress: from25,
|
|
29597
29713
|
txData,
|
|
29598
29714
|
chainId: chain.id,
|
|
29599
29715
|
privateKey: pk
|
|
29600
29716
|
});
|
|
29601
29717
|
if (!dryRun) {
|
|
29602
|
-
|
|
29718
|
+
if (options.verbose)
|
|
29719
|
+
logger.info("Proposing a Safe transaction");
|
|
29603
29720
|
try {
|
|
29604
29721
|
await proposeTransaction({
|
|
29605
29722
|
txData,
|
|
29606
|
-
safeAddress,
|
|
29723
|
+
safeAddress: from25,
|
|
29607
29724
|
safeTxHash,
|
|
29608
29725
|
senderSignature: toHex3(senderSignature),
|
|
29609
29726
|
chainId: chain.id,
|
|
@@ -29622,7 +29739,7 @@ Open in a browser: ${isTTY ? styleText2("underline", safeLink) : safeLink}`);
|
|
|
29622
29739
|
} else {
|
|
29623
29740
|
await simulateTransaction({
|
|
29624
29741
|
provider,
|
|
29625
|
-
to:
|
|
29742
|
+
to: resolverAddress,
|
|
29626
29743
|
data,
|
|
29627
29744
|
from: from25
|
|
29628
29745
|
});
|
|
@@ -29630,7 +29747,7 @@ Open in a browser: ${isTTY ? styleText2("underline", safeLink) : safeLink}`);
|
|
|
29630
29747
|
privateKey: pk,
|
|
29631
29748
|
provider,
|
|
29632
29749
|
chainId: chain.id,
|
|
29633
|
-
to:
|
|
29750
|
+
to: resolverAddress,
|
|
29634
29751
|
data,
|
|
29635
29752
|
from: from25
|
|
29636
29753
|
});
|