@rozoai/checkout 0.1.10 → 0.1.11

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.
@@ -153,6 +153,9 @@ function maskMemo(memo) {
153
153
  return `${s.slice(0, 4)}...${s.slice(-3)}`;
154
154
  }
155
155
 
156
+ // scripts/src/lib/api.mjs
157
+ import { createRequire } from "node:module";
158
+
156
159
  // scripts/src/lib/http.mjs
157
160
  var DEFAULT_TIMEOUT_MS = 2e4;
158
161
  var USER_AGENT = "rozo-checkout-skill/1.0";
@@ -222,7 +225,20 @@ function postJson(url, body, opts) {
222
225
  }
223
226
 
224
227
  // scripts/src/lib/api.mjs
228
+ var PKG_VERSION = (() => {
229
+ const requireFrom = createRequire(import.meta.url);
230
+ for (const candidate of ["../../package.json", "../../../package.json"]) {
231
+ try {
232
+ const pkg = requireFrom(candidate);
233
+ if (pkg?.name === "@rozoai/checkout" && pkg.version) return pkg.version;
234
+ } catch {
235
+ }
236
+ }
237
+ return "0.0.0";
238
+ })();
225
239
  var MPP_BASE = process.env.ROZO_CHECKOUT_MPP_BASE || "https://apiserver.mpprouter.dev/v1/services/rozo-agent-api";
240
+ var CLIENT_LABEL = `rozo-checkout-cli/${PKG_VERSION}`;
241
+ var ATTRIBUTION_CLIENT = `rozo-checkout-skill/${PKG_VERSION}`;
226
242
  var INTENTS_BASE = process.env.ROZO_CHECKOUT_INTENTS_BASE || "https://intentapiv4.rozo.ai/functions/v1/payment-api";
227
243
  async function quoteInvoice({ url, linkId }) {
228
244
  const body = url ? { url } : { payment_id: linkId };
@@ -232,7 +248,9 @@ async function createInvoice({ url, linkId, source, quoteReceipt }) {
232
248
  const body = {
233
249
  ...url ? { url } : { payment_id: linkId },
234
250
  source: { chainId: String(source.chainId), tokenSymbol: source.tokenSymbol },
235
- ...quoteReceipt ? { quoteReceipt } : {}
251
+ ...quoteReceipt ? { quoteReceipt } : {},
252
+ client: CLIENT_LABEL,
253
+ attribution: { client: ATTRIBUTION_CLIENT }
236
254
  };
237
255
  return postJson(`${MPP_BASE}/create-invoice`, body);
238
256
  }
@@ -133,6 +133,9 @@ function extractLinkId(urlOrId) {
133
133
  );
134
134
  }
135
135
 
136
+ // scripts/src/lib/api.mjs
137
+ import { createRequire } from "node:module";
138
+
136
139
  // scripts/src/lib/http.mjs
137
140
  var DEFAULT_TIMEOUT_MS = 2e4;
138
141
  var USER_AGENT = "rozo-checkout-skill/1.0";
@@ -199,7 +202,20 @@ function postJson(url, body, opts) {
199
202
  }
200
203
 
201
204
  // scripts/src/lib/api.mjs
205
+ var PKG_VERSION = (() => {
206
+ const requireFrom = createRequire(import.meta.url);
207
+ for (const candidate of ["../../package.json", "../../../package.json"]) {
208
+ try {
209
+ const pkg = requireFrom(candidate);
210
+ if (pkg?.name === "@rozoai/checkout" && pkg.version) return pkg.version;
211
+ } catch {
212
+ }
213
+ }
214
+ return "0.0.0";
215
+ })();
202
216
  var MPP_BASE = process.env.ROZO_CHECKOUT_MPP_BASE || "https://apiserver.mpprouter.dev/v1/services/rozo-agent-api";
217
+ var CLIENT_LABEL = `rozo-checkout-cli/${PKG_VERSION}`;
218
+ var ATTRIBUTION_CLIENT = `rozo-checkout-skill/${PKG_VERSION}`;
203
219
  var INTENTS_BASE = process.env.ROZO_CHECKOUT_INTENTS_BASE || "https://intentapiv4.rozo.ai/functions/v1/payment-api";
204
220
  async function quoteInvoice({ url, linkId }) {
205
221
  const body = url ? { url } : { payment_id: linkId };
@@ -999,7 +999,7 @@ var init_size = __esm({
999
999
  var version2;
1000
1000
  var init_version2 = __esm({
1001
1001
  "node_modules/viem/_esm/errors/version.js"() {
1002
- version2 = "2.55.11";
1002
+ version2 = "2.55.13";
1003
1003
  }
1004
1004
  });
1005
1005
 
@@ -11454,14 +11454,6 @@ async function prepareTransactionRequest(client, args) {
11454
11454
  }
11455
11455
  let account = account_ ? parseAccount(account_) : account_;
11456
11456
  let nonce = request2.nonce;
11457
- if (parameters.includes("nonce") && typeof nonce === "undefined" && account && nonceManager) {
11458
- const chainId2 = await getChainId2();
11459
- nonce = await nonceManager.consume({
11460
- address: account.address,
11461
- chainId: chainId2,
11462
- client
11463
- });
11464
- }
11465
11457
  if (prepareTransactionRequest2?.fn && prepareTransactionRequest2.runAt?.includes("beforeFillTransaction")) {
11466
11458
  request2 = await prepareTransactionRequest2.fn({ ...request2, chain }, {
11467
11459
  client,
@@ -11471,13 +11463,21 @@ async function prepareTransactionRequest(client, args) {
11471
11463
  const sender = request2.account ?? request2.from;
11472
11464
  account = sender ? parseAccount(sender) : void 0;
11473
11465
  }
11466
+ if (parameters.includes("nonce") && typeof nonce === "undefined" && account && nonceManager) {
11467
+ const chainId2 = await getChainId2();
11468
+ nonce = await nonceManager.consume({
11469
+ address: account.address,
11470
+ chainId: chainId2,
11471
+ client
11472
+ });
11473
+ }
11474
11474
  const attemptFill = (() => {
11475
11475
  if ((parameters.includes("blobVersionedHashes") || parameters.includes("sidecars")) && request2.kzg && request2.blobs)
11476
11476
  return false;
11477
- if (supportsFillTransaction.get(client.uid) === false)
11478
- return false;
11479
11477
  if (parameters.length > 0 && "feePayer" in request2 && request2.feePayer && !("feePayerSignature" in request2 && request2.feePayerSignature))
11480
11478
  return true;
11479
+ if (supportsFillTransaction.get(client.uid) === false)
11480
+ return false;
11481
11481
  const shouldAttempt = ["fees", "gas"].some((parameter) => parameters.includes(parameter));
11482
11482
  if (!shouldAttempt)
11483
11483
  return false;
@@ -12609,17 +12609,29 @@ async function sendTransaction(client, parameters) {
12609
12609
  }
12610
12610
  }
12611
12611
  if (account?.type === "local") {
12612
- if (account.nonceManager && typeof nonce === "undefined") {
12613
- const requestChainId = rest.chainId;
12614
- const chainId = await (async () => {
12615
- if (typeof requestChainId === "number")
12616
- return requestChainId;
12617
- if (chain)
12618
- return chain.id;
12619
- return getAction(client, getChainId, "getChainId")({});
12620
- })();
12621
- nonceManagerParameters = { address: account.address, chainId };
12622
- }
12612
+ const nonceManager = (() => {
12613
+ if (!account.nonceManager || typeof nonce !== "undefined")
12614
+ return account.nonceManager;
12615
+ const nonceManager2 = account.nonceManager;
12616
+ return {
12617
+ consume(parameters2) {
12618
+ nonceManagerParameters = {
12619
+ address: parameters2.address,
12620
+ chainId: parameters2.chainId
12621
+ };
12622
+ return nonceManager2.consume(parameters2);
12623
+ },
12624
+ get(parameters2) {
12625
+ return nonceManager2.get(parameters2);
12626
+ },
12627
+ increment(parameters2) {
12628
+ return nonceManager2.increment(parameters2);
12629
+ },
12630
+ reset(parameters2) {
12631
+ return nonceManager2.reset(parameters2);
12632
+ }
12633
+ };
12634
+ })();
12623
12635
  const request2 = await getAction(client, prepareTransactionRequest, "prepareTransactionRequest")({
12624
12636
  account,
12625
12637
  accessList,
@@ -12633,7 +12645,7 @@ async function sendTransaction(client, parameters) {
12633
12645
  maxFeePerGas,
12634
12646
  maxPriorityFeePerGas,
12635
12647
  nonce,
12636
- nonceManager: account.nonceManager,
12648
+ nonceManager,
12637
12649
  parameters: [...defaultParameters, "sidecars"],
12638
12650
  type,
12639
12651
  value,
@@ -13138,6 +13150,7 @@ function bindActionDecorators(client, action) {
13138
13150
  "estimateGas",
13139
13151
  "prepare",
13140
13152
  "prepareRecipient",
13153
+ "predict",
13141
13154
  "simulate"
13142
13155
  ])
13143
13156
  if (Object.hasOwn(action, key)) {
@@ -20533,17 +20546,29 @@ async function sendTransactionSync(client, parameters) {
20533
20546
  return receipt;
20534
20547
  }
20535
20548
  if (account?.type === "local") {
20536
- if (account.nonceManager && typeof nonce === "undefined") {
20537
- const requestChainId = rest.chainId;
20538
- const chainId = await (async () => {
20539
- if (typeof requestChainId === "number")
20540
- return requestChainId;
20541
- if (chain)
20542
- return chain.id;
20543
- return getAction(client, getChainId, "getChainId")({});
20544
- })();
20545
- nonceManagerParameters = { address: account.address, chainId };
20546
- }
20549
+ const nonceManager = (() => {
20550
+ if (!account.nonceManager || typeof nonce !== "undefined")
20551
+ return account.nonceManager;
20552
+ const nonceManager2 = account.nonceManager;
20553
+ return {
20554
+ consume(parameters2) {
20555
+ nonceManagerParameters = {
20556
+ address: parameters2.address,
20557
+ chainId: parameters2.chainId
20558
+ };
20559
+ return nonceManager2.consume(parameters2);
20560
+ },
20561
+ get(parameters2) {
20562
+ return nonceManager2.get(parameters2);
20563
+ },
20564
+ increment(parameters2) {
20565
+ return nonceManager2.increment(parameters2);
20566
+ },
20567
+ reset(parameters2) {
20568
+ return nonceManager2.reset(parameters2);
20569
+ }
20570
+ };
20571
+ })();
20547
20572
  const request2 = await getAction(client, prepareTransactionRequest, "prepareTransactionRequest")({
20548
20573
  account,
20549
20574
  accessList,
@@ -20557,7 +20582,7 @@ async function sendTransactionSync(client, parameters) {
20557
20582
  maxFeePerGas,
20558
20583
  maxPriorityFeePerGas,
20559
20584
  nonce,
20560
- nonceManager: account.nonceManager,
20585
+ nonceManager,
20561
20586
  parameters: [...defaultParameters, "sidecars"],
20562
20587
  type,
20563
20588
  value,
@@ -21792,6 +21817,9 @@ function promptPassphrase(prompt = " Keystore passphrase: ") {
21792
21817
  });
21793
21818
  }
21794
21819
 
21820
+ // scripts/src/lib/api.mjs
21821
+ import { createRequire } from "node:module";
21822
+
21795
21823
  // scripts/src/lib/http.mjs
21796
21824
  var DEFAULT_TIMEOUT_MS = 2e4;
21797
21825
  var USER_AGENT = "rozo-checkout-skill/1.0";
@@ -21858,7 +21886,20 @@ function getJson(url, opts) {
21858
21886
  }
21859
21887
 
21860
21888
  // scripts/src/lib/api.mjs
21889
+ var PKG_VERSION = (() => {
21890
+ const requireFrom = createRequire(import.meta.url);
21891
+ for (const candidate of ["../../package.json", "../../../package.json"]) {
21892
+ try {
21893
+ const pkg = requireFrom(candidate);
21894
+ if (pkg?.name === "@rozoai/checkout" && pkg.version) return pkg.version;
21895
+ } catch {
21896
+ }
21897
+ }
21898
+ return "0.0.0";
21899
+ })();
21861
21900
  var MPP_BASE = process.env.ROZO_CHECKOUT_MPP_BASE || "https://apiserver.mpprouter.dev/v1/services/rozo-agent-api";
21901
+ var CLIENT_LABEL = `rozo-checkout-cli/${PKG_VERSION}`;
21902
+ var ATTRIBUTION_CLIENT = `rozo-checkout-skill/${PKG_VERSION}`;
21862
21903
  var INTENTS_BASE = process.env.ROZO_CHECKOUT_INTENTS_BASE || "https://intentapiv4.rozo.ai/functions/v1/payment-api";
21863
21904
  async function invoiceStatus({ linkId, rozoPaymentId }) {
21864
21905
  const qs = new URLSearchParams();