omnipin 1.6.2 → 1.7.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 +206 -57
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4843,6 +4843,15 @@ function toNumber(hex, options = {}) {
|
|
|
4843
4843
|
return Number(hex);
|
|
4844
4844
|
return Number(toBigInt(hex, options));
|
|
4845
4845
|
}
|
|
4846
|
+
function toString(hex, options = {}) {
|
|
4847
|
+
const { size: size32 } = options;
|
|
4848
|
+
let bytes2 = fromHex(hex);
|
|
4849
|
+
if (size32) {
|
|
4850
|
+
assertSize(bytes2, size32);
|
|
4851
|
+
bytes2 = trimRight(bytes2);
|
|
4852
|
+
}
|
|
4853
|
+
return new TextDecoder().decode(bytes2);
|
|
4854
|
+
}
|
|
4846
4855
|
function validate(value, options = {}) {
|
|
4847
4856
|
const { strict = false } = options;
|
|
4848
4857
|
try {
|
|
@@ -5047,7 +5056,7 @@ function toNumber2(bytes2, options = {}) {
|
|
|
5047
5056
|
const hex = fromBytes(bytes2, options);
|
|
5048
5057
|
return toNumber(hex, options);
|
|
5049
5058
|
}
|
|
5050
|
-
function
|
|
5059
|
+
function toString2(bytes2, options = {}) {
|
|
5051
5060
|
const { size: size32 } = options;
|
|
5052
5061
|
let bytes_ = bytes2;
|
|
5053
5062
|
if (typeof size32 !== "undefined") {
|
|
@@ -8160,7 +8169,7 @@ var EMPTY = from7(new Uint8Array(NODE_SIZE).fill(0));
|
|
|
8160
8169
|
Object.freeze(EMPTY.buffer);
|
|
8161
8170
|
var exports_bytes2 = {};
|
|
8162
8171
|
__export(exports_bytes2, {
|
|
8163
|
-
toString: () =>
|
|
8172
|
+
toString: () => toString3,
|
|
8164
8173
|
toHex: () => toHex4,
|
|
8165
8174
|
isBinary: () => isBinary,
|
|
8166
8175
|
fromString: () => fromString3,
|
|
@@ -8209,7 +8218,7 @@ function isBinary(o) {
|
|
|
8209
8218
|
function fromString3(str) {
|
|
8210
8219
|
return new TextEncoder().encode(str);
|
|
8211
8220
|
}
|
|
8212
|
-
function
|
|
8221
|
+
function toString3(b) {
|
|
8213
8222
|
return new TextDecoder().decode(b);
|
|
8214
8223
|
}
|
|
8215
8224
|
var exports_sha256 = {};
|
|
@@ -8371,7 +8380,7 @@ function asU8A(buf2) {
|
|
|
8371
8380
|
}
|
|
8372
8381
|
return isBuffer2(buf2) ? new Uint8Array(buf2.buffer, buf2.byteOffset, buf2.byteLength) : buf2;
|
|
8373
8382
|
}
|
|
8374
|
-
var
|
|
8383
|
+
var toString4 = useBuffer ? (bytes2, start, end) => {
|
|
8375
8384
|
return end - start > 64 ? globalThis.Buffer.from(bytes2.subarray(start, end)).toString("utf8") : utf8Slice(bytes2, start, end);
|
|
8376
8385
|
} : (bytes2, start, end) => {
|
|
8377
8386
|
return end - start > 64 ? textDecoder.decode(bytes2.subarray(start, end)) : utf8Slice(bytes2, start, end);
|
|
@@ -8814,7 +8823,7 @@ function compareBytes(b1, b2) {
|
|
|
8814
8823
|
function toToken2(data, pos, prefix2, length3, options) {
|
|
8815
8824
|
const totLength = prefix2 + length3;
|
|
8816
8825
|
assertEnoughData(data, pos, totLength);
|
|
8817
|
-
const tok = new Token(Type.string,
|
|
8826
|
+
const tok = new Token(Type.string, toString4(data, pos + prefix2, pos + totLength), totLength);
|
|
8818
8827
|
if (options.retainStringBytes === true) {
|
|
8819
8828
|
tok.byteValue = slice3(data, pos + prefix2, pos + totLength);
|
|
8820
8829
|
}
|
|
@@ -12712,10 +12721,10 @@ function from12(abiItem, options = {}) {
|
|
|
12712
12721
|
...prepare3 ? { hash: getSignatureHash(item) } : {}
|
|
12713
12722
|
};
|
|
12714
12723
|
}
|
|
12715
|
-
function fromAbi(
|
|
12724
|
+
function fromAbi(abi16, name62, options) {
|
|
12716
12725
|
const { args = [], prepare: prepare3 = true } = options ?? {};
|
|
12717
12726
|
const isSelector = validate(name62, { strict: false });
|
|
12718
|
-
const abiItems =
|
|
12727
|
+
const abiItems = abi16.filter((abiItem2) => {
|
|
12719
12728
|
if (isSelector) {
|
|
12720
12729
|
if (abiItem2.type === "function" || abiItem2.type === "error")
|
|
12721
12730
|
return getSelector(abiItem2) === slice(name62, 0, 4);
|
|
@@ -12787,8 +12796,8 @@ function fromAbi(abi14, name62, options) {
|
|
|
12787
12796
|
function getSelector(...parameters) {
|
|
12788
12797
|
const abiItem = (() => {
|
|
12789
12798
|
if (Array.isArray(parameters[0])) {
|
|
12790
|
-
const [
|
|
12791
|
-
return fromAbi(
|
|
12799
|
+
const [abi16, name62] = parameters;
|
|
12800
|
+
return fromAbi(abi16, name62);
|
|
12792
12801
|
}
|
|
12793
12802
|
return parameters[0];
|
|
12794
12803
|
})();
|
|
@@ -12797,8 +12806,8 @@ function getSelector(...parameters) {
|
|
|
12797
12806
|
function getSignature(...parameters) {
|
|
12798
12807
|
const abiItem = (() => {
|
|
12799
12808
|
if (Array.isArray(parameters[0])) {
|
|
12800
|
-
const [
|
|
12801
|
-
return fromAbi(
|
|
12809
|
+
const [abi16, name62] = parameters;
|
|
12810
|
+
return fromAbi(abi16, name62);
|
|
12802
12811
|
}
|
|
12803
12812
|
return parameters[0];
|
|
12804
12813
|
})();
|
|
@@ -12812,8 +12821,8 @@ function getSignature(...parameters) {
|
|
|
12812
12821
|
function getSignatureHash(...parameters) {
|
|
12813
12822
|
const abiItem = (() => {
|
|
12814
12823
|
if (Array.isArray(parameters[0])) {
|
|
12815
|
-
const [
|
|
12816
|
-
return fromAbi(
|
|
12824
|
+
const [abi16, name62] = parameters;
|
|
12825
|
+
return fromAbi(abi16, name62);
|
|
12817
12826
|
}
|
|
12818
12827
|
return parameters[0];
|
|
12819
12828
|
})();
|
|
@@ -13022,7 +13031,7 @@ function decodeString(cursor, { staticPosition }) {
|
|
|
13022
13031
|
return ["", 32];
|
|
13023
13032
|
}
|
|
13024
13033
|
const data = cursor.readBytes(length22, 32);
|
|
13025
|
-
const value =
|
|
13034
|
+
const value = toString2(trimLeft2(data));
|
|
13026
13035
|
cursor.setPosition(staticPosition + 32);
|
|
13027
13036
|
return [value, 32];
|
|
13028
13037
|
}
|
|
@@ -13657,8 +13666,8 @@ class InvalidTypeError extends BaseError {
|
|
|
13657
13666
|
function decode9(...parameters) {
|
|
13658
13667
|
const [abiError, data, options = {}] = (() => {
|
|
13659
13668
|
if (Array.isArray(parameters[0])) {
|
|
13660
|
-
const [
|
|
13661
|
-
return [fromAbi2(
|
|
13669
|
+
const [abi16, name62, data2, options2] = parameters;
|
|
13670
|
+
return [fromAbi2(abi16, name62), data2, options2];
|
|
13662
13671
|
}
|
|
13663
13672
|
return parameters;
|
|
13664
13673
|
})();
|
|
@@ -13677,7 +13686,7 @@ function decode9(...parameters) {
|
|
|
13677
13686
|
function from14(abiError, options = {}) {
|
|
13678
13687
|
return from12(abiError, options);
|
|
13679
13688
|
}
|
|
13680
|
-
function fromAbi2(
|
|
13689
|
+
function fromAbi2(abi16, name62, options) {
|
|
13681
13690
|
if (name62 === "Error")
|
|
13682
13691
|
return solidityError;
|
|
13683
13692
|
if (name62 === "Panic")
|
|
@@ -13689,7 +13698,7 @@ function fromAbi2(abi14, name62, options) {
|
|
|
13689
13698
|
if (selector === solidityPanicSelector)
|
|
13690
13699
|
return solidityPanic;
|
|
13691
13700
|
}
|
|
13692
|
-
const item = fromAbi(
|
|
13701
|
+
const item = fromAbi(abi16, name62, options);
|
|
13693
13702
|
if (item.type !== "error")
|
|
13694
13703
|
throw new NotFoundError({ name: name62, type: "error" });
|
|
13695
13704
|
return item;
|
|
@@ -14442,8 +14451,8 @@ var waitForTransaction = async (provider, hash2) => {
|
|
|
14442
14451
|
function decodeResult(...parameters) {
|
|
14443
14452
|
const [abiFunction, data, options = {}] = (() => {
|
|
14444
14453
|
if (Array.isArray(parameters[0])) {
|
|
14445
|
-
const [
|
|
14446
|
-
return [fromAbi3(
|
|
14454
|
+
const [abi16, name62, data2, options2] = parameters;
|
|
14455
|
+
return [fromAbi3(abi16, name62), data2, options2];
|
|
14447
14456
|
}
|
|
14448
14457
|
return parameters;
|
|
14449
14458
|
})();
|
|
@@ -14460,8 +14469,8 @@ function decodeResult(...parameters) {
|
|
|
14460
14469
|
function encodeData2(...parameters) {
|
|
14461
14470
|
const [abiFunction, args = []] = (() => {
|
|
14462
14471
|
if (Array.isArray(parameters[0])) {
|
|
14463
|
-
const [
|
|
14464
|
-
return [fromAbi3(
|
|
14472
|
+
const [abi16, name62, args3] = parameters;
|
|
14473
|
+
return [fromAbi3(abi16, name62, { args: args3 }), args3];
|
|
14465
14474
|
}
|
|
14466
14475
|
const [abiFunction2, args2] = parameters;
|
|
14467
14476
|
return [abiFunction2, args2];
|
|
@@ -14474,8 +14483,8 @@ function encodeData2(...parameters) {
|
|
|
14474
14483
|
const data = args.length > 0 ? encode7(item.inputs, args) : void 0;
|
|
14475
14484
|
return data ? concat(selector, data) : selector;
|
|
14476
14485
|
}
|
|
14477
|
-
function fromAbi3(
|
|
14478
|
-
const item = fromAbi(
|
|
14486
|
+
function fromAbi3(abi16, name62, options) {
|
|
14487
|
+
const item = fromAbi(abi16, name62, options);
|
|
14479
14488
|
if (item.type !== "function")
|
|
14480
14489
|
throw new NotFoundError({ name: name62, type: "function" });
|
|
14481
14490
|
return item;
|
|
@@ -15007,6 +15016,88 @@ var getProviderIdByAddress = async ({
|
|
|
15007
15016
|
return decodeResult(abi6, result);
|
|
15008
15017
|
};
|
|
15009
15018
|
var abi7 = {
|
|
15019
|
+
type: "function",
|
|
15020
|
+
inputs: [
|
|
15021
|
+
{ name: "providerId", internalType: "uint256", type: "uint256" },
|
|
15022
|
+
{
|
|
15023
|
+
name: "productType",
|
|
15024
|
+
internalType: "enum ServiceProviderRegistryStorage.ProductType",
|
|
15025
|
+
type: "uint8"
|
|
15026
|
+
}
|
|
15027
|
+
],
|
|
15028
|
+
name: "getProviderWithProduct",
|
|
15029
|
+
outputs: [
|
|
15030
|
+
{
|
|
15031
|
+
name: "",
|
|
15032
|
+
internalType: "struct ServiceProviderRegistryStorage.ProviderWithProduct",
|
|
15033
|
+
type: "tuple",
|
|
15034
|
+
components: [
|
|
15035
|
+
{ name: "providerId", internalType: "uint256", type: "uint256" },
|
|
15036
|
+
{
|
|
15037
|
+
name: "providerInfo",
|
|
15038
|
+
internalType: "struct ServiceProviderRegistryStorage.ServiceProviderInfo",
|
|
15039
|
+
type: "tuple",
|
|
15040
|
+
components: [
|
|
15041
|
+
{
|
|
15042
|
+
name: "serviceProvider",
|
|
15043
|
+
internalType: "address",
|
|
15044
|
+
type: "address"
|
|
15045
|
+
},
|
|
15046
|
+
{ name: "payee", internalType: "address", type: "address" },
|
|
15047
|
+
{ name: "name", internalType: "string", type: "string" },
|
|
15048
|
+
{ name: "description", internalType: "string", type: "string" },
|
|
15049
|
+
{ name: "isActive", internalType: "bool", type: "bool" }
|
|
15050
|
+
]
|
|
15051
|
+
},
|
|
15052
|
+
{
|
|
15053
|
+
name: "product",
|
|
15054
|
+
internalType: "struct ServiceProviderRegistryStorage.ServiceProduct",
|
|
15055
|
+
type: "tuple",
|
|
15056
|
+
components: [
|
|
15057
|
+
{
|
|
15058
|
+
name: "productType",
|
|
15059
|
+
internalType: "enum ServiceProviderRegistryStorage.ProductType",
|
|
15060
|
+
type: "uint8"
|
|
15061
|
+
},
|
|
15062
|
+
{
|
|
15063
|
+
name: "capabilityKeys",
|
|
15064
|
+
internalType: "string[]",
|
|
15065
|
+
type: "string[]"
|
|
15066
|
+
},
|
|
15067
|
+
{ name: "isActive", internalType: "bool", type: "bool" }
|
|
15068
|
+
]
|
|
15069
|
+
},
|
|
15070
|
+
{
|
|
15071
|
+
name: "productCapabilityValues",
|
|
15072
|
+
internalType: "bytes[]",
|
|
15073
|
+
type: "bytes[]"
|
|
15074
|
+
}
|
|
15075
|
+
]
|
|
15076
|
+
}
|
|
15077
|
+
],
|
|
15078
|
+
stateMutability: "view"
|
|
15079
|
+
};
|
|
15080
|
+
var getProviderMetadata = async ({
|
|
15081
|
+
chain,
|
|
15082
|
+
providerId
|
|
15083
|
+
}) => {
|
|
15084
|
+
const provider = filProvider[chain.id];
|
|
15085
|
+
const result = await provider.request({
|
|
15086
|
+
method: "eth_call",
|
|
15087
|
+
params: [
|
|
15088
|
+
{
|
|
15089
|
+
data: encodeData2(abi7, [providerId, 0]),
|
|
15090
|
+
to: chain.contracts.providerRegistry.address
|
|
15091
|
+
},
|
|
15092
|
+
"latest"
|
|
15093
|
+
]
|
|
15094
|
+
});
|
|
15095
|
+
const { providerInfo, productCapabilityValues, product } = decodeResult(abi7, result);
|
|
15096
|
+
const { capabilityKeys } = product;
|
|
15097
|
+
const serviceURL = toString(productCapabilityValues[capabilityKeys.indexOf("serviceURL")]);
|
|
15098
|
+
return { address: providerInfo.payee, serviceURL };
|
|
15099
|
+
};
|
|
15100
|
+
var abi8 = {
|
|
15010
15101
|
type: "function",
|
|
15011
15102
|
name: "getProviderPayee",
|
|
15012
15103
|
stateMutability: "view",
|
|
@@ -15032,15 +15123,57 @@ var getProviderPayee = async ({
|
|
|
15032
15123
|
method: "eth_call",
|
|
15033
15124
|
params: [
|
|
15034
15125
|
{
|
|
15035
|
-
data: encodeData2(
|
|
15126
|
+
data: encodeData2(abi8, [id]),
|
|
15036
15127
|
to: chain.contracts.providerRegistry.address
|
|
15037
15128
|
},
|
|
15038
15129
|
"latest"
|
|
15039
15130
|
]
|
|
15040
15131
|
});
|
|
15041
|
-
return checksum2(decodeResult(
|
|
15132
|
+
return checksum2(decodeResult(abi8, result));
|
|
15042
15133
|
};
|
|
15043
|
-
var
|
|
15134
|
+
var abi9 = {
|
|
15135
|
+
inputs: [
|
|
15136
|
+
{
|
|
15137
|
+
internalType: "uint256",
|
|
15138
|
+
name: "offset",
|
|
15139
|
+
type: "uint256"
|
|
15140
|
+
},
|
|
15141
|
+
{
|
|
15142
|
+
internalType: "uint256",
|
|
15143
|
+
name: "limit",
|
|
15144
|
+
type: "uint256"
|
|
15145
|
+
}
|
|
15146
|
+
],
|
|
15147
|
+
name: "getApprovedProviders",
|
|
15148
|
+
outputs: [
|
|
15149
|
+
{
|
|
15150
|
+
internalType: "uint256[]",
|
|
15151
|
+
name: "providerIds",
|
|
15152
|
+
type: "uint256[]"
|
|
15153
|
+
}
|
|
15154
|
+
],
|
|
15155
|
+
stateMutability: "view",
|
|
15156
|
+
type: "function"
|
|
15157
|
+
};
|
|
15158
|
+
var getRandomProviderId = async ({
|
|
15159
|
+
chain
|
|
15160
|
+
}) => {
|
|
15161
|
+
const provider = filProvider[chain.id];
|
|
15162
|
+
const result = await provider.request({
|
|
15163
|
+
method: "eth_call",
|
|
15164
|
+
params: [
|
|
15165
|
+
{
|
|
15166
|
+
data: encodeData2(abi9, [0n, 100n]),
|
|
15167
|
+
to: chain.contracts.storageView.address
|
|
15168
|
+
},
|
|
15169
|
+
"latest"
|
|
15170
|
+
]
|
|
15171
|
+
});
|
|
15172
|
+
const ids = decodeResult(abi9, result);
|
|
15173
|
+
const randomIndex = Math.floor(Math.random() * ids.length);
|
|
15174
|
+
return ids[randomIndex];
|
|
15175
|
+
};
|
|
15176
|
+
var abi10 = {
|
|
15044
15177
|
constant: true,
|
|
15045
15178
|
inputs: [
|
|
15046
15179
|
{
|
|
@@ -15068,15 +15201,15 @@ var getUSDfcBalance = async ({
|
|
|
15068
15201
|
method: "eth_call",
|
|
15069
15202
|
params: [
|
|
15070
15203
|
{
|
|
15071
|
-
data: encodeData2(
|
|
15204
|
+
data: encodeData2(abi10, [address]),
|
|
15072
15205
|
to: chain.contracts.usdfc.address
|
|
15073
15206
|
},
|
|
15074
15207
|
"latest"
|
|
15075
15208
|
]
|
|
15076
15209
|
});
|
|
15077
|
-
return decodeResult(
|
|
15210
|
+
return decodeResult(abi10, result);
|
|
15078
15211
|
};
|
|
15079
|
-
var
|
|
15212
|
+
var abi11 = {
|
|
15080
15213
|
type: "function",
|
|
15081
15214
|
inputs: [],
|
|
15082
15215
|
name: "getServicePrice",
|
|
@@ -15128,12 +15261,12 @@ var getServicePrice = async ({
|
|
|
15128
15261
|
params: [
|
|
15129
15262
|
{
|
|
15130
15263
|
to: chain.contracts.storage.address,
|
|
15131
|
-
data: encodeData2(
|
|
15264
|
+
data: encodeData2(abi11)
|
|
15132
15265
|
},
|
|
15133
15266
|
"latest"
|
|
15134
15267
|
]
|
|
15135
15268
|
});
|
|
15136
|
-
const { minimumPricePerMonth, pricePerTiBPerMonthNoCDN, epochsPerMonth } = decodeResult(
|
|
15269
|
+
const { minimumPricePerMonth, pricePerTiBPerMonthNoCDN, epochsPerMonth } = decodeResult(abi11, result);
|
|
15137
15270
|
const linearCost = BigInt(sizeInBytes) * pricePerTiBPerMonthNoCDN / TiB;
|
|
15138
15271
|
const actualCost = linearCost > minimumPricePerMonth ? linearCost : minimumPricePerMonth;
|
|
15139
15272
|
const costWithBuffer = actualCost * 110n / 100n;
|
|
@@ -15145,7 +15278,7 @@ var getServicePrice = async ({
|
|
|
15145
15278
|
linearCost
|
|
15146
15279
|
};
|
|
15147
15280
|
};
|
|
15148
|
-
var
|
|
15281
|
+
var abi12 = {
|
|
15149
15282
|
type: "function",
|
|
15150
15283
|
inputs: [{ name: "dataSetId", internalType: "uint256", type: "uint256" }],
|
|
15151
15284
|
name: "getDataSet",
|
|
@@ -15180,16 +15313,16 @@ var getDataSet = async ({
|
|
|
15180
15313
|
method: "eth_call",
|
|
15181
15314
|
params: [
|
|
15182
15315
|
{
|
|
15183
|
-
data: encodeData2(
|
|
15316
|
+
data: encodeData2(abi12, [dataSetId]),
|
|
15184
15317
|
to: chain.contracts.storageView.address
|
|
15185
15318
|
},
|
|
15186
15319
|
"latest"
|
|
15187
15320
|
]
|
|
15188
15321
|
});
|
|
15189
|
-
return decodeResult(
|
|
15322
|
+
return decodeResult(abi12, result);
|
|
15190
15323
|
};
|
|
15191
15324
|
var metadata2 = [{ key: "withIPFSIndexing", value: "" }];
|
|
15192
|
-
var
|
|
15325
|
+
var abi13 = [
|
|
15193
15326
|
{ type: "uint256" },
|
|
15194
15327
|
{ type: "string[][]" },
|
|
15195
15328
|
{ type: "string[][]" },
|
|
@@ -15253,7 +15386,7 @@ var uploadPieceToDataSet = async ({
|
|
|
15253
15386
|
const signature = toHex3(sign({ payload, privateKey }));
|
|
15254
15387
|
const keys2 = [metadata2.map((m) => m.key)];
|
|
15255
15388
|
const values2 = [metadata2.map((m) => m.value)];
|
|
15256
|
-
const extraData = encode7(from13(
|
|
15389
|
+
const extraData = encode7(from13(abi13), [
|
|
15257
15390
|
nonce,
|
|
15258
15391
|
keys2,
|
|
15259
15392
|
values2,
|
|
@@ -15344,9 +15477,9 @@ var uploadToFilecoin = async ({
|
|
|
15344
15477
|
filecoinChain = "mainnet",
|
|
15345
15478
|
size: size42
|
|
15346
15479
|
}) => {
|
|
15347
|
-
if (!providerURL)
|
|
15480
|
+
if (!providerURL && providerAddress)
|
|
15348
15481
|
throw new MissingKeyError("FILECOIN_SP_URL");
|
|
15349
|
-
if (!providerAddress)
|
|
15482
|
+
if (!providerAddress && providerURL)
|
|
15350
15483
|
throw new MissingKeyError("FILECOIN_SP_ADDRESS");
|
|
15351
15484
|
const publicKey = getPublicKey({ privateKey });
|
|
15352
15485
|
const address = fromPublicKey(publicKey);
|
|
@@ -15358,20 +15491,36 @@ var uploadToFilecoin = async ({
|
|
|
15358
15491
|
logger.info(`USDfc balance: ${format(balance, 18)}`);
|
|
15359
15492
|
if (balance === 0n)
|
|
15360
15493
|
throw new DeployError(providerName4, "No USDfc on account");
|
|
15361
|
-
|
|
15362
|
-
|
|
15363
|
-
|
|
15364
|
-
|
|
15494
|
+
if (verbose)
|
|
15495
|
+
logger.info("Looking up existing data sets");
|
|
15496
|
+
const dataSets = await getClientDataSets({ address, chain });
|
|
15497
|
+
let providerId;
|
|
15498
|
+
if (dataSets.length > 0) {
|
|
15499
|
+
const lastProvider = dataSets.at(-1);
|
|
15500
|
+
providerId = lastProvider.providerId;
|
|
15501
|
+
} else if (providerAddress) {
|
|
15502
|
+
providerId = await getProviderIdByAddress({
|
|
15503
|
+
providerAddress,
|
|
15504
|
+
chain
|
|
15505
|
+
});
|
|
15506
|
+
} else {
|
|
15507
|
+
providerId = await getRandomProviderId({ chain });
|
|
15508
|
+
}
|
|
15365
15509
|
if (verbose)
|
|
15366
15510
|
logger.info(`Filecoin SP ID: ${providerId}`);
|
|
15511
|
+
if (!providerURL) {
|
|
15512
|
+
const { serviceURL, address: address2 } = await getProviderMetadata({
|
|
15513
|
+
chain,
|
|
15514
|
+
providerId
|
|
15515
|
+
});
|
|
15516
|
+
providerURL = serviceURL;
|
|
15517
|
+
providerAddress = address2;
|
|
15518
|
+
}
|
|
15367
15519
|
const payee = await getProviderPayee({ id: providerId, chain });
|
|
15368
15520
|
if (verbose)
|
|
15369
15521
|
logger.info(`Filecoin SP Payee: ${payee}`);
|
|
15370
15522
|
const { perMonth } = await getServicePrice({ size: size42, chain });
|
|
15371
15523
|
logger.info(`Price for storage: ${format(perMonth, 18)} USDfc/month`);
|
|
15372
|
-
if (verbose)
|
|
15373
|
-
logger.info("Looking up existing datasets");
|
|
15374
|
-
const dataSets = await getClientDataSets({ address, chain });
|
|
15375
15524
|
let datasetId;
|
|
15376
15525
|
let clientDataSetId;
|
|
15377
15526
|
const providerDataSets = dataSets.filter((set) => set.providerId === providerId);
|
|
@@ -18719,7 +18868,7 @@ __export(exports_schema3, {
|
|
|
18719
18868
|
uint64: () => uint64,
|
|
18720
18869
|
typeError: () => typeError,
|
|
18721
18870
|
tuple: () => tuple,
|
|
18722
|
-
toString: () =>
|
|
18871
|
+
toString: () => toString5,
|
|
18723
18872
|
text: () => match5,
|
|
18724
18873
|
struct: () => struct,
|
|
18725
18874
|
string: () => string,
|
|
@@ -19297,7 +19446,7 @@ class Literal extends API {
|
|
|
19297
19446
|
return super.default(value);
|
|
19298
19447
|
}
|
|
19299
19448
|
toString() {
|
|
19300
|
-
return `literal(${
|
|
19449
|
+
return `literal(${toString5(this.value)})`;
|
|
19301
19450
|
}
|
|
19302
19451
|
}
|
|
19303
19452
|
var literal = (value) => new Literal(value);
|
|
@@ -19422,11 +19571,11 @@ class TypeError2 extends SchemaError {
|
|
|
19422
19571
|
return "TypeError";
|
|
19423
19572
|
}
|
|
19424
19573
|
describe() {
|
|
19425
|
-
return `Expected value of type ${this.expect} instead got ${
|
|
19574
|
+
return `Expected value of type ${this.expect} instead got ${toString5(this.actual)}`;
|
|
19426
19575
|
}
|
|
19427
19576
|
}
|
|
19428
19577
|
var typeError = (data) => ({ error: new TypeError2(data) });
|
|
19429
|
-
var
|
|
19578
|
+
var toString5 = (value) => {
|
|
19430
19579
|
const type4 = typeof value;
|
|
19431
19580
|
switch (type4) {
|
|
19432
19581
|
case "boolean":
|
|
@@ -19454,7 +19603,7 @@ class LiteralError extends SchemaError {
|
|
|
19454
19603
|
return "LiteralError";
|
|
19455
19604
|
}
|
|
19456
19605
|
describe() {
|
|
19457
|
-
return `Expected literal ${
|
|
19606
|
+
return `Expected literal ${toString5(this.expect)} instead got ${toString5(this.actual)}`;
|
|
19458
19607
|
}
|
|
19459
19608
|
}
|
|
19460
19609
|
class ElementError extends SchemaError {
|
|
@@ -21018,7 +21167,7 @@ __export(exports_identity2, {
|
|
|
21018
21167
|
var identity2 = from8({
|
|
21019
21168
|
prefix: "\0",
|
|
21020
21169
|
name: "identity",
|
|
21021
|
-
encode: (buf2) =>
|
|
21170
|
+
encode: (buf2) => toString3(buf2),
|
|
21022
21171
|
decode: (str) => fromString3(str)
|
|
21023
21172
|
});
|
|
21024
21173
|
var textEncoder2 = new TextEncoder();
|
|
@@ -29166,7 +29315,7 @@ function namehash(name12) {
|
|
|
29166
29315
|
function normalize(name12) {
|
|
29167
29316
|
return ens_normalize(name12);
|
|
29168
29317
|
}
|
|
29169
|
-
var
|
|
29318
|
+
var abi14 = {
|
|
29170
29319
|
constant: true,
|
|
29171
29320
|
inputs: [
|
|
29172
29321
|
{
|
|
@@ -29185,8 +29334,8 @@ var abi12 = {
|
|
|
29185
29334
|
stateMutability: "view",
|
|
29186
29335
|
type: "function"
|
|
29187
29336
|
};
|
|
29188
|
-
var encodeEnsAddressRecordRequest = (name12) => encodeData2(
|
|
29189
|
-
var
|
|
29337
|
+
var encodeEnsAddressRecordRequest = (name12) => encodeData2(abi14, [namehash(name12)]);
|
|
29338
|
+
var abi15 = {
|
|
29190
29339
|
inputs: [
|
|
29191
29340
|
{
|
|
29192
29341
|
name: "name",
|
|
@@ -29251,7 +29400,7 @@ var resolveEnsName = async ({
|
|
|
29251
29400
|
method: "eth_call",
|
|
29252
29401
|
params: [
|
|
29253
29402
|
{
|
|
29254
|
-
data: encodeData2(
|
|
29403
|
+
data: encodeData2(abi15, [
|
|
29255
29404
|
toHex(packetToBytes(name12)),
|
|
29256
29405
|
encodeEnsAddressRecordRequest(name12)
|
|
29257
29406
|
]),
|
|
@@ -29260,7 +29409,7 @@ var resolveEnsName = async ({
|
|
|
29260
29409
|
"latest"
|
|
29261
29410
|
]
|
|
29262
29411
|
});
|
|
29263
|
-
return `0x${decodeResult(
|
|
29412
|
+
return `0x${decodeResult(abi15, result2)[0].slice(-40)}`;
|
|
29264
29413
|
};
|
|
29265
29414
|
function parseEip3770Address(fullAddress) {
|
|
29266
29415
|
const parts = fullAddress.split(":");
|