omnipin 1.5.2 → 1.6.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/dist/cli.js +207 -92
- 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,
|
|
@@ -24300,10 +24311,8 @@ var uploadCAR = async (conf, car) => {
|
|
|
24300
24311
|
const piece = fromDigest(multihashDigest).link;
|
|
24301
24312
|
const content2 = create2(code6, digest4);
|
|
24302
24313
|
const offer = await exports_storefront.filecoinOffer({
|
|
24303
|
-
|
|
24304
|
-
audience: uploadServicePrincipal
|
|
24305
|
-
with: conf.issuer.did(),
|
|
24306
|
-
proofs: conf.proofs
|
|
24314
|
+
...conf,
|
|
24315
|
+
audience: uploadServicePrincipal
|
|
24307
24316
|
}, content2, piece, {});
|
|
24308
24317
|
if (offer.out?.error) {
|
|
24309
24318
|
throw new Error("failed to offer piece for aggregation into filecoin deal", {
|
|
@@ -29130,6 +29139,12 @@ function unwrapLabelhash(label) {
|
|
|
29130
29139
|
return null;
|
|
29131
29140
|
return hash2;
|
|
29132
29141
|
}
|
|
29142
|
+
function labelhash(label) {
|
|
29143
|
+
const result2 = new Uint8Array(32).fill(0);
|
|
29144
|
+
if (!label)
|
|
29145
|
+
return fromBytes(result2);
|
|
29146
|
+
return unwrapLabelhash(label) || keccak256(fromString(label));
|
|
29147
|
+
}
|
|
29133
29148
|
function namehash(name12) {
|
|
29134
29149
|
let result2 = new Uint8Array(32).fill(0);
|
|
29135
29150
|
if (!name12)
|
|
@@ -29145,6 +29160,151 @@ function namehash(name12) {
|
|
|
29145
29160
|
function normalize(name12) {
|
|
29146
29161
|
return ens_normalize(name12);
|
|
29147
29162
|
}
|
|
29163
|
+
var abi12 = {
|
|
29164
|
+
constant: true,
|
|
29165
|
+
inputs: [
|
|
29166
|
+
{
|
|
29167
|
+
name: "node",
|
|
29168
|
+
type: "bytes32"
|
|
29169
|
+
}
|
|
29170
|
+
],
|
|
29171
|
+
name: "addr",
|
|
29172
|
+
outputs: [
|
|
29173
|
+
{
|
|
29174
|
+
name: "addr",
|
|
29175
|
+
type: "address"
|
|
29176
|
+
}
|
|
29177
|
+
],
|
|
29178
|
+
payable: false,
|
|
29179
|
+
stateMutability: "view",
|
|
29180
|
+
type: "function"
|
|
29181
|
+
};
|
|
29182
|
+
var encodeEnsAddressRecordRequest = (name12) => encodeData2(abi12, [namehash(name12)]);
|
|
29183
|
+
var abi13 = {
|
|
29184
|
+
inputs: [
|
|
29185
|
+
{
|
|
29186
|
+
name: "name",
|
|
29187
|
+
type: "bytes"
|
|
29188
|
+
},
|
|
29189
|
+
{
|
|
29190
|
+
name: "data",
|
|
29191
|
+
type: "bytes"
|
|
29192
|
+
}
|
|
29193
|
+
],
|
|
29194
|
+
name: "resolve",
|
|
29195
|
+
outputs: [
|
|
29196
|
+
{
|
|
29197
|
+
name: "data",
|
|
29198
|
+
type: "bytes"
|
|
29199
|
+
},
|
|
29200
|
+
{
|
|
29201
|
+
name: "resolver",
|
|
29202
|
+
type: "address"
|
|
29203
|
+
}
|
|
29204
|
+
],
|
|
29205
|
+
stateMutability: "view",
|
|
29206
|
+
type: "function"
|
|
29207
|
+
};
|
|
29208
|
+
function encodeLabelhash(hash2) {
|
|
29209
|
+
if (!hash2.startsWith("0x"))
|
|
29210
|
+
throw new InvalidLabelhashError({
|
|
29211
|
+
labelhash: hash2,
|
|
29212
|
+
details: "Expected labelhash to start with 0x"
|
|
29213
|
+
});
|
|
29214
|
+
if (hash2.length !== 66)
|
|
29215
|
+
throw new InvalidLabelhashError({
|
|
29216
|
+
labelhash: hash2,
|
|
29217
|
+
details: "Expected labelhash to have a length of 66"
|
|
29218
|
+
});
|
|
29219
|
+
return `[${hash2.slice(2)}]`;
|
|
29220
|
+
}
|
|
29221
|
+
function packetToBytes(packet) {
|
|
29222
|
+
const value = packet.replace(/^\.|\.$/gm, "");
|
|
29223
|
+
if (value.length === 0)
|
|
29224
|
+
return new Uint8Array(1);
|
|
29225
|
+
const bytes2 = new Uint8Array(fromString2(value).byteLength + 2);
|
|
29226
|
+
let offset = 0;
|
|
29227
|
+
const list3 = value.split(".");
|
|
29228
|
+
for (let i = 0; i < list3.length; i += 1) {
|
|
29229
|
+
let encoded = fromString2(list3[i]);
|
|
29230
|
+
if (encoded.byteLength > 255)
|
|
29231
|
+
encoded = fromString2(encodeLabelhash(labelhash(list3[i])));
|
|
29232
|
+
bytes2[offset] = encoded.length;
|
|
29233
|
+
bytes2.set(encoded, offset + 1);
|
|
29234
|
+
offset += encoded.length + 1;
|
|
29235
|
+
}
|
|
29236
|
+
if (bytes2.byteLength !== offset + 1)
|
|
29237
|
+
return bytes2.slice(0, offset + 1);
|
|
29238
|
+
return bytes2;
|
|
29239
|
+
}
|
|
29240
|
+
var resolveEnsName = async ({
|
|
29241
|
+
provider,
|
|
29242
|
+
name: name12
|
|
29243
|
+
}) => {
|
|
29244
|
+
const result2 = await provider.request({
|
|
29245
|
+
method: "eth_call",
|
|
29246
|
+
params: [
|
|
29247
|
+
{
|
|
29248
|
+
data: encodeData2(abi13, [
|
|
29249
|
+
toHex(packetToBytes(name12)),
|
|
29250
|
+
encodeEnsAddressRecordRequest(name12)
|
|
29251
|
+
]),
|
|
29252
|
+
to: "0xeEeEEEeE14D718C2B47D9923Deab1335E144EeEe"
|
|
29253
|
+
},
|
|
29254
|
+
"latest"
|
|
29255
|
+
]
|
|
29256
|
+
});
|
|
29257
|
+
return `0x${decodeResult(abi13, result2)[0].slice(-40)}`;
|
|
29258
|
+
};
|
|
29259
|
+
function parseEip3770Address(fullAddress) {
|
|
29260
|
+
const parts = fullAddress.split(":");
|
|
29261
|
+
const address = checksum2(parts.length > 1 ? parts[1] : parts[0]);
|
|
29262
|
+
const prefix2 = parts.length > 1 ? parts[0] : "";
|
|
29263
|
+
return { prefix: prefix2, address };
|
|
29264
|
+
}
|
|
29265
|
+
function validateEthereumAddress(address) {
|
|
29266
|
+
if (!validate4(address))
|
|
29267
|
+
throw new Error(`Invalid Ethereum address ${address}`);
|
|
29268
|
+
}
|
|
29269
|
+
var isValidEip3770NetworkPrefix = (prefix2) => networks.some(({ shortName }) => shortName === prefix2);
|
|
29270
|
+
function getEip3770NetworkPrefixFromChainId(chainId) {
|
|
29271
|
+
const network = networks.find((network2) => chainId === network2.chainId);
|
|
29272
|
+
if (!network)
|
|
29273
|
+
throw new Error("No network prefix supported for the current chainId");
|
|
29274
|
+
return network.shortName;
|
|
29275
|
+
}
|
|
29276
|
+
function validateEip3770NetworkPrefix(prefix2, currentChainId) {
|
|
29277
|
+
const isCurrentNetworkPrefix = prefix2 === getEip3770NetworkPrefixFromChainId(currentChainId);
|
|
29278
|
+
if (!isValidEip3770NetworkPrefix(prefix2) || !isCurrentNetworkPrefix) {
|
|
29279
|
+
throw new Error("The network prefix must match the current network");
|
|
29280
|
+
}
|
|
29281
|
+
}
|
|
29282
|
+
function getEip3770Address({
|
|
29283
|
+
fullAddress,
|
|
29284
|
+
chainId
|
|
29285
|
+
}) {
|
|
29286
|
+
const { address, prefix: prefix2 } = parseEip3770Address(fullAddress);
|
|
29287
|
+
validateEthereumAddress(address);
|
|
29288
|
+
if (prefix2)
|
|
29289
|
+
validateEip3770NetworkPrefix(prefix2, chainId);
|
|
29290
|
+
return { address, prefix: prefix2 };
|
|
29291
|
+
}
|
|
29292
|
+
var networks = [
|
|
29293
|
+
{ chainId: 1, shortName: "eth" },
|
|
29294
|
+
{ chainId: 11155111, shortName: "sep" }
|
|
29295
|
+
];
|
|
29296
|
+
var getExactAddress = async ({
|
|
29297
|
+
addressOrEns,
|
|
29298
|
+
provider,
|
|
29299
|
+
chain
|
|
29300
|
+
}) => {
|
|
29301
|
+
if (addressOrEns.endsWith(".eth"))
|
|
29302
|
+
return await resolveEnsName({ name: addressOrEns, provider });
|
|
29303
|
+
return getEip3770Address({
|
|
29304
|
+
fullAddress: addressOrEns,
|
|
29305
|
+
chainId: chain.id
|
|
29306
|
+
}).address;
|
|
29307
|
+
};
|
|
29148
29308
|
var varint6 = __toESM(require_varint(), 1);
|
|
29149
29309
|
var IFPS_CODEC = 227;
|
|
29150
29310
|
var SWARM_CODEC = 228;
|
|
@@ -29265,43 +29425,6 @@ var getNonce = {
|
|
|
29265
29425
|
}
|
|
29266
29426
|
]
|
|
29267
29427
|
};
|
|
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
29428
|
var chainToSafeApiUrl = (chainName) => `https://safe-transaction-${chainName}.safe.global`;
|
|
29306
29429
|
var zeroAddress = "0x0000000000000000000000000000000000000000";
|
|
29307
29430
|
var prepareSafeTransactionData = async ({
|
|
@@ -29344,11 +29467,6 @@ var generateSafeTransactionSignature = async ({
|
|
|
29344
29467
|
chainId,
|
|
29345
29468
|
privateKey
|
|
29346
29469
|
}) => {
|
|
29347
|
-
const { address: safeAddressWithoutPrefix } = getEip3770Address({
|
|
29348
|
-
fullAddress: safeAddress,
|
|
29349
|
-
chainId
|
|
29350
|
-
});
|
|
29351
|
-
const { address: to2 } = getEip3770Address({ fullAddress: txData.to, chainId });
|
|
29352
29470
|
const payload = getSignPayload({
|
|
29353
29471
|
types: {
|
|
29354
29472
|
EIP712Domain: [
|
|
@@ -29377,10 +29495,10 @@ var generateSafeTransactionSignature = async ({
|
|
|
29377
29495
|
primaryType: "SafeTx",
|
|
29378
29496
|
domain: {
|
|
29379
29497
|
chainId: BigInt(chainId),
|
|
29380
|
-
verifyingContract:
|
|
29498
|
+
verifyingContract: safeAddress
|
|
29381
29499
|
},
|
|
29382
29500
|
message: {
|
|
29383
|
-
to:
|
|
29501
|
+
to: txData.to,
|
|
29384
29502
|
value: 0n,
|
|
29385
29503
|
data: txData.data ?? "0x",
|
|
29386
29504
|
operation: txData.operation,
|
|
@@ -29400,19 +29518,14 @@ var proposeTransaction = async ({
|
|
|
29400
29518
|
chainName,
|
|
29401
29519
|
address,
|
|
29402
29520
|
safeTxHash,
|
|
29403
|
-
senderSignature
|
|
29404
|
-
chainId
|
|
29521
|
+
senderSignature
|
|
29405
29522
|
}) => {
|
|
29406
29523
|
Object.defineProperty(BigInt.prototype, "toJSON", {
|
|
29407
29524
|
get() {
|
|
29408
29525
|
return () => String(this);
|
|
29409
29526
|
}
|
|
29410
29527
|
});
|
|
29411
|
-
const
|
|
29412
|
-
fullAddress: safeAddress,
|
|
29413
|
-
chainId
|
|
29414
|
-
});
|
|
29415
|
-
const res = await fetch(`${chainToSafeApiUrl(chainName)}/api/v1/safes/${safe}/multisig-transactions/`, {
|
|
29528
|
+
const res = await fetch(`${chainToSafeApiUrl(chainName)}/api/v1/safes/${safeAddress}/multisig-transactions/`, {
|
|
29416
29529
|
method: "POST",
|
|
29417
29530
|
body: JSON.stringify({
|
|
29418
29531
|
...txData,
|
|
@@ -29503,7 +29616,7 @@ var ensAction = async ({
|
|
|
29503
29616
|
chain: chainName = "mainnet",
|
|
29504
29617
|
safe: safeAddress,
|
|
29505
29618
|
"rpc-url": rpcUrl,
|
|
29506
|
-
"resolver-address":
|
|
29619
|
+
"resolver-address": _resolverAddress,
|
|
29507
29620
|
"roles-mod-address": rolesModAddress,
|
|
29508
29621
|
"dry-run": dryRun
|
|
29509
29622
|
} = options;
|
|
@@ -29536,18 +29649,19 @@ var ensAction = async ({
|
|
|
29536
29649
|
return;
|
|
29537
29650
|
}
|
|
29538
29651
|
const address = fromPublicKey(getPublicKey({ privateKey: pk }));
|
|
29539
|
-
|
|
29540
|
-
|
|
29652
|
+
if (options.verbose)
|
|
29653
|
+
logger.info(`Validating transaction for wallet ${address}`);
|
|
29654
|
+
const from25 = safeAddress ? await getExactAddress({ chain, addressOrEns: safeAddress, provider }) : address;
|
|
29541
29655
|
const data = encodeData2(setContentHash, [node, `0x${contentHash}`]);
|
|
29542
29656
|
if (options.verbose)
|
|
29543
29657
|
console.log("Transaction encoded data:", data);
|
|
29544
|
-
const
|
|
29545
|
-
if (
|
|
29658
|
+
const resolverAddress = _resolverAddress || chains2[chainName].contracts.publicResolver.address;
|
|
29659
|
+
if (resolverAddress === chains2[chainName].contracts.publicResolver.address && !domain.endsWith(".eth"))
|
|
29546
29660
|
throw new Error("Domain must end with .eth");
|
|
29547
29661
|
if (safeAddress) {
|
|
29548
29662
|
logger.info(`Preparing a transaction for Safe ${safeAddress} on ${chainName}`);
|
|
29549
29663
|
const { address: safe } = getEip3770Address({
|
|
29550
|
-
fullAddress:
|
|
29664
|
+
fullAddress: from25,
|
|
29551
29665
|
chainId: chain.id
|
|
29552
29666
|
});
|
|
29553
29667
|
const nonce = toBigInt(await provider.request({
|
|
@@ -29565,7 +29679,7 @@ var ensAction = async ({
|
|
|
29565
29679
|
const txData = {
|
|
29566
29680
|
nonce,
|
|
29567
29681
|
operation: 0,
|
|
29568
|
-
to:
|
|
29682
|
+
to: resolverAddress,
|
|
29569
29683
|
data,
|
|
29570
29684
|
value: 0n
|
|
29571
29685
|
};
|
|
@@ -29577,7 +29691,7 @@ var ensAction = async ({
|
|
|
29577
29691
|
await execTransactionWithRole({
|
|
29578
29692
|
provider,
|
|
29579
29693
|
data,
|
|
29580
|
-
resolverAddress
|
|
29694
|
+
resolverAddress,
|
|
29581
29695
|
rolesModAddress,
|
|
29582
29696
|
from: address,
|
|
29583
29697
|
privateKey: pk,
|
|
@@ -29587,23 +29701,24 @@ var ensAction = async ({
|
|
|
29587
29701
|
} else {
|
|
29588
29702
|
const { safeTxHash } = await prepareSafeTransactionData({
|
|
29589
29703
|
txData,
|
|
29590
|
-
safeAddress,
|
|
29704
|
+
safeAddress: from25,
|
|
29591
29705
|
chainId: chain.id,
|
|
29592
29706
|
provider
|
|
29593
29707
|
});
|
|
29594
29708
|
logger.info(`Signing a Safe transaction with a hash ${safeTxHash}`);
|
|
29595
29709
|
const senderSignature = await generateSafeTransactionSignature({
|
|
29596
|
-
safeAddress,
|
|
29710
|
+
safeAddress: from25,
|
|
29597
29711
|
txData,
|
|
29598
29712
|
chainId: chain.id,
|
|
29599
29713
|
privateKey: pk
|
|
29600
29714
|
});
|
|
29601
29715
|
if (!dryRun) {
|
|
29602
|
-
|
|
29716
|
+
if (options.verbose)
|
|
29717
|
+
logger.info("Proposing a Safe transaction");
|
|
29603
29718
|
try {
|
|
29604
29719
|
await proposeTransaction({
|
|
29605
29720
|
txData,
|
|
29606
|
-
safeAddress,
|
|
29721
|
+
safeAddress: from25,
|
|
29607
29722
|
safeTxHash,
|
|
29608
29723
|
senderSignature: toHex3(senderSignature),
|
|
29609
29724
|
chainId: chain.id,
|
|
@@ -29622,7 +29737,7 @@ Open in a browser: ${isTTY ? styleText2("underline", safeLink) : safeLink}`);
|
|
|
29622
29737
|
} else {
|
|
29623
29738
|
await simulateTransaction({
|
|
29624
29739
|
provider,
|
|
29625
|
-
to:
|
|
29740
|
+
to: resolverAddress,
|
|
29626
29741
|
data,
|
|
29627
29742
|
from: from25
|
|
29628
29743
|
});
|
|
@@ -29630,7 +29745,7 @@ Open in a browser: ${isTTY ? styleText2("underline", safeLink) : safeLink}`);
|
|
|
29630
29745
|
privateKey: pk,
|
|
29631
29746
|
provider,
|
|
29632
29747
|
chainId: chain.id,
|
|
29633
|
-
to:
|
|
29748
|
+
to: resolverAddress,
|
|
29634
29749
|
data,
|
|
29635
29750
|
from: from25
|
|
29636
29751
|
});
|