@agent-score/commerce 2.1.1 → 2.3.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/README.md +2 -2
- package/dist/challenge/index.d.mts +3 -3
- package/dist/challenge/index.d.ts +3 -3
- package/dist/challenge/index.js +7 -5
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +7 -5
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/{checkout-BRw_caGr.d.mts → checkout-Ceo1_rVJ.d.mts} +38 -2
- package/dist/{checkout-CuSNUJFX.d.ts → checkout-ChyOi7aU.d.ts} +38 -2
- package/dist/core.js +4 -3
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +4 -3
- package/dist/core.mjs.map +1 -1
- package/dist/{default_rails-C5gKZJMI.d.ts → default_rails-DtR_E9N9.d.ts} +1 -1
- package/dist/{default_rails-XFCuRddA.d.mts → default_rails-K25PtWrL.d.mts} +1 -1
- package/dist/discovery/index.d.mts +4 -4
- package/dist/discovery/index.d.ts +4 -4
- package/dist/identity/express.d.mts +4 -3
- package/dist/identity/express.d.ts +4 -3
- package/dist/identity/express.js +4 -3
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +4 -3
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +4 -3
- package/dist/identity/fastify.d.ts +4 -3
- package/dist/identity/fastify.js +4 -3
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +4 -3
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +4 -3
- package/dist/identity/hono.d.ts +4 -3
- package/dist/identity/hono.js +4 -3
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +4 -3
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.js +4 -3
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +4 -3
- package/dist/identity/nextjs.mjs.map +1 -1
- package/dist/identity/web.js +4 -3
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +4 -3
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +139 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +139 -13
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +3 -3
- package/dist/payment/index.d.ts +3 -3
- package/dist/payment/index.js +2 -0
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +2 -0
- package/dist/payment/index.mjs.map +1 -1
- package/dist/{pricing-DHfH3ogG.d.ts → pricing-B3-aKxSz.d.ts} +5 -3
- package/dist/{pricing-4n5Ota0D.d.mts → pricing-BReyZiqN.d.mts} +5 -3
- package/dist/{rail_spec-D6qzh3J0.d.mts → rail_spec-B1239jPp.d.mts} +25 -0
- package/dist/{rail_spec-D6qzh3J0.d.ts → rail_spec-B1239jPp.d.ts} +25 -0
- package/dist/stripe-multichain/index.d.mts +61 -11
- package/dist/stripe-multichain/index.d.ts +61 -11
- package/dist/stripe-multichain/index.js +84 -43
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs +83 -43
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/challenge/index.mjs
CHANGED
|
@@ -152,14 +152,16 @@ function buildHowToPay({
|
|
|
152
152
|
const d = decimals ?? 2;
|
|
153
153
|
const defaultMaxSpend = totalNum >= 1 ? (Math.ceil(totalNum) + 1).toFixed(d) : totalNum.toFixed(d);
|
|
154
154
|
const maxSpendStr = String(maxSpend ?? defaultMaxSpend);
|
|
155
|
+
const gateless = opTokenPlaceholder === null;
|
|
155
156
|
const opToken = opTokenPlaceholder ?? "<your_opc_token>";
|
|
157
|
+
const opTokenHeaderFlag = gateless ? "" : `-H 'X-Operator-Token: ${opToken}' `;
|
|
156
158
|
const block = {};
|
|
157
159
|
if (rails.tempo) {
|
|
158
160
|
const networkName = rails.tempo.testnet ? "tempo-testnet" : rails.tempo.network ?? RAIL_SPEC_DEFAULTS.tempo.network;
|
|
159
161
|
const chainId = rails.tempo.chainId ?? RAIL_SPEC_DEFAULTS.tempo.chainId;
|
|
160
162
|
const recommend = rails.tempo.recommend ?? RAIL_SPEC_DEFAULTS.tempo.recommend;
|
|
161
|
-
const tempoCommand = `tempo request -X POST
|
|
162
|
-
const payCommand = `agentscore-pay pay POST ${url} --chain tempo
|
|
163
|
+
const tempoCommand = `tempo request -X POST ${opTokenHeaderFlag}-H 'Content-Type: application/json' --json '${retryBodyJson}' --max-spend ${maxSpendStr} ${url}`;
|
|
164
|
+
const payCommand = `agentscore-pay pay POST ${url} --chain tempo ${opTokenHeaderFlag}-H 'Content-Type: application/json' -d '${retryBodyJson}' --max-spend ${maxSpendStr}`;
|
|
163
165
|
block.tempo = {
|
|
164
166
|
setup: TEMPO_SETUP,
|
|
165
167
|
prerequisite: `Run \`tempo wallet whoami\` and confirm USDC.e balance on ${networkName} (chain ${chainId}) is at least $${maxSpendStr}. If the tempo CLI is not installed, run the setup commands above first.`,
|
|
@@ -173,7 +175,7 @@ function buildHowToPay({
|
|
|
173
175
|
block.x402_base = {
|
|
174
176
|
setup: PAY_SETUP_BASE,
|
|
175
177
|
prerequisite: `Run \`agentscore-pay balance --chain base\` and confirm USDC balance on Base (${network}) is at least $${maxSpendStr}. If the CLI is not installed, run the setup commands above first.`,
|
|
176
|
-
command: `agentscore-pay pay POST ${url} --chain base
|
|
178
|
+
command: `agentscore-pay pay POST ${url} --chain base ${opTokenHeaderFlag}-H 'Content-Type: application/json' -d '${retryBodyJson}' --max-spend ${maxSpendStr}`,
|
|
177
179
|
what_it_does: "Pays via USDC on Base."
|
|
178
180
|
};
|
|
179
181
|
}
|
|
@@ -182,7 +184,7 @@ function buildHowToPay({
|
|
|
182
184
|
block.solana_mpp = {
|
|
183
185
|
setup: PAY_SETUP_SOLANA,
|
|
184
186
|
prerequisite: `Run \`agentscore-pay balance --chain solana\` and confirm USDC balance on Solana (${network}) is at least $${maxSpendStr}. If the CLI is not installed, run the setup commands above first.`,
|
|
185
|
-
command: `agentscore-pay pay POST ${url} --chain solana
|
|
187
|
+
command: `agentscore-pay pay POST ${url} --chain solana ${opTokenHeaderFlag}-H 'Content-Type: application/json' -d '${retryBodyJson}' --max-spend ${maxSpendStr}`,
|
|
186
188
|
what_it_does: "Pays via USDC on Solana."
|
|
187
189
|
};
|
|
188
190
|
}
|
|
@@ -204,7 +206,7 @@ function buildHowToPay({
|
|
|
204
206
|
];
|
|
205
207
|
stripe.command_link_cli = [
|
|
206
208
|
`SPEND_ID=$(link-cli spend-request create --payment-method-id <csmrpd_id_from_payment_methods_list> --credential-type shared_payment_token --network-id ${stripeCfg.profileId} --amount ${amountCents} --context "${sptContext}" --request-approval --output-json | jq -r .id)`,
|
|
207
|
-
`link-cli mpp pay ${url} --spend-request-id $SPEND_ID --method POST --data '${retryBodyJson}' --header 'X-Operator-Token: ${opToken}' --output-json`
|
|
209
|
+
gateless ? `link-cli mpp pay ${url} --spend-request-id $SPEND_ID --method POST --data '${retryBodyJson}' --output-json` : `link-cli mpp pay ${url} --spend-request-id $SPEND_ID --method POST --data '${retryBodyJson}' --header 'X-Operator-Token: ${opToken}' --output-json`
|
|
208
210
|
];
|
|
209
211
|
stripe.what_it_does_link_cli = "Mints a one-time-use SharedPaymentToken scoped to this purchase (user approves in Link wallet), then submits it as the payment credential.";
|
|
210
212
|
} else if (linkCliBlocked) {
|