agentcash 0.11.1 → 0.11.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.
- package/dist/cjs/run-server.cjs +13 -31
- package/dist/esm/{check-LS5UQJH6.js → check-BC2AYK2F.js} +4 -5
- package/dist/esm/{check-LS5UQJH6.js.map → check-BC2AYK2F.js.map} +1 -1
- package/dist/esm/{chunk-MXGLW24U.js → chunk-26HXYYNP.js} +3 -6
- package/dist/esm/chunk-26HXYYNP.js.map +1 -0
- package/dist/esm/{chunk-6I5A57FD.js → chunk-2HJ52VIH.js} +2 -2
- package/dist/esm/{chunk-UGWWFCWA.js → chunk-3NHHOAYY.js} +2 -2
- package/dist/esm/{chunk-TSQHYLV6.js → chunk-A6NJUOCG.js} +3 -4
- package/dist/esm/chunk-A6NJUOCG.js.map +1 -0
- package/dist/esm/{chunk-GKUPI6IF.js → chunk-C25DJ6BH.js} +2 -2
- package/dist/esm/{chunk-DPFLZADN.js → chunk-KEUYTMIM.js} +3 -3
- package/dist/esm/{chunk-BLFVFL5X.js → chunk-LI5257FZ.js} +2 -2
- package/dist/esm/{chunk-VUZE2OMD.js → chunk-PITBMGHN.js} +6 -17
- package/dist/esm/chunk-PITBMGHN.js.map +1 -0
- package/dist/esm/{chunk-C4RNRWW4.js → chunk-QPHNB77R.js} +14 -21
- package/dist/esm/chunk-QPHNB77R.js.map +1 -0
- package/dist/esm/{chunk-FH3V5PCK.js → chunk-RWYXPIDK.js} +2 -2
- package/dist/esm/{chunk-QS5OTX6N.js → chunk-ZRM5POEW.js} +2 -2
- package/dist/esm/{fetch-NO2HBPOF.js → fetch-DJKLEQQD.js} +6 -7
- package/dist/esm/{fetch-NO2HBPOF.js.map → fetch-DJKLEQQD.js.map} +1 -1
- package/dist/esm/{fund-IAFNIUCC.js → fund-QP4AOYIT.js} +4 -4
- package/dist/esm/index.js +19 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{install-C25BWZR4.js → install-WOSQ5SPS.js} +7 -7
- package/dist/esm/{onboard-BI6M5NPA.js → onboard-F2E5VASS.js} +7 -8
- package/dist/esm/{onboard-BI6M5NPA.js.map → onboard-F2E5VASS.js.map} +1 -1
- package/dist/esm/{report-error-IA2TOMW4.js → report-error-QUXZHGCB.js} +3 -3
- package/dist/esm/{server-IOUICKEH.js → server-GJZF7DXM.js} +2 -2
- package/dist/esm/{server-336VDLS4.js → server-MBCZGZKK.js} +10 -11
- package/dist/esm/{server-336VDLS4.js.map → server-MBCZGZKK.js.map} +1 -1
- package/dist/esm/{try-A2ETJ4XH.js → try-OOK7FEWW.js} +4 -5
- package/dist/esm/{try-A2ETJ4XH.js.map → try-OOK7FEWW.js.map} +1 -1
- package/dist/esm/{wallet-PKUXOJVF.js → wallet-5D2DDA5U.js} +5 -6
- package/dist/esm/{wallet-PKUXOJVF.js.map → wallet-5D2DDA5U.js.map} +1 -1
- package/package.json +3 -3
- package/dist/esm/chunk-C4RNRWW4.js.map +0 -1
- package/dist/esm/chunk-MXGLW24U.js.map +0 -1
- package/dist/esm/chunk-TNG3TLK6.js +0 -7
- package/dist/esm/chunk-TNG3TLK6.js.map +0 -1
- package/dist/esm/chunk-TSQHYLV6.js.map +0 -1
- package/dist/esm/chunk-VUZE2OMD.js.map +0 -1
- /package/dist/esm/{chunk-6I5A57FD.js.map → chunk-2HJ52VIH.js.map} +0 -0
- /package/dist/esm/{chunk-UGWWFCWA.js.map → chunk-3NHHOAYY.js.map} +0 -0
- /package/dist/esm/{chunk-GKUPI6IF.js.map → chunk-C25DJ6BH.js.map} +0 -0
- /package/dist/esm/{chunk-DPFLZADN.js.map → chunk-KEUYTMIM.js.map} +0 -0
- /package/dist/esm/{chunk-BLFVFL5X.js.map → chunk-LI5257FZ.js.map} +0 -0
- /package/dist/esm/{chunk-FH3V5PCK.js.map → chunk-RWYXPIDK.js.map} +0 -0
- /package/dist/esm/{chunk-QS5OTX6N.js.map → chunk-ZRM5POEW.js.map} +0 -0
- /package/dist/esm/{fund-IAFNIUCC.js.map → fund-QP4AOYIT.js.map} +0 -0
- /package/dist/esm/{install-C25BWZR4.js.map → install-WOSQ5SPS.js.map} +0 -0
- /package/dist/esm/{report-error-IA2TOMW4.js.map → report-error-QUXZHGCB.js.map} +0 -0
- /package/dist/esm/{server-IOUICKEH.js.map → server-GJZF7DXM.js.map} +0 -0
package/dist/cjs/run-server.cjs
CHANGED
|
@@ -112192,21 +112192,15 @@ init_cjs_shims();
|
|
|
112192
112192
|
// src/shared/protocols/detect.ts
|
|
112193
112193
|
init_cjs_shims();
|
|
112194
112194
|
|
|
112195
|
-
// src/shared/protocols/mpp/enabled.ts
|
|
112196
|
-
init_cjs_shims();
|
|
112197
|
-
var isMppEnabled = () => "0.11.1".includes("-mpp");
|
|
112198
|
-
|
|
112199
112195
|
// src/shared/protocols/types.ts
|
|
112200
112196
|
init_cjs_shims();
|
|
112201
112197
|
|
|
112202
112198
|
// src/shared/protocols/detect.ts
|
|
112203
112199
|
function detectPaymentProtocols(response) {
|
|
112204
112200
|
const protocols = [];
|
|
112205
|
-
|
|
112206
|
-
|
|
112207
|
-
|
|
112208
|
-
protocols.push("mpp" /* MPP */);
|
|
112209
|
-
}
|
|
112201
|
+
const wwwAuth = response.headers.get("WWW-Authenticate");
|
|
112202
|
+
if (wwwAuth?.startsWith("Payment")) {
|
|
112203
|
+
protocols.push("mpp" /* MPP */);
|
|
112210
112204
|
}
|
|
112211
112205
|
const paymentRequired = response.headers.get("payment-required");
|
|
112212
112206
|
if (paymentRequired) {
|
|
@@ -122537,12 +122531,6 @@ var safeGetMppChallenge = (surface, response) => {
|
|
|
122537
122531
|
);
|
|
122538
122532
|
};
|
|
122539
122533
|
var safeCreateMppCredential = (surface, wallets, response) => {
|
|
122540
|
-
if (!isMppEnabled()) {
|
|
122541
|
-
return mppErr(surface, {
|
|
122542
|
-
cause: "mpp_disabled",
|
|
122543
|
-
message: "MPP is not enabled"
|
|
122544
|
-
});
|
|
122545
|
-
}
|
|
122546
122534
|
const TEMPO_RPC_URL = "https://eng:acard-melody-fashion-finish@rpc.mainnet.tempo.xyz";
|
|
122547
122535
|
const client = Mppx_exports.create({
|
|
122548
122536
|
polyfill: false,
|
|
@@ -123500,11 +123488,11 @@ var coreRequestSchema = zod_default.object({
|
|
|
123500
123488
|
var paymentNetworks = [
|
|
123501
123489
|
"base" /* BASE */,
|
|
123502
123490
|
"solana" /* SOLANA */,
|
|
123503
|
-
|
|
123491
|
+
"tempo" /* TEMPO */
|
|
123504
123492
|
];
|
|
123505
123493
|
var paymentProtocols = [
|
|
123506
123494
|
"x402" /* X402 */,
|
|
123507
|
-
|
|
123495
|
+
"mpp" /* MPP */
|
|
123508
123496
|
];
|
|
123509
123497
|
var fetchShape = {
|
|
123510
123498
|
paymentNetwork: zod_default.enum(paymentNetworks).optional().describe(REQUEST_FETCH_PARAMS.paymentNetwork),
|
|
@@ -123638,21 +123626,15 @@ var getBalances = async (surface, wallets, flags) => {
|
|
|
123638
123626
|
evm: { address: evmAddress },
|
|
123639
123627
|
svm: { address: svmAddress }
|
|
123640
123628
|
} = wallets;
|
|
123641
|
-
const balanceResults = await Promise.all(
|
|
123642
|
-
|
|
123643
|
-
|
|
123644
|
-
surface,
|
|
123645
|
-
{ address: svmAddress, network: "solana" /* SOLANA */ },
|
|
123646
|
-
flags
|
|
123647
|
-
),
|
|
123648
|
-
...isMppEnabled() ? [
|
|
123649
|
-
getBalance4(
|
|
123629
|
+
const balanceResults = await Promise.all(
|
|
123630
|
+
Object.values(Network).map(
|
|
123631
|
+
(network) => getBalance4(
|
|
123650
123632
|
surface,
|
|
123651
|
-
{ address:
|
|
123633
|
+
network === "solana" /* SOLANA */ ? { address: svmAddress, network } : { address: evmAddress, network },
|
|
123652
123634
|
flags
|
|
123653
123635
|
)
|
|
123654
|
-
|
|
123655
|
-
|
|
123636
|
+
)
|
|
123637
|
+
);
|
|
123656
123638
|
const accounts = balanceResults.filter((balance) => balance.isOk()).map((balance) => {
|
|
123657
123639
|
const address2 = balance.value.paymentNetwork === "solana" /* SOLANA */ ? svmAddress : evmAddress;
|
|
123658
123640
|
const depositLink = getDepositLink(
|
|
@@ -138490,7 +138472,7 @@ var import_path2 = require("path");
|
|
|
138490
138472
|
var import_url2 = require("url");
|
|
138491
138473
|
function getVersion3() {
|
|
138492
138474
|
if (true) {
|
|
138493
|
-
return "0.11.
|
|
138475
|
+
return "0.11.2";
|
|
138494
138476
|
}
|
|
138495
138477
|
const __dirname2 = (0, import_path2.dirname)((0, import_url2.fileURLToPath)(importMetaUrl));
|
|
138496
138478
|
const pkg2 = JSON.parse(
|
|
@@ -138751,7 +138733,7 @@ var import_path3 = require("path");
|
|
|
138751
138733
|
var import_url4 = require("url");
|
|
138752
138734
|
function getVersion4() {
|
|
138753
138735
|
if (true) {
|
|
138754
|
-
return "0.11.
|
|
138736
|
+
return "0.11.2";
|
|
138755
138737
|
}
|
|
138756
138738
|
const __dirname2 = (0, import_path3.dirname)((0, import_url4.fileURLToPath)(importMetaUrl));
|
|
138757
138739
|
const pkg2 = JSON.parse(
|
|
@@ -3,17 +3,16 @@ import {
|
|
|
3
3
|
} from "./chunk-KGGPN7W5.js";
|
|
4
4
|
import {
|
|
5
5
|
cliRequestSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2HJ52VIH.js";
|
|
7
7
|
import "./chunk-S3Q7HU4U.js";
|
|
8
8
|
import {
|
|
9
9
|
RequestMethod
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-26HXYYNP.js";
|
|
11
11
|
import {
|
|
12
12
|
getWalletOrExit
|
|
13
13
|
} from "./chunk-OZD4QBHS.js";
|
|
14
14
|
import "./chunk-SIBQDIAW.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-TSQHYLV6.js";
|
|
15
|
+
import "./chunk-A6NJUOCG.js";
|
|
17
16
|
import "./chunk-NROPRHIC.js";
|
|
18
17
|
import "./chunk-LNQRIXFK.js";
|
|
19
18
|
import "./chunk-Y4VZACTC.js";
|
|
@@ -70,4 +69,4 @@ var checkCommand = async (args) => {
|
|
|
70
69
|
export {
|
|
71
70
|
checkCommand
|
|
72
71
|
};
|
|
73
|
-
//# sourceMappingURL=check-
|
|
72
|
+
//# sourceMappingURL=check-BC2AYK2F.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/commands/check.ts"],"sourcesContent":["import z from 'zod';\n\nimport { successResponse, outputAndExit, errorResponse } from '@/cli/output';\n\nimport { checkEndpoint } from '@/operations/check-endpoint';\n\nimport { getWalletOrExit } from '../lib/get-wallet-or-exit';\n\nimport type { Command } from '@/types';\nimport { cliRequestSchema } from '@/shared/request/schemas/cli';\nimport { RequestMethod } from '@/shared/request/types';\n\nconst SURFACE = 'cli:check';\n\nexport const checkCommand: Command<\n z.input<typeof cliRequestSchema>\n> = async args => {\n const requestInput = cliRequestSchema\n .extend({\n method: z.enum(RequestMethod).optional(),\n })\n .safeParse(args);\n if (!requestInput.success) {\n return outputAndExit(\n errorResponse({\n code: 'INVALID_INPUT',\n message: requestInput.error.message,\n surface: SURFACE,\n cause: 'validation',\n }),\n args\n );\n }\n const wallets = await getWalletOrExit(args);\n\n const result = await checkEndpoint(SURFACE, requestInput.data, {\n wallets,\n flags: args,\n });\n\n if (!result.found) {\n return outputAndExit(\n successResponse({\n url: args.url,\n results: [],\n error: result.cause,\n message: result.message,\n }),\n args\n );\n }\n\n return outputAndExit(\n successResponse({ url: args.url, results: result.advisories }),\n args\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/cli/commands/check.ts"],"sourcesContent":["import z from 'zod';\n\nimport { successResponse, outputAndExit, errorResponse } from '@/cli/output';\n\nimport { checkEndpoint } from '@/operations/check-endpoint';\n\nimport { getWalletOrExit } from '../lib/get-wallet-or-exit';\n\nimport type { Command } from '@/types';\nimport { cliRequestSchema } from '@/shared/request/schemas/cli';\nimport { RequestMethod } from '@/shared/request/types';\n\nconst SURFACE = 'cli:check';\n\nexport const checkCommand: Command<\n z.input<typeof cliRequestSchema>\n> = async args => {\n const requestInput = cliRequestSchema\n .extend({\n method: z.enum(RequestMethod).optional(),\n })\n .safeParse(args);\n if (!requestInput.success) {\n return outputAndExit(\n errorResponse({\n code: 'INVALID_INPUT',\n message: requestInput.error.message,\n surface: SURFACE,\n cause: 'validation',\n }),\n args\n );\n }\n const wallets = await getWalletOrExit(args);\n\n const result = await checkEndpoint(SURFACE, requestInput.data, {\n wallets,\n flags: args,\n });\n\n if (!result.found) {\n return outputAndExit(\n successResponse({\n url: args.url,\n results: [],\n error: result.cause,\n message: result.message,\n }),\n args\n );\n }\n\n return outputAndExit(\n successResponse({ url: args.url, results: result.advisories }),\n args\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,OAAO;AAYd,IAAM,UAAU;AAET,IAAM,eAET,OAAM,SAAQ;AAChB,QAAM,eAAe,iBAClB,OAAO;AAAA,IACN,QAAQ,EAAE,KAAK,aAAa,EAAE,SAAS;AAAA,EACzC,CAAC,EACA,UAAU,IAAI;AACjB,MAAI,CAAC,aAAa,SAAS;AACzB,WAAO;AAAA,MACL,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,SAAS,aAAa,MAAM;AAAA,QAC5B,SAAS;AAAA,QACT,OAAO;AAAA,MACT,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AACA,QAAM,UAAU,MAAM,gBAAgB,IAAI;AAE1C,QAAM,SAAS,MAAM,cAAc,SAAS,aAAa,MAAM;AAAA,IAC7D;AAAA,IACA,OAAO;AAAA,EACT,CAAC;AAED,MAAI,CAAC,OAAO,OAAO;AACjB,WAAO;AAAA,MACL,gBAAgB;AAAA,QACd,KAAK,KAAK;AAAA,QACV,SAAS,CAAC;AAAA,QACV,OAAO,OAAO;AAAA,QACd,SAAS,OAAO;AAAA,MAClB,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,gBAAgB,EAAE,KAAK,KAAK,KAAK,SAAS,OAAO,WAAW,CAAC;AAAA,IAC7D;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isMppEnabled
|
|
3
|
-
} from "./chunk-TNG3TLK6.js";
|
|
4
1
|
import {
|
|
5
2
|
REQUEST_FETCH_PARAMS,
|
|
6
3
|
REQUEST_PARAMS
|
|
@@ -30,11 +27,11 @@ var coreRequestSchema = z.object({
|
|
|
30
27
|
var paymentNetworks = [
|
|
31
28
|
"base" /* BASE */,
|
|
32
29
|
"solana" /* SOLANA */,
|
|
33
|
-
|
|
30
|
+
"tempo" /* TEMPO */
|
|
34
31
|
];
|
|
35
32
|
var paymentProtocols = [
|
|
36
33
|
"x402" /* X402 */,
|
|
37
|
-
|
|
34
|
+
"mpp" /* MPP */
|
|
38
35
|
];
|
|
39
36
|
var fetchShape = {
|
|
40
37
|
paymentNetwork: z.enum(paymentNetworks).optional().describe(REQUEST_FETCH_PARAMS.paymentNetwork),
|
|
@@ -51,4 +48,4 @@ export {
|
|
|
51
48
|
paymentProtocols,
|
|
52
49
|
fetchShape
|
|
53
50
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
51
|
+
//# sourceMappingURL=chunk-26HXYYNP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shared/request/types.ts","../../src/shared/request/schemas/core.ts"],"sourcesContent":["import type { GlobalFlags } from '@/types';\nimport type { Wallets } from '@/wallet';\nimport type { coreRequestSchema } from './schemas/core';\nimport type z from 'zod';\n\nexport interface RequestContext {\n wallets: Wallets;\n flags: GlobalFlags;\n}\n\nexport enum RequestMethod {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n\nexport type RequestInput = z.infer<typeof coreRequestSchema> & {\n headers: Record<string, string>;\n body?: string | undefined;\n};\n","import z from 'zod';\n\nimport { REQUEST_PARAMS, REQUEST_FETCH_PARAMS } from '@/shared/descriptions';\nimport { PaymentProtocol } from '@/shared/protocols/types';\nimport { Network } from '@agentcash/networks';\nimport { zodUrl } from '@/shared/url';\n\nimport { RequestMethod } from '../types';\n\nexport const requestMethodValues: readonly RequestMethod[] =\n Object.values(RequestMethod);\n\nconst methodSchema = z\n .enum(RequestMethod)\n .optional()\n .default(RequestMethod.GET)\n .describe(REQUEST_PARAMS.method);\n\nexport const coreRequestSchema = z.object({\n url: zodUrl.describe(REQUEST_PARAMS.url),\n method: methodSchema,\n});\n\nexport const paymentNetworks: Network[] = [\n Network.BASE,\n Network.SOLANA,\n Network.TEMPO,\n];\n\nexport const paymentProtocols: PaymentProtocol[] = [\n PaymentProtocol.X402,\n PaymentProtocol.MPP,\n];\n\nexport const fetchShape = {\n paymentNetwork: z\n .enum(paymentNetworks)\n .optional()\n .describe(REQUEST_FETCH_PARAMS.paymentNetwork),\n paymentProtocol: z\n .enum(paymentProtocols)\n .optional()\n .describe(REQUEST_FETCH_PARAMS.paymentProtocol),\n maxAmount: z\n .number()\n .positive()\n .optional()\n .describe(REQUEST_FETCH_PARAMS.maxAmount),\n timeout: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(REQUEST_PARAMS.timeout),\n};\n"],"mappings":";;;;;;;;;AAUO,IAAK,gBAAL,kBAAKA,mBAAL;AACL,EAAAA,eAAA,SAAM;AACN,EAAAA,eAAA,UAAO;AACP,EAAAA,eAAA,SAAM;AACN,EAAAA,eAAA,YAAS;AACT,EAAAA,eAAA,WAAQ;AALE,SAAAA;AAAA,GAAA;;;ACVZ,OAAO,OAAO;AASP,IAAM,sBACX,OAAO,OAAO,aAAa;AAE7B,IAAM,eAAe,EAClB,KAAK,aAAa,EAClB,SAAS,EACT,uBAAyB,EACzB,SAAS,eAAe,MAAM;AAE1B,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,KAAK,OAAO,SAAS,eAAe,GAAG;AAAA,EACvC,QAAQ;AACV,CAAC;AAEM,IAAM,kBAA6B;AAAA;AAAA;AAAA;AAI1C;AAEO,IAAM,mBAAsC;AAAA;AAAA;AAGnD;AAEO,IAAM,aAAa;AAAA,EACxB,gBAAgB,EACb,KAAK,eAAe,EACpB,SAAS,EACT,SAAS,qBAAqB,cAAc;AAAA,EAC/C,iBAAiB,EACd,KAAK,gBAAgB,EACrB,SAAS,EACT,SAAS,qBAAqB,eAAe;AAAA,EAChD,WAAW,EACR,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAS,qBAAqB,SAAS;AAAA,EAC1C,SAAS,EACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,EACT,SAAS,eAAe,OAAO;AACpC;","names":["RequestMethod"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
coreRequestSchema,
|
|
3
3
|
fetchShape
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-26HXYYNP.js";
|
|
5
5
|
import {
|
|
6
6
|
REQUEST_PARAMS
|
|
7
7
|
} from "./chunk-FNE2SKE7.js";
|
|
@@ -46,4 +46,4 @@ export {
|
|
|
46
46
|
cliRequestSchema,
|
|
47
47
|
cliFetchRequestSchema
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-2HJ52VIH.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MCP_VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZRM5POEW.js";
|
|
4
4
|
import {
|
|
5
5
|
getBaseUrl,
|
|
6
6
|
safeFetchJson
|
|
@@ -49,4 +49,4 @@ async function submitErrorReport(surface, input, address, dev) {
|
|
|
49
49
|
export {
|
|
50
50
|
submitErrorReport
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=chunk-
|
|
52
|
+
//# sourceMappingURL=chunk-3NHHOAYY.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// ../../internal/networks/src/schemas.ts
|
|
2
|
-
import z from "zod";
|
|
3
|
-
|
|
4
1
|
// ../../internal/networks/src/types.ts
|
|
5
2
|
var Network = /* @__PURE__ */ ((Network2) => {
|
|
6
3
|
Network2["BASE"] = "base";
|
|
@@ -10,6 +7,7 @@ var Network = /* @__PURE__ */ ((Network2) => {
|
|
|
10
7
|
})(Network || {});
|
|
11
8
|
|
|
12
9
|
// ../../internal/networks/src/schemas.ts
|
|
10
|
+
import z from "zod";
|
|
13
11
|
import { isAddress } from "viem";
|
|
14
12
|
import { isAddress as isSolanaAddress } from "@solana/kit";
|
|
15
13
|
var networkSchema = z.enum(Network);
|
|
@@ -72,6 +70,7 @@ var caip2ToNetwork = (caip2) => {
|
|
|
72
70
|
};
|
|
73
71
|
|
|
74
72
|
export {
|
|
73
|
+
Network,
|
|
75
74
|
networkSchema,
|
|
76
75
|
optionalNetworkSchema,
|
|
77
76
|
ethereumAddressSchema,
|
|
@@ -83,4 +82,4 @@ export {
|
|
|
83
82
|
getTxExplorerUrl,
|
|
84
83
|
caip2ToNetwork
|
|
85
84
|
};
|
|
86
|
-
//# sourceMappingURL=chunk-
|
|
85
|
+
//# sourceMappingURL=chunk-A6NJUOCG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../internal/networks/src/types.ts","../../../../internal/networks/src/schemas.ts","../../../../internal/networks/src/configs.ts"],"sourcesContent":["import type { Chain, Address as EvmAddress } from 'viem';\nimport type { Address as SolanaAddress } from '@solana/kit';\n\nexport type EthereumAddress = EvmAddress;\nexport { SolanaAddress };\nexport type MixedAddress = EthereumAddress | SolanaAddress;\n\nexport enum Network {\n BASE = 'base',\n TEMPO = 'tempo',\n SOLANA = 'solana',\n}\n\nexport type EvmNetwork = Exclude<Network, Network.SOLANA>;\n\nexport interface BaseNetworkConfig {\n caip2: `${string}:${string}`;\n name: string;\n}\n\nexport interface EvmNetworkConfig extends BaseNetworkConfig {\n chain: Chain;\n usdcAddress: EthereumAddress;\n}\n\nexport interface SolanaNetworkConfig extends BaseNetworkConfig {\n usdcAddress: SolanaAddress;\n}\n","import z from 'zod';\n\nimport { Network } from './types';\n\nimport { isAddress } from 'viem';\nimport { isAddress as isSolanaAddress } from '@solana/kit';\n\nimport type { MixedAddress, SolanaAddress, EvmNetwork } from './types';\n\nexport const networkSchema = z.enum(Network);\nexport const optionalNetworkSchema = networkSchema.optional();\n\nexport const evmNetworkSchema = networkSchema\n .refine(network => network !== Network.SOLANA, {\n message: 'Invalid EVM chain',\n })\n .transform(network => network as EvmNetwork);\n\nexport const ethereumAddressSchema = z\n .string()\n .refine(isAddress, 'Invalid EVM address');\n\nexport const solanaAddressSchema: z.ZodType<SolanaAddress, string> = z\n .string()\n .refine(isSolanaAddress, 'Invalid Solana address');\n\nexport const mixedAddressSchema: z.ZodType<MixedAddress, string> = z\n .union([ethereumAddressSchema, solanaAddressSchema])\n .transform(address => address as MixedAddress);\n","import { base, tempo } from 'viem/chains';\n\nimport { Network } from './types';\n\nimport type {\n EvmNetworkConfig,\n EvmNetwork,\n SolanaAddress,\n SolanaNetworkConfig,\n BaseNetworkConfig,\n} from './types';\n\nexport const EVM_CONFIGS: Record<EvmNetwork, EvmNetworkConfig> = {\n [Network.BASE]: {\n chain: base,\n name: 'Base',\n caip2: 'eip155:8453',\n usdcAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',\n },\n [Network.TEMPO]: {\n chain: tempo,\n name: 'Tempo',\n caip2: 'eip155:4217',\n usdcAddress: '0x20c000000000000000000000b9537d11c60e8b50',\n },\n};\n\nexport const chainId = (network: EvmNetwork) => EVM_CONFIGS[network].chain.id;\n\nexport const SOLANA_CONFIG: SolanaNetworkConfig = {\n name: 'Solana',\n caip2: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n usdcAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' as SolanaAddress,\n};\n\nexport const ALL_NETWORK_CONFIGS: Record<Network, BaseNetworkConfig> = {\n ...EVM_CONFIGS,\n [Network.SOLANA]: SOLANA_CONFIG,\n};\n\nexport const networkToCaip2 = (network: Network) => {\n if (network === Network.SOLANA) {\n return SOLANA_CONFIG.caip2;\n }\n return EVM_CONFIGS[network].caip2;\n};\n\nexport const TX_EXPLORER_URLS: Record<Network, string> = {\n [Network.BASE]: 'https://basescan.org/tx/',\n [Network.TEMPO]: 'https://testnet.tempo.xyz/tx/',\n [Network.SOLANA]: 'https://solscan.io/tx/',\n};\n\nexport const getTxExplorerUrl = (\n txHash: string,\n network: Network = Network.BASE\n) => `${TX_EXPLORER_URLS[network]}${txHash}`;\n\nexport const caip2ToNetwork = (caip2: `${string}:${string}`) => {\n if (caip2 === SOLANA_CONFIG.caip2) {\n return Network.SOLANA;\n }\n const evmNetwork = Object.entries(EVM_CONFIGS).find(\n ([, config]) => config.caip2 === caip2\n )?.[0];\n if (evmNetwork) {\n return evmNetwork as EvmNetwork;\n }\n return null;\n};\n"],"mappings":";AAOO,IAAK,UAAL,kBAAKA,aAAL;AACL,EAAAA,SAAA,UAAO;AACP,EAAAA,SAAA,WAAQ;AACR,EAAAA,SAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;;;ACPZ,OAAO,OAAO;AAId,SAAS,iBAAiB;AAC1B,SAAS,aAAa,uBAAuB;AAItC,IAAM,gBAAgB,EAAE,KAAK,OAAO;AACpC,IAAM,wBAAwB,cAAc,SAAS;AAErD,IAAM,mBAAmB,cAC7B,OAAO,aAAW,mCAA4B;AAAA,EAC7C,SAAS;AACX,CAAC,EACA,UAAU,aAAW,OAAqB;AAEtC,IAAM,wBAAwB,EAClC,OAAO,EACP,OAAO,WAAW,qBAAqB;AAEnC,IAAM,sBAAwD,EAClE,OAAO,EACP,OAAO,iBAAiB,wBAAwB;AAE5C,IAAM,qBAAsD,EAChE,MAAM,CAAC,uBAAuB,mBAAmB,CAAC,EAClD,UAAU,aAAW,OAAuB;;;AC5B/C,SAAS,MAAM,aAAa;AAYrB,IAAM,cAAoD;AAAA,EAC/D,kBAAa,GAAG;AAAA,IACd,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,oBAAc,GAAG;AAAA,IACf,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;AAIO,IAAM,gBAAqC;AAAA,EAChD,MAAM;AAAA,EACN,OAAO;AAAA,EACP,aAAa;AACf;AAEO,IAAM,sBAA0D;AAAA,EACrE,GAAG;AAAA,EACH,sBAAe,GAAG;AACpB;AAEO,IAAM,iBAAiB,CAAC,YAAqB;AAClD,MAAI,mCAA4B;AAC9B,WAAO,cAAc;AAAA,EACvB;AACA,SAAO,YAAY,OAAO,EAAE;AAC9B;AAEO,IAAM,mBAA4C;AAAA,EACvD,kBAAa,GAAG;AAAA,EAChB,oBAAc,GAAG;AAAA,EACjB,sBAAe,GAAG;AACpB;AAEO,IAAM,mBAAmB,CAC9B,QACA,gCACG,GAAG,iBAAiB,OAAO,CAAC,GAAG,MAAM;AAEnC,IAAM,iBAAiB,CAAC,UAAiC;AAC9D,MAAI,UAAU,cAAc,OAAO;AACjC;AAAA,EACF;AACA,QAAM,aAAa,OAAO,QAAQ,WAAW,EAAE;AAAA,IAC7C,CAAC,CAAC,EAAE,MAAM,MAAM,OAAO,UAAU;AAAA,EACnC,IAAI,CAAC;AACL,MAAI,YAAY;AACd,WAAO;AAAA,EACT;AACA,SAAO;AACT;","names":["Network"]}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
ethereumAddressSchema,
|
|
7
7
|
networkSchema,
|
|
8
8
|
solanaAddressSchema
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-A6NJUOCG.js";
|
|
10
10
|
import {
|
|
11
11
|
getBaseUrl,
|
|
12
12
|
safeFetchJson
|
|
@@ -65,4 +65,4 @@ var getBalance = async (surface, input, flags) => {
|
|
|
65
65
|
export {
|
|
66
66
|
getBalance
|
|
67
67
|
};
|
|
68
|
-
//# sourceMappingURL=chunk-
|
|
68
|
+
//# sourceMappingURL=chunk-C25DJ6BH.js.map
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
} from "./chunk-DZNSJ2BA.js";
|
|
4
4
|
import {
|
|
5
5
|
redeemInviteCode
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LI5257FZ.js";
|
|
7
7
|
import {
|
|
8
8
|
EVM_CONFIGS,
|
|
9
9
|
getTxExplorerUrl
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-A6NJUOCG.js";
|
|
11
11
|
import {
|
|
12
12
|
getDepositLink
|
|
13
13
|
} from "./chunk-QZBSRYSW.js";
|
|
@@ -106,4 +106,4 @@ var promptDeposit = async (surface, args, wallets) => {
|
|
|
106
106
|
export {
|
|
107
107
|
promptDeposit
|
|
108
108
|
};
|
|
109
|
-
//# sourceMappingURL=chunk-
|
|
109
|
+
//# sourceMappingURL=chunk-KEUYTMIM.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-6XGAIMNK.js";
|
|
5
5
|
import {
|
|
6
6
|
optionalNetworkSchema
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-A6NJUOCG.js";
|
|
8
8
|
import {
|
|
9
9
|
getBaseUrl,
|
|
10
10
|
safeFetchJson
|
|
@@ -85,4 +85,4 @@ var redeemInviteCode = async (surface, args, globalArgs, wallets) => {
|
|
|
85
85
|
export {
|
|
86
86
|
redeemInviteCode
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
88
|
+
//# sourceMappingURL=chunk-LI5257FZ.js.map
|
|
@@ -7,14 +7,11 @@ import {
|
|
|
7
7
|
} from "./chunk-S3Q7HU4U.js";
|
|
8
8
|
import {
|
|
9
9
|
getBalance
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
isMppEnabled
|
|
13
|
-
} from "./chunk-TNG3TLK6.js";
|
|
10
|
+
} from "./chunk-C25DJ6BH.js";
|
|
14
11
|
import {
|
|
15
12
|
caip2ToNetwork,
|
|
16
13
|
networkToCaip2
|
|
17
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-A6NJUOCG.js";
|
|
18
15
|
import {
|
|
19
16
|
fetchErr,
|
|
20
17
|
fetchOk,
|
|
@@ -343,11 +340,9 @@ async function attemptSiwxAuth(response, authRetryRequest, paymentRetryRequest,
|
|
|
343
340
|
// src/shared/protocols/detect.ts
|
|
344
341
|
function detectPaymentProtocols(response) {
|
|
345
342
|
const protocols = [];
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
protocols.push("mpp" /* MPP */);
|
|
350
|
-
}
|
|
343
|
+
const wwwAuth = response.headers.get("WWW-Authenticate");
|
|
344
|
+
if (wwwAuth?.startsWith("Payment")) {
|
|
345
|
+
protocols.push("mpp" /* MPP */);
|
|
351
346
|
}
|
|
352
347
|
const paymentRequired = response.headers.get("payment-required");
|
|
353
348
|
if (paymentRequired) {
|
|
@@ -384,12 +379,6 @@ var safeGetMppChallenge = (surface, response) => {
|
|
|
384
379
|
);
|
|
385
380
|
};
|
|
386
381
|
var safeCreateMppCredential = (surface, wallets, response) => {
|
|
387
|
-
if (!isMppEnabled()) {
|
|
388
|
-
return mppErr(surface, {
|
|
389
|
-
cause: "mpp_disabled",
|
|
390
|
-
message: "MPP is not enabled"
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
382
|
const TEMPO_RPC_URL = "https://eng:acard-melody-fashion-finish@rpc.mainnet.tempo.xyz";
|
|
394
383
|
const client = Mppx.create({
|
|
395
384
|
polyfill: false,
|
|
@@ -804,4 +793,4 @@ async function executeFetch(input, options) {
|
|
|
804
793
|
export {
|
|
805
794
|
executeFetch
|
|
806
795
|
};
|
|
807
|
-
//# sourceMappingURL=chunk-
|
|
796
|
+
//# sourceMappingURL=chunk-PITBMGHN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/operations/fetch/auth.ts","../../src/shared/protocols/x402/index.ts","../../src/shared/protocols/x402/patched-exact-svm-scheme.ts","../../src/shared/protocols/detect.ts","../../src/shared/protocols/mpp/handle-payment.ts","../../src/shared/protocols/mpp/index.ts","../../src/shared/protocols/before-payment.ts","../../src/shared/protocols/pick.ts","../../src/shared/protocols/x402/choose-payment-requirement.ts","../../src/shared/protocols/x402/handle-payment.ts","../../src/operations/fetch/payment.ts","../../src/operations/fetch/index.ts"],"sourcesContent":["import { encodeSIWxHeader } from '@x402/extensions/sign-in-with-x';\n\nimport { fetchOk, safeFetch } from '@/shared/neverthrow/fetch';\nimport {\n getSiwxExtension,\n safeCreateSIWxPayload,\n safeGetPaymentRequired,\n} from '@/shared/protocols/x402';\n\nimport type { ExecuteFetchOptions } from './types';\n\nexport async function attemptSiwxAuth(\n response: Response,\n authRetryRequest: Request,\n paymentRetryRequest: Request,\n options: ExecuteFetchOptions\n) {\n const { surface, wallets } = options;\n const { timeout, paymentNetwork } = options.params;\n\n if (!response.headers.has('payment-required')) {\n return fetchOk({\n response,\n paymentRetryRequest,\n });\n }\n\n const paymentRequiredResult = await safeGetPaymentRequired(surface, response);\n\n if (paymentRequiredResult.isErr()) {\n return paymentRequiredResult;\n }\n\n const siwxExtension = getSiwxExtension(\n paymentRequiredResult.value.extensions,\n paymentNetwork\n );\n\n if (!siwxExtension) {\n return fetchOk({\n response,\n paymentRetryRequest,\n });\n }\n\n const payloadResult = await safeCreateSIWxPayload(\n surface,\n siwxExtension,\n wallets\n );\n\n if (payloadResult.isErr()) {\n return payloadResult;\n }\n\n const siwxHeader = encodeSIWxHeader(payloadResult.value);\n authRetryRequest.headers.set('SIGN-IN-WITH-X', siwxHeader);\n paymentRetryRequest.headers.set('SIGN-IN-WITH-X', siwxHeader);\n\n return (await safeFetch(surface, authRetryRequest, timeout)).andThen(\n authResponse =>\n fetchOk({\n response: authResponse,\n paymentRetryRequest,\n })\n );\n}\n","import {\n err,\n ok,\n resultFromPromise,\n resultFromThrowable,\n} from '@agentcash/neverthrow';\n\nimport type { SelectPaymentRequirements } from '@x402/core/client';\nimport { x402Client, x402HTTPClient } from '@x402/core/client';\n\nimport { toClientEvmSigner } from '@x402/evm';\nimport { toClientSvmSigner } from '@x402/svm';\n\nimport { ExactEvmScheme } from '@x402/evm/exact/client';\nimport { PatchedExactSvmScheme } from './patched-exact-svm-scheme';\n\nimport { createSIWxPayload } from '@x402/extensions/sign-in-with-x';\n\nimport type { BaseX402Error } from './types';\nimport type { PaymentRequired } from '@x402/core/types';\nimport type {\n CompleteSIWxInfo,\n SIWxExtensionInfo,\n SolanaSigner,\n SupportedChain,\n} from '@x402/extensions/sign-in-with-x';\nimport type { Wallets } from '@/wallet';\nimport { Network, networkToCaip2 } from '@agentcash/networks';\nimport type { Network as PaymentNetwork } from '@agentcash/networks';\nimport { createPublicClient, http } from 'viem';\nimport { base } from 'viem/chains';\n\nconst errorType = 'x402';\n\nexport const x402Ok = <T>(value: T) => ok(value);\nexport const x402Err = (cause: string, error: BaseX402Error) =>\n err(errorType, cause, error);\n\nconst x402ResultFromPromise = <T>(\n surface: string,\n promise: Promise<T>,\n error: (e: unknown) => BaseX402Error\n) => resultFromPromise(errorType, surface, promise, error);\n\nconst x402ResultFromThrowable = <T>(\n surface: string,\n fn: () => T,\n error: (e: unknown) => BaseX402Error\n) => resultFromThrowable(errorType, surface, fn, error);\n\nexport const x402ProbeClient = new x402HTTPClient(new x402Client());\n\nexport const safeGetPaymentRequired = (surface: string, response: Response) => {\n return x402ResultFromPromise(\n surface,\n response.json().then(\n json =>\n x402ProbeClient.getPaymentRequiredResponse(\n name => response.headers.get(name),\n json\n ),\n () =>\n x402ProbeClient.getPaymentRequiredResponse(name =>\n response.headers.get(name)\n )\n ),\n error => ({\n cause: 'parse_payment_required',\n message:\n error instanceof Error\n ? error.message\n : 'Failed to parse payment required',\n })\n );\n};\n\nexport const getSiwxExtension = (\n extensions: PaymentRequired['extensions'],\n paymentNetwork?: PaymentNetwork\n): CompleteSIWxInfo | undefined => {\n const siwx = extensions?.['sign-in-with-x'] as\n | { info?: SIWxExtensionInfo; supportedChains?: SupportedChain[] }\n | undefined;\n\n if (!siwx?.info) {\n return undefined;\n }\n\n const chain = siwx.supportedChains?.find(c =>\n paymentNetwork\n ? c.chainId === networkToCaip2(paymentNetwork)\n : c.chainId.startsWith('eip155:')\n );\n\n return {\n ...siwx.info,\n chainId: chain?.chainId ?? 'eip155:8453',\n type: chain?.type ?? 'eip191',\n signatureScheme: chain?.signatureScheme,\n };\n};\n\nexport const safeCreatePaymentPayload = (\n surface: string,\n wallets: Wallets,\n paymentRequired: PaymentRequired,\n paymentRequirementsSelector?: SelectPaymentRequirements\n) => {\n const client = new x402HTTPClient(\n x402Client.fromConfig({\n schemes: [\n {\n network: networkToCaip2(Network.BASE),\n client: new ExactEvmScheme(\n toClientEvmSigner(\n wallets.evm,\n createPublicClient({\n chain: base,\n transport: http(),\n })\n )\n ),\n },\n {\n network: networkToCaip2(Network.SOLANA),\n client: new PatchedExactSvmScheme(toClientSvmSigner(wallets.svm)),\n },\n ],\n paymentRequirementsSelector,\n })\n );\n return x402ResultFromPromise(\n surface,\n client.createPaymentPayload(paymentRequired),\n error => ({\n cause: 'create_payment_payload',\n message:\n error instanceof Error\n ? error.message\n : 'Failed to create payment payload',\n })\n );\n};\n\nexport const safeGetPaymentSettlement = (\n surface: string,\n response: Response\n) => {\n return x402ResultFromThrowable(\n surface,\n () =>\n x402ProbeClient.getPaymentSettleResponse(name =>\n response.headers.get(name)\n ),\n error => ({\n cause: 'get_payment_settlement',\n message:\n error instanceof Error\n ? error.message\n : 'Failed to get payment settlement',\n })\n );\n};\n\nexport const safeCreateSIWxPayload = (\n surface: string,\n serverInfo: CompleteSIWxInfo,\n wallets: Wallets\n) => {\n return x402ResultFromPromise(\n surface,\n createSIWxPayload(\n serverInfo,\n serverInfo.chainId.startsWith('eip155:')\n ? wallets.evm\n : (wallets.svm as unknown as SolanaSigner)\n ),\n error => ({\n cause: 'create_siwx_payload',\n message:\n error instanceof Error\n ? error.message\n : 'Failed to create SIWX payload',\n })\n );\n};\n","import {\n getSetComputeUnitLimitInstruction,\n setTransactionMessageComputeUnitPrice,\n} from '@solana-program/compute-budget';\nimport { TOKEN_PROGRAM_ADDRESS } from '@solana-program/token';\nimport {\n fetchMint,\n findAssociatedTokenPda,\n getTransferCheckedInstruction,\n TOKEN_2022_PROGRAM_ADDRESS,\n} from '@solana-program/token-2022';\nimport {\n appendTransactionMessageInstructions,\n createTransactionMessage,\n getBase64EncodedWireTransaction,\n partiallySignTransactionMessageWithSigners,\n pipe,\n prependTransactionMessageInstruction,\n setTransactionMessageFeePayer,\n setTransactionMessageLifetimeUsingBlockhash,\n type Address,\n} from '@solana/kit';\n\nimport type {\n PaymentPayload,\n PaymentRequirements,\n SchemeNetworkClient,\n} from '@x402/core/types';\nimport {\n DEFAULT_COMPUTE_UNIT_LIMIT,\n DEFAULT_COMPUTE_UNIT_PRICE_MICROLAMPORTS,\n createRpcClient,\n type ClientSvmConfig,\n type ClientSvmSigner,\n type ExactSvmPayloadV2,\n} from '@x402/svm';\n\ntype BlockhashLifetime = Parameters<\n typeof setTransactionMessageLifetimeUsingBlockhash\n>[0];\n\ninterface PatchedPaymentExtra {\n feePayer?: Address;\n recentBlockhash?:\n | string\n | Partial<{\n blockhash: string;\n lastValidBlockHeight: bigint | number | string;\n }>;\n lastValidBlockHeight?: bigint | number | string;\n}\n\nfunction parseLastValidBlockHeight(\n value: bigint | number | string | undefined\n): bigint | undefined {\n if (typeof value === 'bigint') {\n return value;\n }\n\n if (typeof value === 'number' && Number.isFinite(value)) {\n return BigInt(value);\n }\n\n if (typeof value === 'string' && value.length > 0) {\n return BigInt(value);\n }\n\n return undefined;\n}\n\nfunction asBlockhash(blockhash: string): BlockhashLifetime['blockhash'] {\n return blockhash as BlockhashLifetime['blockhash'];\n}\n\n/**\n * Local compatibility patch for Coinbase ExactSvmScheme.\n *\n * Changes from upstream:\n * - omits the trailing memo instruction\n * - prefers paymentRequirements.extra.recentBlockhash when provided\n */\nexport class PatchedExactSvmScheme implements SchemeNetworkClient {\n readonly scheme = 'exact';\n\n constructor(\n private readonly signer: ClientSvmSigner,\n private readonly config?: ClientSvmConfig\n ) {}\n\n async createPaymentPayload(\n x402Version: number,\n paymentRequirements: PaymentRequirements\n ): Promise<Pick<PaymentPayload, 'x402Version' | 'payload'>> {\n const rpc = createRpcClient(\n paymentRequirements.network,\n this.config?.rpcUrl\n );\n\n const tokenMint = await fetchMint(\n rpc,\n paymentRequirements.asset as Address\n );\n const tokenProgramAddress = tokenMint.programAddress;\n\n if (\n tokenProgramAddress.toString() !== TOKEN_PROGRAM_ADDRESS.toString() &&\n tokenProgramAddress.toString() !== TOKEN_2022_PROGRAM_ADDRESS.toString()\n ) {\n throw new Error('Asset was not created by a known token program');\n }\n\n const [sourceATA] = await findAssociatedTokenPda({\n mint: paymentRequirements.asset as Address,\n owner: this.signer.address,\n tokenProgram: tokenProgramAddress,\n });\n\n const [destinationATA] = await findAssociatedTokenPda({\n mint: paymentRequirements.asset as Address,\n owner: paymentRequirements.payTo as Address,\n tokenProgram: tokenProgramAddress,\n });\n\n const transferIx = getTransferCheckedInstruction(\n {\n source: sourceATA,\n mint: paymentRequirements.asset as Address,\n destination: destinationATA,\n authority: this.signer,\n amount: BigInt(paymentRequirements.amount),\n decimals: tokenMint.data.decimals,\n },\n { programAddress: tokenProgramAddress }\n );\n\n const extra = paymentRequirements.extra as PatchedPaymentExtra;\n const feePayer = extra.feePayer;\n\n if (!feePayer) {\n throw new Error(\n 'feePayer is required in paymentRequirements.extra for SVM transactions'\n );\n }\n\n const latestBlockhash = await this.resolveBlockhashLifetime(rpc, extra);\n\n const tx = pipe(\n createTransactionMessage({ version: 0 }),\n tx =>\n setTransactionMessageComputeUnitPrice(\n DEFAULT_COMPUTE_UNIT_PRICE_MICROLAMPORTS,\n tx\n ),\n tx => setTransactionMessageFeePayer(feePayer, tx),\n tx =>\n prependTransactionMessageInstruction(\n getSetComputeUnitLimitInstruction({\n units: DEFAULT_COMPUTE_UNIT_LIMIT,\n }),\n tx\n ),\n tx => appendTransactionMessageInstructions([transferIx], tx),\n tx => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx)\n );\n\n const signedTransaction =\n await partiallySignTransactionMessageWithSigners(tx);\n const base64EncodedWireTransaction =\n getBase64EncodedWireTransaction(signedTransaction);\n\n const payload: ExactSvmPayloadV2 = {\n transaction: base64EncodedWireTransaction,\n };\n\n return {\n x402Version,\n payload,\n };\n }\n\n private async resolveBlockhashLifetime(\n rpc: ReturnType<typeof createRpcClient>,\n extra: PatchedPaymentExtra\n ): Promise<BlockhashLifetime> {\n const providedLastValidBlockHeight = parseLastValidBlockHeight(\n extra.lastValidBlockHeight\n );\n\n if (typeof extra.recentBlockhash === 'string') {\n if (providedLastValidBlockHeight !== undefined) {\n return {\n blockhash: asBlockhash(extra.recentBlockhash),\n lastValidBlockHeight: providedLastValidBlockHeight,\n };\n }\n\n const { value } = await rpc.getLatestBlockhash().send();\n return {\n blockhash: asBlockhash(extra.recentBlockhash),\n lastValidBlockHeight: value.lastValidBlockHeight,\n };\n }\n\n if (\n extra.recentBlockhash &&\n typeof extra.recentBlockhash === 'object' &&\n typeof extra.recentBlockhash.blockhash === 'string'\n ) {\n const lastValidBlockHeight =\n parseLastValidBlockHeight(extra.recentBlockhash.lastValidBlockHeight) ??\n providedLastValidBlockHeight;\n\n if (lastValidBlockHeight !== undefined) {\n return {\n blockhash: asBlockhash(extra.recentBlockhash.blockhash),\n lastValidBlockHeight,\n };\n }\n\n const { value } = await rpc.getLatestBlockhash().send();\n return {\n blockhash: asBlockhash(extra.recentBlockhash.blockhash),\n lastValidBlockHeight: value.lastValidBlockHeight,\n };\n }\n\n return (await rpc.getLatestBlockhash().send()).value;\n }\n}\n","import { PaymentProtocol } from './types';\n\nexport function detectPaymentProtocols(response: Response): PaymentProtocol[] {\n const protocols: PaymentProtocol[] = [];\n\n const wwwAuth = response.headers.get('WWW-Authenticate');\n if (wwwAuth?.startsWith('Payment')) {\n protocols.push(PaymentProtocol.MPP);\n }\n\n const paymentRequired = response.headers.get('payment-required');\n if (paymentRequired) {\n protocols.push(PaymentProtocol.X402);\n }\n // If we couldn't detect either explicitly, default to x402\n if (protocols.length === 0) {\n protocols.push(PaymentProtocol.X402);\n }\n return protocols;\n}\n","import type { Address } from 'viem';\nimport { formatUnits } from 'viem';\n\nimport { safeFetch } from '@/shared/neverthrow/fetch';\nimport {\n safeGetMppChallenge,\n safeCreateMppCredential,\n safeGetMppReceipt,\n mppErr,\n mppOk,\n} from '@/shared/protocols/mpp';\n\nimport { PaymentProtocol } from '../types';\nimport { Network } from '@agentcash/networks';\n\nimport type { ExecuteFetchResult } from '@/operations/fetch/types';\nimport type { HandlePaymentParams } from '@/shared/protocols/types';\nimport { beforePayment } from '../before-payment';\n\nexport async function handleMppPayment({\n response,\n request,\n options,\n}: HandlePaymentParams) {\n const { surface, wallets } = options;\n const { timeout } = options.params;\n\n // Prevent retry loops\n if (request.headers.has('Authorization')) {\n return mppErr(surface, {\n cause: 'mpp_payment_already_attempted',\n message: 'MPP payment already attempted',\n });\n }\n\n // Parse the challenge from the WWW-Authenticate header\n const challengeResult = safeGetMppChallenge(surface, response);\n\n if (challengeResult.isErr()) {\n return challengeResult;\n }\n\n const challenge = challengeResult.value;\n\n // Extract payment info from challenge request\n const amount = Number(formatUnits(BigInt(challenge.request.amount), 6));\n const tokenAddress = challenge.request.currency as Address;\n\n const beforePaymentResult = await beforePayment({\n options,\n balanceInput: {\n address: wallets.evm.address,\n network: Network.TEMPO,\n tokenAddress,\n },\n amount,\n protocol: PaymentProtocol.MPP,\n });\n\n if (beforePaymentResult.isErr()) {\n return beforePaymentResult;\n }\n\n const credentialResult = await safeCreateMppCredential(\n surface,\n wallets,\n response\n );\n\n if (credentialResult.isErr()) {\n return credentialResult;\n }\n\n const credential = credentialResult.value;\n\n // Set Authorization header on cloned request\n request.headers.set('Authorization', credential);\n\n // Retry the fetch with the credential\n return await safeFetch(surface, request, timeout).andThen(paidResponse => {\n // Parse the receipt for transaction hash\n const receiptResult = safeGetMppReceipt(surface, paidResponse);\n\n return mppOk<ExecuteFetchResult>({\n response: paidResponse,\n paymentInfo: {\n protocol: PaymentProtocol.MPP,\n network: Network.TEMPO,\n price: amount.toLocaleString('en-US', {\n style: 'currency',\n currency: 'USD',\n }),\n payment: receiptResult.isOk()\n ? {\n success: true,\n transactionHash: receiptResult.value.reference,\n }\n : null,\n },\n });\n });\n}\n","import { Challenge, Receipt } from 'mppx';\nimport { Methods } from 'mppx/tempo';\nimport {\n err,\n ok,\n resultFromPromise,\n resultFromThrowable,\n} from '@agentcash/neverthrow';\n\nimport { Mppx, tempo as tempoMethod } from 'mppx/client';\n\nimport { createClient, http } from 'viem';\nimport { tempo } from 'viem/chains';\n\nimport type { BaseMppError } from './types';\nimport type { Wallets } from '@/wallet';\n\nconst errorType = 'mpp';\n\nexport const mppOk = <T>(value: T) => ok(value);\nexport const mppErr = (surface: string, error: BaseMppError) =>\n err(errorType, surface, error);\n\nconst mppResultFromPromise = <T>(\n surface: string,\n promise: Promise<T>,\n error: (e: unknown) => BaseMppError\n) => resultFromPromise(errorType, surface, promise, error);\n\nconst mppResultFromThrowable = <T>(\n surface: string,\n fn: () => T,\n error: (e: unknown) => BaseMppError\n) => resultFromThrowable(errorType, surface, fn, error);\n\nexport const safeGetMppChallenge = (surface: string, response: Response) => {\n return mppResultFromThrowable(\n surface,\n () => Challenge.fromResponse(response, { methods: [Methods.charge] }),\n error => ({\n cause: 'parse_mpp_challenge',\n message:\n error instanceof Error\n ? error.message\n : 'Failed to parse MPP challenge from response',\n })\n );\n};\n\nexport const safeCreateMppCredential = (\n surface: string,\n wallets: Wallets,\n response: Response\n) => {\n const TEMPO_RPC_URL =\n 'https://eng:acard-melody-fashion-finish@rpc.mainnet.tempo.xyz';\n\n const client = Mppx.create({\n polyfill: false,\n methods: [\n tempoMethod({\n account: wallets.evm,\n getClient: () =>\n createClient({\n chain: tempo,\n transport: http(TEMPO_RPC_URL),\n }),\n }),\n ],\n });\n\n return mppResultFromPromise(\n surface,\n client.createCredential(response),\n error => ({\n cause: 'create_mpp_credential',\n message:\n error instanceof Error\n ? error.message\n : 'Failed to create MPP credential',\n })\n );\n};\n\nexport const safeGetMppReceipt = (surface: string, response: Response) => {\n return mppResultFromThrowable(\n surface,\n () => Receipt.fromResponse(response),\n error => ({\n cause: 'parse_mpp_receipt',\n message:\n error instanceof Error\n ? error.message\n : 'Failed to parse MPP receipt from response',\n })\n );\n};\n","import { err, ok } from '@agentcash/neverthrow';\n\nimport { getBalance } from '../balance';\nimport { getDepositLink } from '../utils';\nimport { getSettings } from '../settings';\n\nimport { DEFAULT_MAX_AMOUNT } from '@/operations/fetch/types';\n\nimport type { GetBalanceInput } from '@agentcash/balance';\nimport type { ExecuteFetchOptions } from '@/operations/fetch/types';\nimport type { PaymentProtocol } from './types';\n\ninterface BeforePaymentProps {\n options: ExecuteFetchOptions;\n balanceInput: GetBalanceInput;\n protocol: PaymentProtocol;\n amount: number;\n}\n\nexport const beforePayment = async (props: BeforePaymentProps) => {\n const { options, balanceInput, amount } = props;\n const maxAmount =\n options.params.maxAmount ?? getSettings().maxAmount ?? DEFAULT_MAX_AMOUNT;\n if (amount > maxAmount) {\n return err('before_payment', options.surface, {\n cause: 'amount_exceeds_max_amount' as const,\n message: `Endpoint requested $${amount} which exceeds the maximum allowed amount of $${maxAmount}. Pass a higher maxAmount on this call, or use update_settings to raise the default permanently.`,\n });\n }\n\n const balanceResult = await getBalance(\n options.surface,\n balanceInput,\n options.flags\n );\n\n if (balanceResult.isErr()) {\n return balanceResult;\n }\n\n const balance = balanceResult.value.balance;\n\n if (balance < amount) {\n return err('before_payment', options.surface, {\n cause: 'insufficient_balance' as const,\n message: insufficientBalanceErrorMessage(props, balance),\n });\n }\n\n return ok(true);\n};\n\nconst insufficientBalanceErrorMessage = (\n props: BeforePaymentProps,\n balance: number\n) => {\n const { options, balanceInput, amount } = props;\n return [\n `You are attempting to use an endpoint via ${props.protocol} that costs ${amount} USDC on ${balanceInput.network}.`,\n `Your current balance is ${balance} USDC.`,\n `You can deposit at ${getDepositLink(balanceInput.address, options.flags, balanceInput.network)}`,\n ].join('\\n');\n};\n","import { safeGetMppChallenge } from '@/shared/protocols/mpp';\n\nimport { log } from '@/shared/log';\nimport { getBalance } from '@/shared/balance';\nimport { Network } from '@agentcash/networks';\n\nimport { PaymentProtocol } from './types';\n\nimport type { ExecuteFetchOptions } from '@/operations/fetch/types';\n\n/**\n * Pick the preferred protocol by comparing wallet balances.\n * Falls back to 'mpp' if both balances fail to fetch.\n */\nexport async function pickByBalance(\n response: Response,\n options: ExecuteFetchOptions\n): Promise<PaymentProtocol> {\n const { surface, wallets, flags } = options;\n\n // Get x402 (USDC on Base and Solana) balances in parallel\n const x402Balances = await Promise.all([\n getBalance(\n surface,\n {\n address: wallets.evm.address,\n network: Network.BASE,\n },\n flags\n ),\n getBalance(\n surface,\n {\n address: wallets.svm.address,\n network: Network.SOLANA,\n },\n flags\n ),\n ]);\n\n const x402Balance = x402Balances.reduce(\n (acc, balance) => acc + (balance.isOk() ? balance.value.balance : 0),\n 0\n );\n\n // Get MPP (Tempo) balance — need token address from the challenge\n let mppBalance = 0;\n const challengeResult = safeGetMppChallenge(surface, response);\n if (challengeResult.isOk()) {\n const currency = challengeResult.value.request.currency;\n if (currency) {\n const tempoResult = await getBalance(\n surface,\n {\n address: wallets.evm.address,\n network: Network.TEMPO,\n },\n flags\n );\n if (tempoResult.isOk()) {\n mppBalance = tempoResult.value.balance ?? 0;\n }\n }\n }\n\n log.info(`Protocol selection — x402: $${x402Balance}, mpp: $${mppBalance}`);\n return x402Balance >= mppBalance ? PaymentProtocol.X402 : PaymentProtocol.MPP;\n}\n","import { getBalance } from '@/shared/balance';\nimport { caip2ToNetwork, Network, networkToCaip2 } from '@agentcash/networks';\n\nimport type { PaymentRequirements } from '@x402/core/types';\nimport type { ExecuteFetchOptions } from '@/operations/fetch/types';\n\ninterface ChoosePaymentRequirementParams {\n paymentRequirements: PaymentRequirements[];\n options: ExecuteFetchOptions;\n}\n\nexport const choosePaymentRequirement = async ({\n paymentRequirements,\n options,\n}: ChoosePaymentRequirementParams) => {\n const { surface, wallets, flags } = options;\n const { paymentNetwork } = options.params;\n if (paymentNetwork) {\n const caip2 = networkToCaip2(paymentNetwork);\n return paymentRequirements.find(pr => pr.network === caip2);\n }\n\n const requirementsWithBalance = await Promise.all(\n paymentRequirements.map(async pr => {\n const network = caip2ToNetwork(pr.network);\n if (network === null) {\n return {\n balance: 0,\n requirement: pr,\n };\n }\n if (network === Network.SOLANA) {\n const balanceResult = await getBalance(\n surface,\n {\n address: wallets.svm.address,\n network,\n },\n flags\n );\n return {\n requirement: pr,\n balance: balanceResult.isOk() ? balanceResult.value.balance : 0,\n };\n } else {\n const balanceResult = await getBalance(\n surface,\n {\n address: wallets.evm.address,\n network,\n },\n flags\n );\n return {\n requirement: pr,\n balance: balanceResult.isOk() ? balanceResult.value.balance : 0,\n };\n }\n })\n );\n return requirementsWithBalance.sort((a, b) => b.balance - a.balance)[0]!\n .requirement;\n};\n","import { caip2ToNetwork, Network } from '@agentcash/networks';\n\nimport { choosePaymentRequirement } from './choose-payment-requirement';\n\nimport { safeFetch } from '@/shared/neverthrow/fetch';\nimport {\n safeCreatePaymentPayload,\n safeGetPaymentRequired,\n safeGetPaymentSettlement,\n x402Err,\n x402Ok,\n x402ProbeClient,\n} from '@/shared/protocols/x402';\nimport { tokenStringToNumber } from '@/shared/utils';\n\nimport { beforePayment } from '../before-payment';\n\nimport { PaymentProtocol } from '../types';\n\nimport type { ExecuteFetchResult } from '@/operations/fetch/types';\nimport type { HandlePaymentParams } from '../types';\n\nexport async function handleX402Payment({\n response,\n request,\n options,\n}: HandlePaymentParams) {\n const { surface, wallets } = options;\n const { timeout } = options.params;\n\n const paymentRequiredResult = await safeGetPaymentRequired(surface, response);\n\n if (paymentRequiredResult.isErr()) {\n return paymentRequiredResult;\n }\n\n const paymentRequired = paymentRequiredResult.value;\n\n if (paymentRequired.x402Version === 1) {\n return x402Err(surface, {\n cause: 'parse_payment_required' as const,\n message:\n 'This endpoint uses the x402 v1 format, which is not supported by agentcash. Only x402 v2 servers (with an `accepts` array in the Payment-Required header) are supported.',\n });\n }\n\n if (!paymentRequired.accepts || !Array.isArray(paymentRequired.accepts)) {\n return x402Err(surface, {\n cause: 'parse_payment_required' as const,\n message:\n 'This endpoint has a missing or malformed accepts array in the Payment-Required header.',\n });\n }\n\n // Check amount against maxAmount before any payment logic\n const accept = await choosePaymentRequirement({\n options,\n paymentRequirements: paymentRequired.accepts,\n });\n\n if (accept) {\n const amount = tokenStringToNumber(accept.amount);\n\n const typedNetwork = caip2ToNetwork(accept.network)!;\n if (!typedNetwork) {\n return x402Err(surface, {\n cause: 'parse_payment_required' as const,\n message: `Invalid network: ${accept.network}`,\n });\n }\n\n const beforePaymentResult = await beforePayment({\n options,\n balanceInput:\n typedNetwork === Network.SOLANA\n ? {\n address: wallets.svm.address,\n network: Network.SOLANA,\n }\n : {\n address: wallets.evm.address,\n network: typedNetwork,\n },\n amount,\n protocol: PaymentProtocol.X402,\n });\n\n if (beforePaymentResult.isErr()) {\n return beforePaymentResult;\n }\n }\n\n const paymentPayloadResult = await safeCreatePaymentPayload(\n surface,\n wallets,\n paymentRequired,\n accept ? () => accept : undefined\n );\n\n if (paymentPayloadResult.isErr()) {\n return paymentPayloadResult;\n }\n\n const paymentPayload = paymentPayloadResult.value;\n\n // Encode payment header\n const paymentHeaders =\n x402ProbeClient.encodePaymentSignatureHeader(paymentPayload);\n\n // Check if this is already a retry to prevent infinite loops\n if (\n request.headers.has('PAYMENT-SIGNATURE') ||\n request.headers.has('X-PAYMENT')\n ) {\n return x402Err(surface, {\n cause: 'payment_already_attempted',\n message: 'Payment already attempted',\n });\n }\n\n // Add payment headers to cloned request\n for (const [key, value] of Object.entries(paymentHeaders)) {\n request.headers.set(key, value);\n }\n request.headers.set(\n 'Access-Control-Expose-Headers',\n 'PAYMENT-RESPONSE,X-PAYMENT-RESPONSE'\n );\n\n // Retry the request with payment\n return await safeFetch(surface, request, timeout).andThen(paidResponse => {\n const settlementResult = safeGetPaymentSettlement(surface, paidResponse);\n\n return x402Ok<ExecuteFetchResult>({\n response: paidResponse,\n paymentInfo: {\n protocol: PaymentProtocol.X402,\n network: caip2ToNetwork(paymentPayload.accepted.network)!,\n price: tokenStringToNumber(\n paymentPayload.accepted.amount\n ).toLocaleString('en-US', {\n style: 'currency',\n currency: 'USD',\n }),\n payment: settlementResult.isOk()\n ? {\n success: settlementResult.value.success,\n transactionHash: settlementResult.value.transaction,\n }\n : null,\n },\n });\n });\n}\n","import { detectPaymentProtocols } from '@/shared/protocols/detect';\nimport { handleMppPayment } from '@/shared/protocols/mpp/handle-payment';\nimport { pickByBalance } from '@/shared/protocols/pick';\nimport { PaymentProtocol } from '@/shared/protocols/types';\nimport { handleX402Payment } from '@/shared/protocols/x402/handle-payment';\n\nimport type { ExecuteFetchOptions } from './types';\n\nexport async function executePayment(\n response: Response,\n request: Request,\n options: ExecuteFetchOptions\n) {\n const { paymentProtocol } = options.params;\n\n const params = {\n response,\n request,\n options,\n };\n\n if (paymentProtocol) {\n return handlerMap[paymentProtocol](params);\n }\n\n const available = detectPaymentProtocols(response);\n const preferred =\n available.length === 1\n ? available[0]!\n : await pickByBalance(response, options);\n const fallback =\n available.length > 1\n ? preferred === PaymentProtocol.MPP\n ? PaymentProtocol.X402\n : PaymentProtocol.MPP\n : null;\n\n const fallbackRetryRequest = fallback ? request.clone() : null;\n const result = await handlerMap[preferred](params);\n\n if (result.isErr() && fallback && fallbackRetryRequest) {\n return handlerMap[fallback]({\n ...params,\n request: fallbackRetryRequest,\n });\n }\n\n return result;\n}\n\nconst handlerMap = {\n [PaymentProtocol.MPP]: handleMppPayment,\n [PaymentProtocol.X402]: handleX402Payment,\n};\n","import { fetchErr, fetchOk, safeFetch } from '@/shared/neverthrow/fetch';\nimport { BLACKLISTED_ORIGINS } from '@/shared/origins';\n\nimport { attemptSiwxAuth } from './auth';\nimport { executePayment } from './payment';\n\nimport type { ExecuteFetchOptions } from './types';\nimport { buildRequest } from '@/shared/request/build';\nimport type { RequestInput } from '@/shared/request/types';\n\n/**\n * Executes a request with automatic SIWX authentication and payment handling.\n *\n * 1. Probe the endpoint\n * 2. If 402 with SIWX challenge, retry with SIGN-IN-WITH-X\n * 3. If still 402, execute payment\n */\nexport async function executeFetch(\n input: RequestInput,\n options: ExecuteFetchOptions\n) {\n const request = buildRequest(input, options);\n\n const { surface } = options;\n const { timeout } = options.params;\n\n const blocked = BLACKLISTED_ORIGINS.find(origin =>\n request.url.startsWith(origin)\n );\n if (blocked) {\n return fetchErr(surface, {\n cause: 'network',\n message: `${blocked} is no longer available. This origin has been deprecated.`,\n });\n }\n\n const authRetryRequest = request.clone();\n const paymentRetryRequest = request.clone();\n\n const probeResult = await safeFetch(surface, request, timeout);\n\n if (probeResult.isErr()) {\n return fetchErr(surface, probeResult.error);\n }\n\n const initialResponse = probeResult.value;\n if (initialResponse.status !== 402) {\n return fetchOk({\n response: initialResponse,\n paymentInfo: null,\n });\n }\n\n const authResult = await attemptSiwxAuth(\n initialResponse,\n authRetryRequest,\n paymentRetryRequest,\n options\n );\n\n if (authResult.isErr()) {\n return authResult;\n }\n\n const latestResponse = authResult.value.response;\n if (latestResponse.status !== 402) {\n return fetchOk({\n response: latestResponse,\n paymentInfo: null,\n });\n }\n\n return executePayment(\n latestResponse,\n authResult.value.paymentRetryRequest,\n options\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,wBAAwB;;;ACQjC,SAAS,YAAY,sBAAsB;AAE3C,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAElC,SAAS,sBAAsB;;;ACb/B;AAAA,EACE;AA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A,MAAI,WAAW,MAAM,GAAG;AACtB,WAAO;AAAA,EACT;AAEA,QAAM,iBAAiB,WAAW,MAAM;AACxC,MAAI,eAAe,WAAW,KAAK;AACjC,WAAO,QAAQ;AAAA,MACb,UAAU;AAAA,MACV,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA,WAAW,MAAM;AAAA,IACjB;AAAA,EACF;AACF;","names":["tx","http","errorType"]}
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-6XGAIMNK.js";
|
|
4
4
|
import {
|
|
5
5
|
getBalance
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-C25DJ6BH.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
Network
|
|
9
|
+
} from "./chunk-A6NJUOCG.js";
|
|
10
10
|
import {
|
|
11
11
|
getBaseUrl,
|
|
12
12
|
getDepositLink
|
|
@@ -33,32 +33,25 @@ var listAccountsWithAddresses = (wallets) => {
|
|
|
33
33
|
evm: { address: evmAddress },
|
|
34
34
|
svm: { address: svmAddress }
|
|
35
35
|
} = wallets;
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
];
|
|
36
|
+
return Object.values(Network).map((network) => ({
|
|
37
|
+
address: network === "solana" /* SOLANA */ ? svmAddress : evmAddress,
|
|
38
|
+
network
|
|
39
|
+
}));
|
|
41
40
|
};
|
|
42
41
|
var getBalances = async (surface, wallets, flags) => {
|
|
43
42
|
const {
|
|
44
43
|
evm: { address: evmAddress },
|
|
45
44
|
svm: { address: svmAddress }
|
|
46
45
|
} = wallets;
|
|
47
|
-
const balanceResults = await Promise.all(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
surface,
|
|
51
|
-
{ address: svmAddress, network: "solana" /* SOLANA */ },
|
|
52
|
-
flags
|
|
53
|
-
),
|
|
54
|
-
...isMppEnabled() ? [
|
|
55
|
-
getBalance(
|
|
46
|
+
const balanceResults = await Promise.all(
|
|
47
|
+
Object.values(Network).map(
|
|
48
|
+
(network) => getBalance(
|
|
56
49
|
surface,
|
|
57
|
-
{ address:
|
|
50
|
+
network === "solana" /* SOLANA */ ? { address: svmAddress, network } : { address: evmAddress, network },
|
|
58
51
|
flags
|
|
59
52
|
)
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
)
|
|
54
|
+
);
|
|
62
55
|
const accounts = balanceResults.filter((balance) => balance.isOk()).map((balance) => {
|
|
63
56
|
const address = balance.value.paymentNetwork === "solana" /* SOLANA */ ? svmAddress : evmAddress;
|
|
64
57
|
const depositLink = getDepositLink(
|
|
@@ -94,4 +87,4 @@ export {
|
|
|
94
87
|
getBalances,
|
|
95
88
|
listAccountsWithBalances
|
|
96
89
|
};
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-QPHNB77R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/operations/onboarding-cta.ts","../../src/operations/wallet.ts"],"sourcesContent":["import { getState } from '@/shared/state';\nimport { getBaseUrl } from '@/shared/utils';\n\nimport type { GlobalFlags } from '@/types';\n\nexport function shouldShowOnboardingCta(): boolean {\n return (getState().redeemedCodes?.length ?? 0) === 0;\n}\n\nexport function getOnboardingCta(flags: GlobalFlags) {\n const onboardLink = `${getBaseUrl(flags.dev)}/onboard`;\n\n return {\n message: `Welcome to AgentCash. To get started, complete onboarding at ${onboardLink} and receive your reward.`,\n onboardLink,\n };\n}\n","import { Network } from '@agentcash/networks';\n\nimport { getBalance } from '@/shared/balance';\nimport { getDepositLink } from '@/shared/utils';\n\nimport {\n shouldShowOnboardingCta,\n getOnboardingCta,\n} from '@/operations/onboarding-cta';\n\nimport type { GlobalFlags } from '@/types';\nimport type { Wallets } from '@/wallet';\nimport type { SolanaAddress } from '@agentcash/networks';\n\nexport const getWalletInfo = async (\n surface: string,\n wallets: Wallets,\n flags: GlobalFlags\n) => {\n return getBalances(surface, wallets, flags);\n};\n\nexport const listAccountsWithAddresses = (wallets: Wallets) => {\n const {\n evm: { address: evmAddress },\n svm: { address: svmAddress },\n } = wallets;\n return Object.values(Network).map(network => ({\n address: network === Network.SOLANA ? (svmAddress as SolanaAddress) : evmAddress,\n network,\n }));\n};\n\nexport const getBalances = async (\n surface: string,\n wallets: Wallets,\n flags: GlobalFlags\n) => {\n const {\n evm: { address: evmAddress },\n svm: { address: svmAddress },\n } = wallets;\n const balanceResults = await Promise.all(\n Object.values(Network).map(network =>\n getBalance(\n surface,\n network === Network.SOLANA\n ? { address: svmAddress, network }\n : { address: evmAddress, network },\n flags\n )\n )\n );\n\n const accounts = balanceResults\n .filter(balance => balance.isOk())\n .map(balance => {\n const address =\n balance.value.paymentNetwork === Network.SOLANA\n ? (svmAddress as SolanaAddress)\n : evmAddress;\n\n const depositLink = getDepositLink(\n address,\n flags,\n balance.value.paymentNetwork\n );\n\n return {\n balance: balance.value.balance,\n network: balance.value.paymentNetwork,\n address,\n depositLink,\n };\n });\n\n const totalBalance = accounts.reduce(\n (acc, balance) => acc + balance.balance,\n 0\n );\n\n return {\n accounts,\n totalBalance,\n onboardingCta: shouldShowOnboardingCta()\n ? getOnboardingCta(flags)\n : undefined,\n };\n};\n\nexport const listAccountsWithBalances = async (\n surface: string,\n wallets: Wallets,\n flags: GlobalFlags\n) => {\n return getBalances(surface, wallets, flags);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAKO,SAAS,0BAAmC;AACjD,UAAQ,SAAS,EAAE,eAAe,UAAU,OAAO;AACrD;AAEO,SAAS,iBAAiB,OAAoB;AACnD,QAAM,cAAc,GAAG,WAAW,MAAM,GAAG,CAAC;AAE5C,SAAO;AAAA,IACL,SAAS,gEAAgE,WAAW;AAAA,IACpF;AAAA,EACF;AACF;;;ACFO,IAAM,gBAAgB,OAC3B,SACA,SACA,UACG;AACH,SAAO,YAAY,SAAS,SAAS,KAAK;AAC5C;AAEO,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 import {
|
|
|
6
6
|
} from "./chunk-27DZCYDB.js";
|
|
7
7
|
import {
|
|
8
8
|
INSTALL_PACKAGE_SPECIFIER
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZRM5POEW.js";
|
|
10
10
|
import {
|
|
11
11
|
log,
|
|
12
12
|
safeReadFile,
|
|
@@ -610,4 +610,4 @@ export {
|
|
|
610
610
|
tryAddServer,
|
|
611
611
|
addServer
|
|
612
612
|
};
|
|
613
|
-
//# sourceMappingURL=chunk-
|
|
613
|
+
//# sourceMappingURL=chunk-RWYXPIDK.js.map
|
|
@@ -4,7 +4,7 @@ import { dirname, join } from "path";
|
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
function getVersion() {
|
|
6
6
|
if (true) {
|
|
7
|
-
return "0.11.
|
|
7
|
+
return "0.11.2";
|
|
8
8
|
}
|
|
9
9
|
const __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
const pkg = JSON.parse(
|
|
@@ -23,4 +23,4 @@ export {
|
|
|
23
23
|
MCP_VERSION,
|
|
24
24
|
INSTALL_PACKAGE_SPECIFIER
|
|
25
25
|
};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-ZRM5POEW.js.map
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeFetch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PITBMGHN.js";
|
|
4
4
|
import "./chunk-GKYODP7W.js";
|
|
5
5
|
import {
|
|
6
6
|
cliFetchRequestSchema
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2HJ52VIH.js";
|
|
8
8
|
import "./chunk-S3Q7HU4U.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-26HXYYNP.js";
|
|
10
|
+
import "./chunk-C25DJ6BH.js";
|
|
11
11
|
import {
|
|
12
12
|
getWalletOrExit
|
|
13
13
|
} from "./chunk-OZD4QBHS.js";
|
|
14
14
|
import "./chunk-SIBQDIAW.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-TSQHYLV6.js";
|
|
15
|
+
import "./chunk-A6NJUOCG.js";
|
|
17
16
|
import {
|
|
18
17
|
safeParseResponse
|
|
19
18
|
} from "./chunk-QZBSRYSW.js";
|
|
@@ -89,4 +88,4 @@ var fetchCommand = async (input) => {
|
|
|
89
88
|
export {
|
|
90
89
|
fetchCommand
|
|
91
90
|
};
|
|
92
|
-
//# sourceMappingURL=fetch-
|
|
91
|
+
//# sourceMappingURL=fetch-DJKLEQQD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/commands/fetch.ts"],"sourcesContent":["import {\n successResponse,\n errorResponse,\n fromNeverthrowError,\n outputAndExit,\n} from '@/cli/output';\n\nimport { safeParseResponse } from '@/shared/neverthrow/fetch';\nimport { executeFetch } from '@/operations/fetch';\nimport { cliFetchRequestSchema } from '@/shared/request/schemas/cli';\nimport { getWalletOrExit } from '../lib/get-wallet-or-exit';\n\nimport type z from 'zod';\nimport type { Command } from '@/types';\n\nconst SURFACE = 'cli:fetch';\n\nexport const fetchCommand: Command<\n z.input<typeof cliFetchRequestSchema>\n> = async input => {\n const requestInput = cliFetchRequestSchema.safeParse(input);\n if (!requestInput.success) {\n return outputAndExit(\n errorResponse({\n code: 'INVALID_INPUT',\n message: requestInput.error.message,\n surface: SURFACE,\n cause: 'validation',\n }),\n input\n );\n }\n const wallets = await getWalletOrExit(input);\n\n const fetchResult = await executeFetch(requestInput.data, {\n surface: SURFACE,\n wallets,\n flags: input,\n params: input,\n });\n\n if (fetchResult.isErr()) {\n return outputAndExit(fromNeverthrowError(fetchResult), input);\n }\n\n const { response, paymentInfo } = fetchResult.value;\n\n if (!response.ok) {\n const parseResult = await safeParseResponse(SURFACE, response);\n return outputAndExit(\n errorResponse({\n code: 'HTTP_ERROR',\n message: response.statusText,\n surface: SURFACE,\n cause: 'http',\n details: parseResult.match(\n data => ({\n statusCode: response.status,\n type: data.type,\n body:\n data.type === 'json' || data.type === 'text'\n ? data.data\n : undefined,\n }),\n () => ({ statusCode: response.status })\n ),\n }),\n input\n );\n }\n\n const parseResponseResult = await safeParseResponse(SURFACE, response);\n if (parseResponseResult.isErr()) {\n return outputAndExit(fromNeverthrowError(parseResponseResult), input);\n }\n\n const parsedResponse = parseResponseResult.value;\n\n const data =\n parsedResponse.type === 'json' || parsedResponse.type === 'text'\n ? parsedResponse.data\n : { type: parsedResponse.type };\n\n outputAndExit(successResponse(data, paymentInfo), input);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/cli/commands/fetch.ts"],"sourcesContent":["import {\n successResponse,\n errorResponse,\n fromNeverthrowError,\n outputAndExit,\n} from '@/cli/output';\n\nimport { safeParseResponse } from '@/shared/neverthrow/fetch';\nimport { executeFetch } from '@/operations/fetch';\nimport { cliFetchRequestSchema } from '@/shared/request/schemas/cli';\nimport { getWalletOrExit } from '../lib/get-wallet-or-exit';\n\nimport type z from 'zod';\nimport type { Command } from '@/types';\n\nconst SURFACE = 'cli:fetch';\n\nexport const fetchCommand: Command<\n z.input<typeof cliFetchRequestSchema>\n> = async input => {\n const requestInput = cliFetchRequestSchema.safeParse(input);\n if (!requestInput.success) {\n return outputAndExit(\n errorResponse({\n code: 'INVALID_INPUT',\n message: requestInput.error.message,\n surface: SURFACE,\n cause: 'validation',\n }),\n input\n );\n }\n const wallets = await getWalletOrExit(input);\n\n const fetchResult = await executeFetch(requestInput.data, {\n surface: SURFACE,\n wallets,\n flags: input,\n params: input,\n });\n\n if (fetchResult.isErr()) {\n return outputAndExit(fromNeverthrowError(fetchResult), input);\n }\n\n const { response, paymentInfo } = fetchResult.value;\n\n if (!response.ok) {\n const parseResult = await safeParseResponse(SURFACE, response);\n return outputAndExit(\n errorResponse({\n code: 'HTTP_ERROR',\n message: response.statusText,\n surface: SURFACE,\n cause: 'http',\n details: parseResult.match(\n data => ({\n statusCode: response.status,\n type: data.type,\n body:\n data.type === 'json' || data.type === 'text'\n ? data.data\n : undefined,\n }),\n () => ({ statusCode: response.status })\n ),\n }),\n input\n );\n }\n\n const parseResponseResult = await safeParseResponse(SURFACE, response);\n if (parseResponseResult.isErr()) {\n return outputAndExit(fromNeverthrowError(parseResponseResult), input);\n }\n\n const parsedResponse = parseResponseResult.value;\n\n const data =\n parsedResponse.type === 'json' || parsedResponse.type === 'text'\n ? parsedResponse.data\n : { type: parsedResponse.type };\n\n outputAndExit(successResponse(data, paymentInfo), input);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAM,UAAU;AAET,IAAM,eAET,OAAM,UAAS;AACjB,QAAM,eAAe,sBAAsB,UAAU,KAAK;AAC1D,MAAI,CAAC,aAAa,SAAS;AACzB,WAAO;AAAA,MACL,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,SAAS,aAAa,MAAM;AAAA,QAC5B,SAAS;AAAA,QACT,OAAO;AAAA,MACT,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AACA,QAAM,UAAU,MAAM,gBAAgB,KAAK;AAE3C,QAAM,cAAc,MAAM,aAAa,aAAa,MAAM;AAAA,IACxD,SAAS;AAAA,IACT;AAAA,IACA,OAAO;AAAA,IACP,QAAQ;AAAA,EACV,CAAC;AAED,MAAI,YAAY,MAAM,GAAG;AACvB,WAAO,cAAc,oBAAoB,WAAW,GAAG,KAAK;AAAA,EAC9D;AAEA,QAAM,EAAE,UAAU,YAAY,IAAI,YAAY;AAE9C,MAAI,CAAC,SAAS,IAAI;AAChB,UAAM,cAAc,MAAM,kBAAkB,SAAS,QAAQ;AAC7D,WAAO;AAAA,MACL,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,SAAS,SAAS;AAAA,QAClB,SAAS;AAAA,QACT,OAAO;AAAA,QACP,SAAS,YAAY;AAAA,UACnB,CAAAA,WAAS;AAAA,YACP,YAA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