omnipin 1.5.0 → 1.5.2

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.
Files changed (2) hide show
  1. package/dist/cli.js +177 -112
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -8075,6 +8075,50 @@ function format(value, decimals = 0) {
8075
8075
  function formatGwei(wei, unit = "wei") {
8076
8076
  return format(wei, exponents.gwei - exponents[unit]);
8077
8077
  }
8078
+ function from6(value, decimals = 0) {
8079
+ if (!/^(-?)([0-9]*)\.?([0-9]*)$/.test(value))
8080
+ throw new InvalidDecimalNumberError({ value });
8081
+ let [integer2 = "", fraction = "0"] = value.split(".");
8082
+ const negative = integer2.startsWith("-");
8083
+ if (negative)
8084
+ integer2 = integer2.slice(1);
8085
+ fraction = fraction.replace(/(0+)$/, "");
8086
+ if (decimals === 0) {
8087
+ if (Math.round(Number(`.${fraction}`)) === 1)
8088
+ integer2 = `${BigInt(integer2) + 1n}`;
8089
+ fraction = "";
8090
+ } else if (fraction.length > decimals) {
8091
+ const [left, unit, right] = [
8092
+ fraction.slice(0, decimals - 1),
8093
+ fraction.slice(decimals - 1, decimals),
8094
+ fraction.slice(decimals)
8095
+ ];
8096
+ const rounded = Math.round(Number(`${unit}.${right}`));
8097
+ if (rounded > 9)
8098
+ fraction = `${BigInt(left) + BigInt(1)}0`.padStart(left.length + 1, "0");
8099
+ else
8100
+ fraction = `${left}${rounded}`;
8101
+ if (fraction.length > decimals) {
8102
+ fraction = fraction.slice(1);
8103
+ integer2 = `${BigInt(integer2) + 1n}`;
8104
+ }
8105
+ fraction = fraction.slice(0, decimals);
8106
+ } else {
8107
+ fraction = fraction.padEnd(decimals, "0");
8108
+ }
8109
+ return BigInt(`${negative ? "-" : ""}${integer2}${fraction}`);
8110
+ }
8111
+ class InvalidDecimalNumberError extends BaseError {
8112
+ constructor({ value }) {
8113
+ super(`Value \`${value}\` is not a valid decimal number.`);
8114
+ Object.defineProperty(this, "name", {
8115
+ enumerable: true,
8116
+ configurable: true,
8117
+ writable: true,
8118
+ value: "Value.InvalidDecimalNumberError"
8119
+ });
8120
+ }
8121
+ }
8078
8122
  var BITS_PER_BYTE = 8;
8079
8123
  var FRS_PER_QUAD = 4;
8080
8124
  var LEAFS_PER_QUAD = BigInt(FRS_PER_QUAD);
@@ -8089,7 +8133,7 @@ var FR_RATIO = IN_BITS_FR / OUT_BITS_FR;
8089
8133
  var NODE_SIZE = OUT_BYTES_PER_QUAD / FRS_PER_QUAD;
8090
8134
  var EXPANDED_BYTES_PER_NODE = BigInt(NODE_SIZE);
8091
8135
  var MIN_PAYLOAD_SIZE = 2 * NODE_SIZE + 1;
8092
- var from6 = (bytes2) => {
8136
+ var from7 = (bytes2) => {
8093
8137
  if (bytes2 instanceof Uint8Array) {
8094
8138
  if (bytes2.length > NODE_SIZE) {
8095
8139
  return bytes2.subarray(0, NODE_SIZE);
@@ -8102,7 +8146,7 @@ var from6 = (bytes2) => {
8102
8146
  return node;
8103
8147
  };
8104
8148
  var empty = () => EMPTY;
8105
- var EMPTY = from6(new Uint8Array(NODE_SIZE).fill(0));
8149
+ var EMPTY = from7(new Uint8Array(NODE_SIZE).fill(0));
8106
8150
  Object.freeze(EMPTY.buffer);
8107
8151
  var exports_bytes2 = {};
8108
8152
  __export(exports_bytes2, {
@@ -9781,12 +9825,12 @@ class Codec {
9781
9825
  return this.decoder.decode(input2);
9782
9826
  }
9783
9827
  }
9784
- function from7({ name: name22, prefix: prefix2, encode: encode210, decode: decode22 }) {
9828
+ function from8({ name: name22, prefix: prefix2, encode: encode210, decode: decode22 }) {
9785
9829
  return new Codec(name22, prefix2, encode210, decode22);
9786
9830
  }
9787
9831
  function baseX({ name: name22, prefix: prefix2, alphabet: alphabet2 }) {
9788
9832
  const { encode: encode210, decode: decode22 } = base_x_default(alphabet2, name22);
9789
- return from7({
9833
+ return from8({
9790
9834
  prefix: prefix2,
9791
9835
  name: name22,
9792
9836
  encode: encode210,
@@ -9852,7 +9896,7 @@ function createAlphabetIdx(alphabet2) {
9852
9896
  }
9853
9897
  function rfc4648({ name: name22, prefix: prefix2, bitsPerChar, alphabet: alphabet2 }) {
9854
9898
  const alphabetIdx = createAlphabetIdx(alphabet2);
9855
- return from7({
9899
+ return from8({
9856
9900
  prefix: prefix2,
9857
9901
  name: name22,
9858
9902
  encode(input2) {
@@ -10536,7 +10580,7 @@ var toQauds = (size42) => {
10536
10580
  var fromHeight2 = (height2) => fromWidth(2n ** BigInt(height2));
10537
10581
  var fromWidth = (width) => width * EXPANDED_BYTES_PER_NODE;
10538
10582
  var DEFAULT_MIN_DIGEST_LENGTH = 20;
10539
- function from8({ name: name32, code: code42, encode: encode52, minDigestLength, maxDigestLength }) {
10583
+ function from9({ name: name32, code: code42, encode: encode52, minDigestLength, maxDigestLength }) {
10540
10584
  return new Hasher(name32, code42, encode52, minDigestLength, maxDigestLength);
10541
10585
  }
10542
10586
  class Hasher {
@@ -11531,7 +11575,7 @@ Object.defineProperty(AtomicityNotSupportedError, "code", {
11531
11575
  writable: true,
11532
11576
  value: 5760
11533
11577
  });
11534
- function from9(provider, _options = {}) {
11578
+ function from10(provider, _options = {}) {
11535
11579
  if (!provider)
11536
11580
  throw new IsUndefinedError();
11537
11581
  return {
@@ -11635,7 +11679,7 @@ function createStore(options = {}) {
11635
11679
  let id = options.id ?? 0;
11636
11680
  return {
11637
11681
  prepare(options2) {
11638
- return from10({
11682
+ return from11({
11639
11683
  id: id++,
11640
11684
  ...options2
11641
11685
  });
@@ -11645,7 +11689,7 @@ function createStore(options = {}) {
11645
11689
  }
11646
11690
  };
11647
11691
  }
11648
- function from10(options) {
11692
+ function from11(options) {
11649
11693
  return {
11650
11694
  ...options,
11651
11695
  jsonrpc: "2.0"
@@ -11794,8 +11838,8 @@ var filecoinCalibration = {
11794
11838
  blockExplorer: "https://filecoin-testnet.blockscout.com"
11795
11839
  };
11796
11840
  var filProvider = {
11797
- [filecoinMainnet.id]: from9(fromHttp("https://api.node.glif.io/rpc/v1")),
11798
- [filecoinCalibration.id]: from9(fromHttp("https://api.calibration.node.glif.io/rpc/v1"))
11841
+ [filecoinMainnet.id]: from10(fromHttp("https://api.node.glif.io/rpc/v1")),
11842
+ [filecoinCalibration.id]: from10(fromHttp("https://api.calibration.node.glif.io/rpc/v1"))
11799
11843
  };
11800
11844
  var chains = {
11801
11845
  [filecoinMainnet.id]: filecoinMainnet,
@@ -12644,7 +12688,7 @@ function getAmbiguousTypes(sourceParameters, targetParameters, args) {
12644
12688
  }
12645
12689
  return;
12646
12690
  }
12647
- function from11(abiItem, options = {}) {
12691
+ function from12(abiItem, options = {}) {
12648
12692
  const { prepare: prepare3 = true } = options;
12649
12693
  const item = (() => {
12650
12694
  if (Array.isArray(abiItem))
@@ -13506,7 +13550,7 @@ function encodePacked(types2, values2) {
13506
13550
  }
13507
13551
  encodePacked2.encode = encode82;
13508
13552
  })(encodePacked || (encodePacked = {}));
13509
- function from12(parameters) {
13553
+ function from13(parameters) {
13510
13554
  if (Array.isArray(parameters) && typeof parameters[0] === "string")
13511
13555
  return parseAbiParameters(parameters);
13512
13556
  if (typeof parameters === "string")
@@ -13620,8 +13664,8 @@ function decode9(...parameters) {
13620
13664
  }
13621
13665
  return values2;
13622
13666
  }
13623
- function from13(abiError, options = {}) {
13624
- return from11(abiError, options);
13667
+ function from14(abiError, options = {}) {
13668
+ return from12(abiError, options);
13625
13669
  }
13626
13670
  function fromAbi2(abi12, name62, options) {
13627
13671
  if (name62 === "Error")
@@ -13640,7 +13684,7 @@ function fromAbi2(abi12, name62, options) {
13640
13684
  throw new NotFoundError({ name: name62, type: "error" });
13641
13685
  return item;
13642
13686
  }
13643
- var solidityError = /* @__PURE__ */ from13({
13687
+ var solidityError = /* @__PURE__ */ from14({
13644
13688
  inputs: [
13645
13689
  {
13646
13690
  name: "message",
@@ -13651,7 +13695,7 @@ var solidityError = /* @__PURE__ */ from13({
13651
13695
  type: "error"
13652
13696
  });
13653
13697
  var solidityErrorSelector = "0x08c379a0";
13654
- var solidityPanic = /* @__PURE__ */ from13({
13698
+ var solidityPanic = /* @__PURE__ */ from14({
13655
13699
  inputs: [
13656
13700
  {
13657
13701
  name: "reason",
@@ -13997,7 +14041,7 @@ function readList(cursor, length22, to2) {
13997
14041
  value.push(decodeRlpCursor(cursor, to2));
13998
14042
  return value;
13999
14043
  }
14000
- function from14(value, options) {
14044
+ function from15(value, options) {
14001
14045
  const { as } = options;
14002
14046
  const encodable = getEncodable(value);
14003
14047
  const cursor = create5(new Uint8Array(encodable.length));
@@ -14008,7 +14052,7 @@ function from14(value, options) {
14008
14052
  }
14009
14053
  function fromHex5(hex, options = {}) {
14010
14054
  const { as = "Hex" } = options;
14011
- return from14(hex, { as });
14055
+ return from15(hex, { as });
14012
14056
  }
14013
14057
  function getEncodable(bytes2) {
14014
14058
  if (Array.isArray(bytes2))
@@ -14211,7 +14255,7 @@ function deserialize(serialized) {
14211
14255
  assert7(transaction);
14212
14256
  return transaction;
14213
14257
  }
14214
- function from15(envelope, options = {}) {
14258
+ function from16(envelope, options = {}) {
14215
14259
  const { signature } = options;
14216
14260
  const envelope_ = typeof envelope === "string" ? deserialize(envelope) : envelope;
14217
14261
  assert7(envelope_);
@@ -14295,7 +14339,7 @@ var simulateTransaction = async ({
14295
14339
  provider,
14296
14340
  to: to2,
14297
14341
  data,
14298
- from: from162
14342
+ from: from172
14299
14343
  }) => {
14300
14344
  return provider.request({
14301
14345
  method: "eth_call",
@@ -14303,7 +14347,7 @@ var simulateTransaction = async ({
14303
14347
  {
14304
14348
  to: to2,
14305
14349
  data,
14306
- from: from162
14350
+ from: from172
14307
14351
  },
14308
14352
  "latest"
14309
14353
  ]
@@ -14315,7 +14359,7 @@ var sendTransaction = async ({
14315
14359
  privateKey,
14316
14360
  to: to2,
14317
14361
  data,
14318
- from: from162
14362
+ from: from172
14319
14363
  }) => {
14320
14364
  const feeHistory = await provider.request({
14321
14365
  method: "eth_feeHistory",
@@ -14325,7 +14369,7 @@ var sendTransaction = async ({
14325
14369
  method: "eth_estimateGas",
14326
14370
  params: [
14327
14371
  {
14328
- from: from162,
14372
+ from: from172,
14329
14373
  to: to2,
14330
14374
  data,
14331
14375
  value: "0x0"
@@ -14336,7 +14380,7 @@ var sendTransaction = async ({
14336
14380
  logger.info(`Estimated gas: ${estimatedGas}`);
14337
14381
  const nonce = toBigInt(await provider.request({
14338
14382
  method: "eth_getTransactionCount",
14339
- params: [from162, "latest"]
14383
+ params: [from172, "latest"]
14340
14384
  }));
14341
14385
  const baseFeePerGas = BigInt(feeHistory.baseFeePerGas.slice(-1)[0]);
14342
14386
  if (!feeHistory.reward)
@@ -14344,8 +14388,8 @@ var sendTransaction = async ({
14344
14388
  const priorityFeePerGas = BigInt(feeHistory.reward.slice(-1)[0][1]);
14345
14389
  const maxPriorityFeePerGas = priorityFeePerGas;
14346
14390
  const maxFeePerGas = baseFeePerGas * 2n + maxPriorityFeePerGas;
14347
- const envelope = from15({
14348
- from: from162,
14391
+ const envelope = from16({
14392
+ from: from172,
14349
14393
  chainId,
14350
14394
  maxFeePerGas,
14351
14395
  maxPriorityFeePerGas,
@@ -14706,6 +14750,7 @@ var abi4 = ["address", "uint256", "string[]", "string[]", "bytes"];
14706
14750
  var metadata = [{ key: "withIPFSIndexing", value: "" }];
14707
14751
  var keys = metadata.map((item) => item.key);
14708
14752
  var values = metadata.map((item) => item.value);
14753
+ var priceBuffer = from6("0.5", 18);
14709
14754
  var createDataSet = async ({
14710
14755
  providerURL,
14711
14756
  privateKey,
@@ -14717,12 +14762,14 @@ var createDataSet = async ({
14717
14762
  }) => {
14718
14763
  const provider = filProvider[chain.id];
14719
14764
  const [funds] = await getAccountInfo({ address: payer, chain });
14720
- if (funds < perMonth) {
14765
+ logger.info(`Deposited funds: ${format(funds, 18)}`);
14766
+ if (funds <= perMonth + priceBuffer) {
14767
+ const depositAmount = perMonth - funds + priceBuffer;
14721
14768
  logger.warn("Not enough USDfc deposited to Filecoin Pay");
14722
- logger.info(`Depositing ${format(perMonth - funds, 18)} USDfc to Filecoin Pay`);
14769
+ logger.info(`Depositing ${format(depositAmount, 18)} USDfc to Filecoin Pay`);
14723
14770
  const hash3 = await depositAndApproveOperator({
14724
14771
  privateKey,
14725
- amount: perMonth - funds,
14772
+ amount: depositAmount,
14726
14773
  address: payer,
14727
14774
  chain
14728
14775
  });
@@ -14760,7 +14807,7 @@ var createDataSet = async ({
14760
14807
  }
14761
14808
  });
14762
14809
  const signature = toHex3(sign({ payload, privateKey }));
14763
- const extraData = encode7(from12(abi4), [
14810
+ const extraData = encode7(from13(abi4), [
14764
14811
  payer,
14765
14812
  clientDataSetId,
14766
14813
  keys,
@@ -15195,7 +15242,7 @@ var uploadPieceToDataSet = async ({
15195
15242
  const signature = toHex3(sign({ payload, privateKey }));
15196
15243
  const keys2 = [metadata2.map((m) => m.key)];
15197
15244
  const values2 = [metadata2.map((m) => m.value)];
15198
- const extraData = encode7(from12(abi11), [
15245
+ const extraData = encode7(from13(abi11), [
15199
15246
  nonce,
15200
15247
  keys2,
15201
15248
  values2,
@@ -15244,7 +15291,7 @@ var uploadPieceToDataSet = async ({
15244
15291
  cause: text2
15245
15292
  });
15246
15293
  }
15247
- throw new Error("Failed to create a dataset", { cause: text2 });
15294
+ throw new Error("Failed to upload to a data set", { cause: text2 });
15248
15295
  }
15249
15296
  const location = res.headers.get("Location");
15250
15297
  const hash2 = location?.split("/").pop();
@@ -15256,6 +15303,24 @@ var uploadPieceToDataSet = async ({
15256
15303
  statusUrl: new URL(location, providerURL).toString()
15257
15304
  };
15258
15305
  };
15306
+ var waitForDatasetReady = async (statusUrl) => {
15307
+ while (true) {
15308
+ const res = await fetch(statusUrl, { redirect: "follow" });
15309
+ const json = await res.json().catch(() => null);
15310
+ if (!json || !json.txStatus) {
15311
+ throw new Error(`Invalid dataset status response:
15312
+ ${await res.text()}`);
15313
+ }
15314
+ if (!json.dataSetCreated) {
15315
+ await new Promise((resolve) => setTimeout(resolve, 3e3));
15316
+ continue;
15317
+ }
15318
+ if (json.txStatus === "confirmed" && json.dataSetCreated) {
15319
+ return json;
15320
+ }
15321
+ throw new Error(`Dataset creation failed: txStatus="${json.txStatus}"`);
15322
+ }
15323
+ };
15259
15324
  var providerName4 = "Filecoin";
15260
15325
  var uploadToFilecoin = async ({
15261
15326
  providerAddress,
@@ -15282,8 +15347,6 @@ var uploadToFilecoin = async ({
15282
15347
  logger.info(`USDfc balance: ${format(balance, 18)}`);
15283
15348
  if (balance === 0n)
15284
15349
  throw new DeployError(providerName4, "No USDfc on account");
15285
- logger.info(`Filecoin SP address: ${providerAddress}`);
15286
- logger.info(`Filecoin SP URL: ${providerURL}`);
15287
15350
  const providerId = await getProviderIdByAddress({
15288
15351
  providerAddress,
15289
15352
  chain
@@ -15317,6 +15380,8 @@ var uploadToFilecoin = async ({
15317
15380
  logger.info(`Pending data set creation: ${statusUrl2}`);
15318
15381
  logger.info(`Pending transaction: ${chain.blockExplorer}/tx/${hash3}`);
15319
15382
  await waitForTransaction(filProvider[chainId], hash3);
15383
+ await waitForDatasetReady(statusUrl2);
15384
+ logger.success("Data set registered");
15320
15385
  } else {
15321
15386
  logger.info(`Using existing dataset: ${providerDataSets[0].dataSetId}`);
15322
15387
  datasetId = providerDataSets[0].dataSetId;
@@ -15513,7 +15578,7 @@ __export(exports_ed25519, {
15513
15578
  or: () => or5,
15514
15579
  name: () => name7,
15515
15580
  generate: () => generate,
15516
- from: () => from17,
15581
+ from: () => from18,
15517
15582
  format: () => format6,
15518
15583
  encode: () => encode13,
15519
15584
  derive: () => derive,
@@ -15531,7 +15596,7 @@ __export(exports_signer, {
15531
15596
  or: () => or5,
15532
15597
  name: () => name7,
15533
15598
  generate: () => generate,
15534
- from: () => from17,
15599
+ from: () => from18,
15535
15600
  format: () => format6,
15536
15601
  encode: () => encode13,
15537
15602
  derive: () => derive,
@@ -16362,7 +16427,7 @@ var parse3 = (did2) => {
16362
16427
  }
16363
16428
  };
16364
16429
  var format3 = (id) => id.did();
16365
- var from16 = (principal2) => {
16430
+ var from17 = (principal2) => {
16366
16431
  if (principal2 instanceof DID) {
16367
16432
  return principal2;
16368
16433
  } else if (principal2 instanceof Uint8Array) {
@@ -16731,7 +16796,7 @@ class Importer {
16731
16796
  }
16732
16797
  }
16733
16798
  var create7 = (importers) => {
16734
- const from172 = (archive3) => {
16799
+ const from182 = (archive3) => {
16735
16800
  if (archive3.id.startsWith("did:key:")) {
16736
16801
  return importWith(archive3, importers);
16737
16802
  } else {
@@ -16746,7 +16811,7 @@ var create7 = (importers) => {
16746
16811
  throw new Error(`Archive ${archive3.id} contains no keys`);
16747
16812
  }
16748
16813
  };
16749
- return from172;
16814
+ return from182;
16750
16815
  };
16751
16816
  var importWith = (archive3, importers) => {
16752
16817
  for (const importer2 of importers) {
@@ -16817,7 +16882,7 @@ var derive = async (secret) => {
16817
16882
  signer.set(publicKey, PRIVATE_TAG_SIZE + KEY_SIZE + PUBLIC_TAG_SIZE2);
16818
16883
  return signer;
16819
16884
  };
16820
- var from17 = ({ id, keys: keys2 }) => {
16885
+ var from18 = ({ id, keys: keys2 }) => {
16821
16886
  if (id.startsWith("did:key:")) {
16822
16887
  const key = keys2[id];
16823
16888
  if (key instanceof Uint8Array) {
@@ -16826,7 +16891,7 @@ var from17 = ({ id, keys: keys2 }) => {
16826
16891
  }
16827
16892
  throw new TypeError(`Unsupported archive format`);
16828
16893
  };
16829
- var or5 = (other) => or4({ from: from17 }, other);
16894
+ var or5 = (other) => or4({ from: from18 }, other);
16830
16895
  var decode14 = (bytes2) => {
16831
16896
  if (bytes2.byteLength !== SIZE2) {
16832
16897
  throw new Error(`Expected Uint8Array with byteLength of ${SIZE2} instead not ${bytes2.byteLength}`);
@@ -17675,10 +17740,10 @@ class View {
17675
17740
  return this.model.v;
17676
17741
  }
17677
17742
  get issuer() {
17678
- return from16(this.model.iss);
17743
+ return from17(this.model.iss);
17679
17744
  }
17680
17745
  get audience() {
17681
- return from16(this.model.aud);
17746
+ return from17(this.model.aud);
17682
17747
  }
17683
17748
  get capabilities() {
17684
17749
  return this.model.att;
@@ -17754,7 +17819,7 @@ class View {
17754
17819
  }
17755
17820
  }
17756
17821
  var code10 = code3;
17757
- var from18 = (model) => new CBORView(model);
17822
+ var from19 = (model) => new CBORView(model);
17758
17823
  var encode17 = (model) => {
17759
17824
  const { fct, nnc, nbf, ...payload } = readPayload(model);
17760
17825
  return encode4({
@@ -17840,12 +17905,12 @@ __export(exports_sha2, {
17840
17905
  sha512: () => sha512,
17841
17906
  sha256: () => sha2563
17842
17907
  });
17843
- var sha2563 = from8({
17908
+ var sha2563 = from9({
17844
17909
  name: "sha2-256",
17845
17910
  code: 18,
17846
17911
  encode: (input2) => coerce(crypto5.createHash("sha256").update(input2).digest())
17847
17912
  });
17848
- var sha512 = from8({
17913
+ var sha512 = from9({
17849
17914
  name: "sha2-512",
17850
17915
  code: 19,
17851
17916
  encode: (input2) => coerce(crypto5.createHash("sha512").update(input2).digest())
@@ -17891,7 +17956,7 @@ var issue = async ({
17891
17956
  nnc: nonce
17892
17957
  });
17893
17958
  const payload = encodeSignaturePayload(data, v, issuer.signatureAlgorithm);
17894
- return from18({
17959
+ return from19({
17895
17960
  ...data,
17896
17961
  v,
17897
17962
  s: await issuer.sign(payload)
@@ -18681,7 +18746,7 @@ __export(exports_uri, {
18681
18746
  uri: () => uri,
18682
18747
  read: () => read2,
18683
18748
  match: () => match,
18684
- from: () => from20
18749
+ from: () => from21
18685
18750
  });
18686
18751
  var ok = (value) => {
18687
18752
  if (value == null) {
@@ -19469,7 +19534,7 @@ var schema = new URISchema({});
19469
19534
  var uri = () => schema;
19470
19535
  var read2 = (input2) => schema.read(input2);
19471
19536
  var match = (options) => new URISchema(options);
19472
- var from20 = (input2) => schema.from(input2);
19537
+ var from21 = (input2) => schema.from(input2);
19473
19538
  var exports_link2 = {};
19474
19539
  __export(exports_link2, {
19475
19540
  schema: () => schema2,
@@ -19522,7 +19587,7 @@ __export(exports_principal, {
19522
19587
  read: () => read4,
19523
19588
  principal: () => principal,
19524
19589
  match: () => match3,
19525
- from: () => from21
19590
+ from: () => from22
19526
19591
  });
19527
19592
  class PrincipalSchema extends API {
19528
19593
  readWith(source, method) {
@@ -19546,7 +19611,7 @@ var schema3 = new PrincipalSchema();
19546
19611
  var principal = () => schema3;
19547
19612
  var read4 = (input2) => schema3.read(input2);
19548
19613
  var match3 = (options = {}) => new PrincipalSchema(options.method);
19549
- var from21 = (input2) => match3({}).from(input2);
19614
+ var from22 = (input2) => match3({}).from(input2);
19550
19615
  var exports_did2 = {};
19551
19616
  __export(exports_did2, {
19552
19617
  readBytes: () => readBytes2,
@@ -19554,7 +19619,7 @@ __export(exports_did2, {
19554
19619
  matchBytes: () => matchBytes,
19555
19620
  match: () => match4,
19556
19621
  fromBytes: () => fromBytes6,
19557
- from: () => from22,
19622
+ from: () => from23,
19558
19623
  didBytes: () => didBytes,
19559
19624
  did: () => did
19560
19625
  });
@@ -19572,7 +19637,7 @@ var schema4 = string().refine(new DIDSchema());
19572
19637
  var did = () => schema4;
19573
19638
  var read5 = (input2) => schema4.read(input2);
19574
19639
  var match4 = (options = {}) => string().refine(new DIDSchema(options.method));
19575
- var from22 = (input2) => match4({}).from(input2);
19640
+ var from23 = (input2) => match4({}).from(input2);
19576
19641
  class DIDBytesSchema extends API {
19577
19642
  readWith(source, method) {
19578
19643
  if (!(source instanceof Uint8Array)) {
@@ -20913,7 +20978,7 @@ function decode25(str) {
20913
20978
  }
20914
20979
  return new Uint8Array(byts);
20915
20980
  }
20916
- var base256emoji = from7({
20981
+ var base256emoji = from8({
20917
20982
  prefix: "\u{1F680}",
20918
20983
  name: "base256emoji",
20919
20984
  encode: encode23,
@@ -20933,7 +20998,7 @@ var exports_identity2 = {};
20933
20998
  __export(exports_identity2, {
20934
20999
  identity: () => identity2
20935
21000
  });
20936
- var identity2 = from7({
21001
+ var identity2 = from8({
20937
21002
  prefix: "\0",
20938
21003
  name: "identity",
20939
21004
  encode: (buf2) => toString2(buf2),
@@ -21914,7 +21979,7 @@ var capability = ({
21914
21979
  var defaultNBSchema = exports_schema3.struct({});
21915
21980
  var or7 = (left, right) => new Or(left, right);
21916
21981
  var and2 = (...selectors) => new And(selectors);
21917
- var derive2 = ({ from: from232, to: to2, derives }) => new Derive(from232, to2, derives);
21982
+ var derive2 = ({ from: from242, to: to2, derives }) => new Derive(from242, to2, derives);
21918
21983
  class View2 {
21919
21984
  match(source) {
21920
21985
  return { error: new UnknownCapability(source.capability) };
@@ -22063,9 +22128,9 @@ class And extends View2 {
22063
22128
  }
22064
22129
  }
22065
22130
  class Derive extends Unit {
22066
- constructor(from232, to2, derives) {
22131
+ constructor(from242, to2, derives) {
22067
22132
  super();
22068
- this.from = from232;
22133
+ this.from = from242;
22069
22134
  this.to = to2;
22070
22135
  this.derives = derives;
22071
22136
  }
@@ -22152,9 +22217,9 @@ class Match2 {
22152
22217
  }
22153
22218
  }
22154
22219
  class DerivedMatch {
22155
- constructor(selected, from232, derives) {
22220
+ constructor(selected, from242, derives) {
22156
22221
  this.selected = selected;
22157
- this.from = from232;
22222
+ this.from = from242;
22158
22223
  this.derives = derives;
22159
22224
  }
22160
22225
  get can() {
@@ -22179,10 +22244,10 @@ class DerivedMatch {
22179
22244
  return selected ? new DerivedMatch(selected, this.from, this.derives) : null;
22180
22245
  }
22181
22246
  select(capabilities) {
22182
- const { derives, selected, from: from232 } = this;
22247
+ const { derives, selected, from: from242 } = this;
22183
22248
  const { value } = selected;
22184
22249
  const direct = selected.select(capabilities);
22185
- const derived = from232.select(capabilities);
22250
+ const derived = from242.select(capabilities);
22186
22251
  const matches = [];
22187
22252
  const errors = [];
22188
22253
  for (const match6 of derived.matches) {
@@ -22201,7 +22266,7 @@ class DerivedMatch {
22201
22266
  ...derived.errors.map((error3) => new DelegationError([error3], this))
22202
22267
  ],
22203
22268
  matches: [
22204
- ...direct.matches.map((match6) => new DerivedMatch(match6, from232, derives)),
22269
+ ...direct.matches.map((match6) => new DerivedMatch(match6, from242, derives)),
22205
22270
  ...matches
22206
22271
  ]
22207
22272
  };
@@ -22442,8 +22507,8 @@ var filecoinOffer = capability({
22442
22507
  content: exports_schema3.link(),
22443
22508
  piece: PieceLink
22444
22509
  }),
22445
- derives: (claim, from232) => {
22446
- return and3(equalWith(claim, from232)) || and3(checkLink(claim.nb.content, from232.nb.content, "nb.content")) || and3(checkLink(claim.nb.piece, from232.nb.piece, "nb.piece")) || ok({});
22510
+ derives: (claim, from242) => {
22511
+ return and3(equalWith(claim, from242)) || and3(checkLink(claim.nb.content, from242.nb.content, "nb.content")) || and3(checkLink(claim.nb.piece, from242.nb.piece, "nb.piece")) || ok({});
22447
22512
  }
22448
22513
  });
22449
22514
  var filecoinSubmit = capability({
@@ -22453,8 +22518,8 @@ var filecoinSubmit = capability({
22453
22518
  content: exports_schema3.link(),
22454
22519
  piece: PieceLink
22455
22520
  }),
22456
- derives: (claim, from232) => {
22457
- return and3(equalWith(claim, from232)) || and3(checkLink(claim.nb.content, from232.nb.content, "nb.content")) || and3(checkLink(claim.nb.piece, from232.nb.piece, "nb.piece")) || ok({});
22521
+ derives: (claim, from242) => {
22522
+ return and3(equalWith(claim, from242)) || and3(checkLink(claim.nb.content, from242.nb.content, "nb.content")) || and3(checkLink(claim.nb.piece, from242.nb.piece, "nb.piece")) || ok({});
22458
22523
  }
22459
22524
  });
22460
22525
  var filecoinAccept = capability({
@@ -22464,8 +22529,8 @@ var filecoinAccept = capability({
22464
22529
  content: exports_schema3.link(),
22465
22530
  piece: PieceLink
22466
22531
  }),
22467
- derives: (claim, from232) => {
22468
- return and3(equalWith(claim, from232)) || and3(checkLink(claim.nb.content, from232.nb.content, "nb.content")) || and3(checkLink(claim.nb.piece, from232.nb.piece, "nb.piece")) || ok({});
22532
+ derives: (claim, from242) => {
22533
+ return and3(equalWith(claim, from242)) || and3(checkLink(claim.nb.content, from242.nb.content, "nb.content")) || and3(checkLink(claim.nb.piece, from242.nb.piece, "nb.piece")) || ok({});
22469
22534
  }
22470
22535
  });
22471
22536
  var filecoinInfo = capability({
@@ -22474,8 +22539,8 @@ var filecoinInfo = capability({
22474
22539
  nb: exports_schema3.struct({
22475
22540
  piece: PieceLink
22476
22541
  }),
22477
- derives: (claim, from232) => {
22478
- return and3(equalWith(claim, from232)) || and3(checkLink(claim.nb.piece, from232.nb.piece, "nb.piece")) || ok({});
22542
+ derives: (claim, from242) => {
22543
+ return and3(equalWith(claim, from242)) || and3(checkLink(claim.nb.piece, from242.nb.piece, "nb.piece")) || ok({});
22479
22544
  }
22480
22545
  });
22481
22546
  var services = {
@@ -22569,8 +22634,8 @@ var pieceOffer = capability({
22569
22634
  piece: PieceLink,
22570
22635
  group: exports_schema3.text()
22571
22636
  }),
22572
- derives: (claim, from232) => {
22573
- return and3(equalWith(claim, from232)) || and3(checkLink(claim.nb.piece, from232.nb.piece, "nb.piece")) || and3(equal(claim.nb.group, from232.nb.group, "nb.group")) || ok({});
22637
+ derives: (claim, from242) => {
22638
+ return and3(equalWith(claim, from242)) || and3(checkLink(claim.nb.piece, from242.nb.piece, "nb.piece")) || and3(equal(claim.nb.group, from242.nb.group, "nb.group")) || ok({});
22574
22639
  }
22575
22640
  });
22576
22641
  var pieceAccept = capability({
@@ -22580,8 +22645,8 @@ var pieceAccept = capability({
22580
22645
  piece: PieceLink,
22581
22646
  group: exports_schema3.text()
22582
22647
  }),
22583
- derives: (claim, from232) => {
22584
- return and3(equalWith(claim, from232)) || and3(checkLink(claim.nb.piece, from232.nb.piece, "nb.piece")) || and3(equal(claim.nb.group, from232.nb.group, "nb.group")) || ok({});
22648
+ derives: (claim, from242) => {
22649
+ return and3(equalWith(claim, from242)) || and3(checkLink(claim.nb.piece, from242.nb.piece, "nb.piece")) || and3(equal(claim.nb.group, from242.nb.group, "nb.group")) || ok({});
22585
22650
  }
22586
22651
  });
22587
22652
  var connection4 = connect({
@@ -22599,8 +22664,8 @@ var aggregateOffer = capability({
22599
22664
  aggregate: PieceLink,
22600
22665
  pieces: exports_schema3.link({ version: 1 })
22601
22666
  }),
22602
- derives: (claim, from232) => {
22603
- return and3(equalWith(claim, from232)) || and3(checkLink(claim.nb.aggregate, from232.nb.aggregate, "nb.aggregate")) || and3(checkLink(claim.nb.pieces, from232.nb.pieces, "nb.pieces")) || ok({});
22667
+ derives: (claim, from242) => {
22668
+ return and3(equalWith(claim, from242)) || and3(checkLink(claim.nb.aggregate, from242.nb.aggregate, "nb.aggregate")) || and3(checkLink(claim.nb.pieces, from242.nb.pieces, "nb.pieces")) || ok({});
22604
22669
  }
22605
22670
  });
22606
22671
  var aggregateAccept = capability({
@@ -22610,8 +22675,8 @@ var aggregateAccept = capability({
22610
22675
  aggregate: PieceLink,
22611
22676
  pieces: exports_schema3.link()
22612
22677
  }),
22613
- derives: (claim, from232) => {
22614
- return and3(equalWith(claim, from232)) || and3(checkLink(claim.nb.aggregate, from232.nb.aggregate, "nb.aggregate")) || and3(checkLink(claim.nb.pieces, from232.nb.pieces, "nb.pieces")) || ok({});
22678
+ derives: (claim, from242) => {
22679
+ return and3(equalWith(claim, from242)) || and3(checkLink(claim.nb.aggregate, from242.nb.aggregate, "nb.aggregate")) || and3(checkLink(claim.nb.pieces, from242.nb.pieces, "nb.pieces")) || ok({});
22615
22680
  }
22616
22681
  });
22617
22682
  var connection5 = connect({
@@ -22628,8 +22693,8 @@ var dealInfo = capability({
22628
22693
  nb: exports_schema3.struct({
22629
22694
  piece: PieceLink
22630
22695
  }),
22631
- derives: (claim, from232) => {
22632
- return and3(equalWith(claim, from232)) || and3(checkLink(claim.nb.piece, from232.nb.piece, "nb.piece")) || ok({});
22696
+ derives: (claim, from242) => {
22697
+ return and3(equalWith(claim, from242)) || and3(checkLink(claim.nb.piece, from242.nb.piece, "nb.piece")) || ok({});
22633
22698
  }
22634
22699
  });
22635
22700
  var connection6 = connect({
@@ -22817,8 +22882,8 @@ var put = capability({
22817
22882
  url: exports_schema3.string().or(Await),
22818
22883
  headers: exports_schema3.dictionary({ value: exports_schema3.string() }).or(Await)
22819
22884
  }),
22820
- derives: (claim, from232) => {
22821
- return and3(equalWith(claim, from232)) || and3(equalBody(claim, from232)) || and3(equal(claim.nb.url, from232.nb, "url")) || and3(equal(claim.nb.headers, from232.nb, "headers")) || ok({});
22885
+ derives: (claim, from242) => {
22886
+ return and3(equalWith(claim, from242)) || and3(equalBody(claim, from242)) || and3(equal(claim.nb.url, from242.nb, "url")) || and3(equal(claim.nb.headers, from242.nb, "headers")) || ok({});
22822
22887
  }
22823
22888
  });
22824
22889
  var UCANLink = exports_schema3.link({ version: 1 });
@@ -22834,7 +22899,7 @@ var revoke = capability({
22834
22899
  ucan: UCANLink,
22835
22900
  proof: UCANLink.array().optional()
22836
22901
  }),
22837
- derives: (claim, from232) => and3(equalWith(claim, from232)) ?? and3(checkLink(claim.nb.ucan, from232.nb.ucan, "nb.ucan")) ?? equal((claim.nb.proof ?? []).join("/"), (from232.nb.proof ?? []).join("/"), "nb.proof")
22902
+ derives: (claim, from242) => and3(equalWith(claim, from242)) ?? and3(checkLink(claim.nb.ucan, from242.nb.ucan, "nb.ucan")) ?? equal((claim.nb.proof ?? []).join("/"), (from242.nb.proof ?? []).join("/"), "nb.proof")
22838
22903
  });
22839
22904
  var conclude = capability({
22840
22905
  can: "ucan/conclude",
@@ -22842,7 +22907,7 @@ var conclude = capability({
22842
22907
  nb: exports_schema3.struct({
22843
22908
  receipt: exports_schema3.link()
22844
22909
  }),
22845
- derives: (claim, from232) => and3(equalWith(claim, from232)) || and3(checkLink(claim.nb.receipt, from232.nb.receipt, "nb.receipt")) || ok({})
22910
+ derives: (claim, from242) => and3(equalWith(claim, from242)) || and3(checkLink(claim.nb.receipt, from242.nb.receipt, "nb.receipt")) || ok({})
22846
22911
  });
22847
22912
  var attest = capability({
22848
22913
  can: "ucan/attest",
@@ -22850,7 +22915,7 @@ var attest = capability({
22850
22915
  nb: exports_schema3.struct({
22851
22916
  proof: exports_schema3.link({ version: 1 })
22852
22917
  }),
22853
- derives: (claim, from232) => and3(equalWith(claim, from232)) ?? checkLink(claim.nb.proof, from232.nb.proof, "nb.proof")
22918
+ derives: (claim, from242) => and3(equalWith(claim, from242)) ?? checkLink(claim.nb.proof, from242.nb.proof, "nb.proof")
22854
22919
  });
22855
22920
  var blob3 = capability({
22856
22921
  can: "web3.storage/blob/*",
@@ -22865,8 +22930,8 @@ var allocate2 = capability({
22865
22930
  cause: exports_link2,
22866
22931
  space: SpaceDID
22867
22932
  }),
22868
- derives: (claim, from232) => {
22869
- return and3(equalWith(claim, from232)) || and3(equalBlob(claim, from232)) || and3(checkLink(claim.nb.cause, from232.nb.cause, "cause")) || and3(equal(claim.nb.space, from232.nb.space, "space")) || ok({});
22933
+ derives: (claim, from242) => {
22934
+ return and3(equalWith(claim, from242)) || and3(equalBlob(claim, from242)) || and3(checkLink(claim.nb.cause, from242.nb.cause, "cause")) || and3(equal(claim.nb.space, from242.nb.space, "space")) || ok({});
22870
22935
  }
22871
22936
  });
22872
22937
  var accept2 = capability({
@@ -22878,8 +22943,8 @@ var accept2 = capability({
22878
22943
  space: SpaceDID,
22879
22944
  _put: Await
22880
22945
  }),
22881
- derives: (claim, from232) => {
22882
- return and3(equalWith(claim, from232)) || and3(equalBlob(claim, from232)) || and3(equal(claim.nb.ttl, from232.nb.ttl, "ttl")) || and3(equal(claim.nb.space, from232.nb.space, "space")) || ok({});
22946
+ derives: (claim, from242) => {
22947
+ return and3(equalWith(claim, from242)) || and3(equalBlob(claim, from242)) || and3(equal(claim.nb.ttl, from242.nb.ttl, "ttl")) || and3(equal(claim.nb.space, from242.nb.space, "space")) || ok({});
22883
22948
  }
22884
22949
  });
22885
22950
  var exports_rsa = {};
@@ -22889,7 +22954,7 @@ __export(exports_rsa, {
22889
22954
  or: () => or8,
22890
22955
  name: () => name10,
22891
22956
  generate: () => generate2,
22892
- from: () => from23,
22957
+ from: () => from24,
22893
22958
  decode: () => decode32,
22894
22959
  code: () => code12,
22895
22960
  Verifier: () => RSAVerifier
@@ -23164,7 +23229,7 @@ var generate2 = async ({
23164
23229
  });
23165
23230
  }
23166
23231
  };
23167
- var from23 = ({ id, keys: keys2 }) => {
23232
+ var from24 = ({ id, keys: keys2 }) => {
23168
23233
  if (id.startsWith("did:key:")) {
23169
23234
  const did2 = id;
23170
23235
  const key = keys2[did2];
@@ -23180,7 +23245,7 @@ var from23 = ({ id, keys: keys2 }) => {
23180
23245
  throw new TypeError(`RSA can not import from ${id} archive, try generic Signer instead`);
23181
23246
  }
23182
23247
  };
23183
- var or8 = (other) => or4({ from: from23 }, other);
23248
+ var or8 = (other) => or4({ from: from24 }, other);
23184
23249
  var decode32 = (bytes2) => {
23185
23250
  const rsa = decode31(untagWith(code12, bytes2));
23186
23251
  const publicBytes = tagWith(verifierCode, encode28(rsa));
@@ -24145,8 +24210,8 @@ var add5 = capability({
24145
24210
  root: exports_link2,
24146
24211
  shards: CARLink.array().optional()
24147
24212
  }),
24148
- derives: (self2, from24) => {
24149
- return and3(equalWith(self2, from24)) || and3(equal(self2.nb.root, from24.nb.root, "root")) || and3(equal(self2.nb.shards, from24.nb.shards, "shards")) || ok({});
24213
+ derives: (self2, from25) => {
24214
+ return and3(equalWith(self2, from25)) || and3(equal(self2.nb.root, from25.nb.root, "root")) || and3(equal(self2.nb.shards, from25.nb.shards, "shards")) || ok({});
24150
24215
  }
24151
24216
  });
24152
24217
  var get4 = capability({
@@ -24155,15 +24220,15 @@ var get4 = capability({
24155
24220
  nb: exports_schema3.struct({
24156
24221
  root: exports_link2.optional()
24157
24222
  }),
24158
- derives: (self2, from24) => {
24159
- const res = equalWith(self2, from24);
24223
+ derives: (self2, from25) => {
24224
+ const res = equalWith(self2, from25);
24160
24225
  if (res.error) {
24161
24226
  return res;
24162
24227
  }
24163
- if (!from24.nb.root) {
24228
+ if (!from25.nb.root) {
24164
24229
  return res;
24165
24230
  }
24166
- return equal(self2.nb.root, from24.nb.root, "root");
24231
+ return equal(self2.nb.root, from25.nb.root, "root");
24167
24232
  }
24168
24233
  });
24169
24234
  var remove2 = capability({
@@ -24172,8 +24237,8 @@ var remove2 = capability({
24172
24237
  nb: exports_schema3.struct({
24173
24238
  root: exports_link2
24174
24239
  }),
24175
- derives: (self2, from24) => {
24176
- return and3(equalWith(self2, from24)) || and3(equal(self2.nb.root, from24.nb.root, "root")) || ok({});
24240
+ derives: (self2, from25) => {
24241
+ return and3(equalWith(self2, from25)) || and3(equal(self2.nb.root, from25.nb.root, "root")) || ok({});
24177
24242
  }
24178
24243
  });
24179
24244
  var list2 = capability({
@@ -27407,17 +27472,17 @@ function fromNumberTo32BitBuf(number2) {
27407
27472
  }
27408
27473
  return new Uint8Array(bytes2);
27409
27474
  }
27410
- var murmur332 = from8({
27475
+ var murmur332 = from9({
27411
27476
  name: "murmur3-32",
27412
27477
  code: 35,
27413
27478
  encode: (input2) => fromNumberTo32BitBuf(import_murmurhash3js_revisited.default.x86.hash32(input2))
27414
27479
  });
27415
- var murmur3128 = from8({
27480
+ var murmur3128 = from9({
27416
27481
  name: "murmur3-128",
27417
27482
  code: 34,
27418
27483
  encode: (input2) => exports_bytes2.fromHex(import_murmurhash3js_revisited.default.x64.hash128(input2))
27419
27484
  });
27420
- var murmur364 = from8({
27485
+ var murmur364 = from9({
27421
27486
  name: "murmur3-x64-64",
27422
27487
  code: 34,
27423
27488
  encode: (input2) => exports_bytes2.fromHex(import_murmurhash3js_revisited.default.x64.hash128(input2)).subarray(0, 8)
@@ -29392,7 +29457,7 @@ var execTransactionWithRole = async ({
29392
29457
  resolverAddress,
29393
29458
  data: txData,
29394
29459
  rolesModAddress,
29395
- from: from24,
29460
+ from: from25,
29396
29461
  privateKey,
29397
29462
  chainId,
29398
29463
  explorerUrl
@@ -29409,14 +29474,14 @@ var execTransactionWithRole = async ({
29409
29474
  provider,
29410
29475
  to: rolesModAddress,
29411
29476
  data,
29412
- from: from24
29477
+ from: from25
29413
29478
  });
29414
29479
  if (success) {
29415
29480
  const hash2 = await sendTransaction({
29416
29481
  privateKey,
29417
29482
  to: rolesModAddress,
29418
29483
  data,
29419
- from: from24,
29484
+ from: from25,
29420
29485
  provider,
29421
29486
  chainId
29422
29487
  });
@@ -29447,7 +29512,7 @@ var ensAction = async ({
29447
29512
  throw new MissingCLIArgsError(["domain"]);
29448
29513
  const chain = chains2[chainName];
29449
29514
  const transport = fromHttp(rpcUrl ?? chainToRpcUrl(chainName));
29450
- const provider = from9(transport);
29515
+ const provider = from10(transport);
29451
29516
  const pk = process.env.OMNIPIN_PK;
29452
29517
  if (!pk)
29453
29518
  throw new MissingKeyError("PK");
@@ -29472,7 +29537,7 @@ var ensAction = async ({
29472
29537
  }
29473
29538
  const address = fromPublicKey(getPublicKey({ privateKey: pk }));
29474
29539
  logger.info(`Validating transaction for wallet ${address}`);
29475
- const from24 = safeAddress ? getEip3770Address({ fullAddress: safeAddress, chainId: chain.id }).address : address;
29540
+ const from25 = safeAddress ? getEip3770Address({ fullAddress: safeAddress, chainId: chain.id }).address : address;
29476
29541
  const data = encodeData2(setContentHash, [node, `0x${contentHash}`]);
29477
29542
  if (options.verbose)
29478
29543
  console.log("Transaction encoded data:", data);
@@ -29559,7 +29624,7 @@ Open in a browser: ${isTTY ? styleText2("underline", safeLink) : safeLink}`);
29559
29624
  provider,
29560
29625
  to: to2,
29561
29626
  data,
29562
- from: from24
29627
+ from: from25
29563
29628
  });
29564
29629
  const hash2 = await sendTransaction({
29565
29630
  privateKey: pk,
@@ -29567,7 +29632,7 @@ Open in a browser: ${isTTY ? styleText2("underline", safeLink) : safeLink}`);
29567
29632
  chainId: chain.id,
29568
29633
  to: to2,
29569
29634
  data,
29570
- from: from24
29635
+ from: from25
29571
29636
  });
29572
29637
  logger.info(`Transaction pending: ${chain.blockExplorers.default.url}/tx/${hash2}`);
29573
29638
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnipin",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "author": "v1rtl <hi@v1rtl.site>",
5
5
  "repository": {
6
6
  "type": "git",