agentcash 0.14.3 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/run-server.cjs +41485 -17862
- package/dist/esm/{add-skill-CDIK57A3.js → add-skill-5HFBHQTQ.js} +10 -10
- package/dist/esm/{bridge-6WMUV3ML.js → bridge-BOLVXKCD.js} +7 -7
- package/dist/esm/{check-D5DZ6Y3T.js → check-FEWY37RD.js} +7 -7
- package/dist/esm/{chunk-SCBLFGL2.js → chunk-2C7X7XIG.js} +3 -3
- package/dist/esm/{chunk-UCADMHNP.js → chunk-2E4ZDG2M.js} +2 -2
- package/dist/esm/{chunk-YUPRVVFP.js → chunk-4MCPQDKM.js} +3 -3
- package/dist/esm/{chunk-JX2XE6FD.js → chunk-4TIYIVZF.js} +1 -1
- package/dist/esm/chunk-4TIYIVZF.js.map +1 -0
- package/dist/esm/{chunk-IL2CNAJY.js → chunk-5MITNOWT.js} +2 -2
- package/dist/esm/{chunk-MSNAPI5G.js → chunk-BIO4Y27B.js} +3 -3
- package/dist/esm/{chunk-BNFMFAEF.js → chunk-C7B6LEPE.js} +3 -3
- package/dist/esm/{chunk-KJCWPVQE.js → chunk-EM6OE6WL.js} +3 -3
- package/dist/esm/chunk-FBGNOXFP.js +102 -0
- package/dist/esm/chunk-FBGNOXFP.js.map +1 -0
- package/dist/esm/{chunk-G5FHPXQL.js → chunk-HNDMHX4B.js} +271 -98
- package/dist/esm/chunk-HNDMHX4B.js.map +1 -0
- package/dist/esm/{chunk-NPJV7AMV.js → chunk-HTGTKVXB.js} +6 -2
- package/dist/esm/chunk-HTGTKVXB.js.map +1 -0
- package/dist/esm/{chunk-CFSSHSBN.js → chunk-K3WB4R2P.js} +3 -2
- package/dist/esm/{chunk-CFSSHSBN.js.map → chunk-K3WB4R2P.js.map} +1 -1
- package/dist/esm/{chunk-FV6DADHO.js → chunk-MKA2PTOE.js} +5 -7
- package/dist/esm/chunk-MKA2PTOE.js.map +1 -0
- package/dist/esm/{chunk-KSW2MGQR.js → chunk-MZPHS3IS.js} +4 -4
- package/dist/esm/{chunk-K627XZI4.js → chunk-O57QVTLM.js} +2 -2
- package/dist/esm/{chunk-BFOYXXLG.js → chunk-RAS5DZPQ.js} +15 -1
- package/dist/esm/chunk-RAS5DZPQ.js.map +1 -0
- package/dist/esm/{chunk-KMS4TVJY.js → chunk-SLTRGQ7W.js} +8 -3
- package/dist/esm/{chunk-KMS4TVJY.js.map → chunk-SLTRGQ7W.js.map} +1 -1
- package/dist/esm/chunk-TX7S7QGG.js +146 -0
- package/dist/esm/chunk-TX7S7QGG.js.map +1 -0
- package/dist/esm/{chunk-NP7CKLI4.js → chunk-ULB5PPKW.js} +2 -2
- package/dist/esm/{chunk-LGFUHPDL.js → chunk-VGKAPM5S.js} +3 -3
- package/dist/esm/{chunk-SFESERJN.js → chunk-W37JKCLN.js} +42 -4
- package/dist/esm/chunk-W37JKCLN.js.map +1 -0
- package/dist/esm/{chunk-TTAO2EJK.js → chunk-YPFBBTA2.js} +1 -1
- package/dist/esm/chunk-YPFBBTA2.js.map +1 -0
- package/dist/esm/{discover-X557BWGS.js → discover-TXEJNB5A.js} +5 -5
- package/dist/esm/{fetch-45YPD37H.js → fetch-QAVIWIRX.js} +12 -11
- package/dist/esm/{fetch-45YPD37H.js.map → fetch-QAVIWIRX.js.map} +1 -1
- package/dist/esm/{fund-HHL4QEU5.js → fund-FCOUEG7T.js} +5 -5
- package/dist/esm/index.js +70 -34
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{install-KJOAEIZF.js → install-NJJZYBZU.js} +8 -8
- package/dist/esm/{onboard-M5C6TFWE.js → onboard-TYB4QZE4.js} +12 -12
- package/dist/esm/{origins-XG6O5K27.js → origins-EVVF3N4G.js} +6 -6
- package/dist/esm/{register-AD43YD5O.js → register-T6M2US4B.js} +62 -21
- package/dist/esm/register-T6M2US4B.js.map +1 -0
- package/dist/esm/{report-error-FDDNOZAD.js → report-error-BR7ETMF7.js} +5 -5
- package/dist/esm/{search-VYYPNNIU.js → search-KIPT62MB.js} +11 -10
- package/dist/esm/{search-VYYPNNIU.js.map → search-KIPT62MB.js.map} +1 -1
- package/dist/esm/{server-6FQ4UZMS.js → server-MO3YMDHB.js} +83 -18
- package/dist/esm/server-MO3YMDHB.js.map +1 -0
- package/dist/esm/{server-Q4W2J7OE.js → server-WJH536CN.js} +2 -2
- package/dist/esm/sessions-NUOSJC6M.js +74 -0
- package/dist/esm/sessions-NUOSJC6M.js.map +1 -0
- package/dist/esm/{settings-RLSKK5RM.js → settings-SBL7WIBQ.js} +2 -2
- package/dist/esm/{try-UYLQPTBJ.js → try-2P5ZRXRT.js} +9 -9
- package/dist/esm/{wallet-QOS3FPSF.js → wallet-PY4ZDHNZ.js} +12 -12
- package/package.json +7 -7
- package/dist/esm/chunk-BFOYXXLG.js.map +0 -1
- package/dist/esm/chunk-FV6DADHO.js.map +0 -1
- package/dist/esm/chunk-G5FHPXQL.js.map +0 -1
- package/dist/esm/chunk-JX2XE6FD.js.map +0 -1
- package/dist/esm/chunk-NPJV7AMV.js.map +0 -1
- package/dist/esm/chunk-SFESERJN.js.map +0 -1
- package/dist/esm/chunk-TTAO2EJK.js.map +0 -1
- package/dist/esm/register-AD43YD5O.js.map +0 -1
- package/dist/esm/server-6FQ4UZMS.js.map +0 -1
- /package/dist/esm/{add-skill-CDIK57A3.js.map → add-skill-5HFBHQTQ.js.map} +0 -0
- /package/dist/esm/{bridge-6WMUV3ML.js.map → bridge-BOLVXKCD.js.map} +0 -0
- /package/dist/esm/{check-D5DZ6Y3T.js.map → check-FEWY37RD.js.map} +0 -0
- /package/dist/esm/{chunk-SCBLFGL2.js.map → chunk-2C7X7XIG.js.map} +0 -0
- /package/dist/esm/{chunk-UCADMHNP.js.map → chunk-2E4ZDG2M.js.map} +0 -0
- /package/dist/esm/{chunk-YUPRVVFP.js.map → chunk-4MCPQDKM.js.map} +0 -0
- /package/dist/esm/{chunk-IL2CNAJY.js.map → chunk-5MITNOWT.js.map} +0 -0
- /package/dist/esm/{chunk-MSNAPI5G.js.map → chunk-BIO4Y27B.js.map} +0 -0
- /package/dist/esm/{chunk-BNFMFAEF.js.map → chunk-C7B6LEPE.js.map} +0 -0
- /package/dist/esm/{chunk-KJCWPVQE.js.map → chunk-EM6OE6WL.js.map} +0 -0
- /package/dist/esm/{chunk-KSW2MGQR.js.map → chunk-MZPHS3IS.js.map} +0 -0
- /package/dist/esm/{chunk-K627XZI4.js.map → chunk-O57QVTLM.js.map} +0 -0
- /package/dist/esm/{chunk-NP7CKLI4.js.map → chunk-ULB5PPKW.js.map} +0 -0
- /package/dist/esm/{chunk-LGFUHPDL.js.map → chunk-VGKAPM5S.js.map} +0 -0
- /package/dist/esm/{discover-X557BWGS.js.map → discover-TXEJNB5A.js.map} +0 -0
- /package/dist/esm/{fund-HHL4QEU5.js.map → fund-FCOUEG7T.js.map} +0 -0
- /package/dist/esm/{install-KJOAEIZF.js.map → install-NJJZYBZU.js.map} +0 -0
- /package/dist/esm/{onboard-M5C6TFWE.js.map → onboard-TYB4QZE4.js.map} +0 -0
- /package/dist/esm/{origins-XG6O5K27.js.map → origins-EVVF3N4G.js.map} +0 -0
- /package/dist/esm/{report-error-FDDNOZAD.js.map → report-error-BR7ETMF7.js.map} +0 -0
- /package/dist/esm/{server-Q4W2J7OE.js.map → server-WJH536CN.js.map} +0 -0
- /package/dist/esm/{settings-RLSKK5RM.js.map → settings-SBL7WIBQ.js.map} +0 -0
- /package/dist/esm/{try-UYLQPTBJ.js.map → try-2P5ZRXRT.js.map} +0 -0
- /package/dist/esm/{wallet-QOS3FPSF.js.map → wallet-PY4ZDHNZ.js.map} +0 -0
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveOrigin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O57QVTLM.js";
|
|
4
4
|
import {
|
|
5
5
|
installSkills
|
|
6
6
|
} from "./chunk-FVVSNDQR.js";
|
|
7
7
|
import {
|
|
8
8
|
addUserOrigin
|
|
9
9
|
} from "./chunk-YIU364NZ.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-K3WB4R2P.js";
|
|
11
|
+
import "./chunk-W37JKCLN.js";
|
|
12
12
|
import "./chunk-KVSTJRSJ.js";
|
|
13
13
|
import "./chunk-FB5CMO3J.js";
|
|
14
14
|
import "./chunk-U6FRXL3X.js";
|
|
15
|
-
import {
|
|
16
|
-
errorResponse,
|
|
17
|
-
outputAndExit,
|
|
18
|
-
successResponse
|
|
19
|
-
} from "./chunk-7EBJ4BCH.js";
|
|
20
15
|
import {
|
|
21
16
|
safeMkdir,
|
|
22
17
|
safeMkdtemp,
|
|
23
18
|
safeRm,
|
|
24
19
|
safeWriteFile
|
|
25
20
|
} from "./chunk-QZCSZB7E.js";
|
|
26
|
-
import
|
|
21
|
+
import {
|
|
22
|
+
errorResponse,
|
|
23
|
+
outputAndExit,
|
|
24
|
+
successResponse
|
|
25
|
+
} from "./chunk-7EBJ4BCH.js";
|
|
26
|
+
import "./chunk-YPFBBTA2.js";
|
|
27
27
|
import "./chunk-YWNBUUBR.js";
|
|
28
28
|
import "./chunk-ITCDZXBZ.js";
|
|
29
29
|
|
|
@@ -97,4 +97,4 @@ var addSkillCommand = async (input) => {
|
|
|
97
97
|
export {
|
|
98
98
|
addSkillCommand
|
|
99
99
|
};
|
|
100
|
-
//# sourceMappingURL=add-skill-
|
|
100
|
+
//# sourceMappingURL=add-skill-5HFBHQTQ.js.map
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bridge,
|
|
3
3
|
bridgeSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MKA2PTOE.js";
|
|
5
5
|
import {
|
|
6
6
|
DESCRIPTIONS
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-W37JKCLN.js";
|
|
8
|
+
import "./chunk-RAS5DZPQ.js";
|
|
9
9
|
import {
|
|
10
10
|
getWalletOrExit
|
|
11
11
|
} from "./chunk-7AT3NXJ2.js";
|
|
12
12
|
import "./chunk-F3KGAMIA.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-HTGTKVXB.js";
|
|
14
14
|
import "./chunk-KVSTJRSJ.js";
|
|
15
15
|
import "./chunk-U6FRXL3X.js";
|
|
16
|
+
import "./chunk-QZCSZB7E.js";
|
|
16
17
|
import {
|
|
17
18
|
errorResponse,
|
|
18
19
|
fromNeverthrowError,
|
|
19
20
|
outputAndExit,
|
|
20
21
|
successResponse
|
|
21
22
|
} from "./chunk-7EBJ4BCH.js";
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-TTAO2EJK.js";
|
|
23
|
+
import "./chunk-YPFBBTA2.js";
|
|
24
24
|
import "./chunk-YWNBUUBR.js";
|
|
25
25
|
import "./chunk-ITCDZXBZ.js";
|
|
26
26
|
|
|
@@ -54,4 +54,4 @@ var bridgeCommand = async (args) => {
|
|
|
54
54
|
export {
|
|
55
55
|
bridgeCommand
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=bridge-
|
|
57
|
+
//# sourceMappingURL=bridge-BOLVXKCD.js.map
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
} from "./chunk-5CMVFNXO.js";
|
|
4
4
|
import {
|
|
5
5
|
cliRequestSchema
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-2C7X7XIG.js";
|
|
7
|
+
import "./chunk-SLTRGQ7W.js";
|
|
8
|
+
import "./chunk-W37JKCLN.js";
|
|
9
9
|
import "./chunk-IKPLMFAK.js";
|
|
10
10
|
import {
|
|
11
11
|
RequestMethod
|
|
@@ -14,16 +14,16 @@ import {
|
|
|
14
14
|
getWalletOrExit
|
|
15
15
|
} from "./chunk-7AT3NXJ2.js";
|
|
16
16
|
import "./chunk-F3KGAMIA.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-HTGTKVXB.js";
|
|
18
18
|
import "./chunk-KVSTJRSJ.js";
|
|
19
19
|
import "./chunk-FB5CMO3J.js";
|
|
20
|
+
import "./chunk-QZCSZB7E.js";
|
|
20
21
|
import {
|
|
21
22
|
errorResponse,
|
|
22
23
|
outputAndExit,
|
|
23
24
|
successResponse
|
|
24
25
|
} from "./chunk-7EBJ4BCH.js";
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-TTAO2EJK.js";
|
|
26
|
+
import "./chunk-YPFBBTA2.js";
|
|
27
27
|
import "./chunk-YWNBUUBR.js";
|
|
28
28
|
import "./chunk-ITCDZXBZ.js";
|
|
29
29
|
|
|
@@ -69,4 +69,4 @@ var checkCommand = async (args) => {
|
|
|
69
69
|
export {
|
|
70
70
|
checkCommand
|
|
71
71
|
};
|
|
72
|
-
//# sourceMappingURL=check-
|
|
72
|
+
//# sourceMappingURL=check-FEWY37RD.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
coreRequestSchema,
|
|
3
3
|
fetchShape
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SLTRGQ7W.js";
|
|
5
5
|
import {
|
|
6
6
|
REQUEST_PARAMS
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-W37JKCLN.js";
|
|
8
8
|
|
|
9
9
|
// src/shared/request/schemas/cli.ts
|
|
10
10
|
import z from "zod";
|
|
@@ -46,4 +46,4 @@ export {
|
|
|
46
46
|
cliRequestSchema,
|
|
47
47
|
cliFetchRequestSchema
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-2C7X7XIG.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
safeFetch,
|
|
6
6
|
safeFetchJson
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RAS5DZPQ.js";
|
|
8
8
|
import {
|
|
9
9
|
safeMkdir,
|
|
10
10
|
safeMkdtemp,
|
|
@@ -163,4 +163,4 @@ async function installGitHubSkill(surface, source, options) {
|
|
|
163
163
|
export {
|
|
164
164
|
installGitHubSkill
|
|
165
165
|
};
|
|
166
|
-
//# sourceMappingURL=chunk-
|
|
166
|
+
//# sourceMappingURL=chunk-2E4ZDG2M.js.map
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-ISF2WVEZ.js";
|
|
4
4
|
import {
|
|
5
5
|
getBalance
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EM6OE6WL.js";
|
|
7
7
|
import {
|
|
8
8
|
Network
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HTGTKVXB.js";
|
|
10
10
|
import {
|
|
11
11
|
getBaseUrl,
|
|
12
12
|
getDepositLink
|
|
@@ -90,4 +90,4 @@ export {
|
|
|
90
90
|
getBalances,
|
|
91
91
|
listAccountsWithBalances
|
|
92
92
|
};
|
|
93
|
-
//# sourceMappingURL=chunk-
|
|
93
|
+
//# sourceMappingURL=chunk-4MCPQDKM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shared/settings.ts","../../src/operations/fetch/types.ts"],"sourcesContent":["import z from 'zod';\nimport fs from 'fs';\n\nimport { configFile } from './fs';\n\nconst SETTINGS_FILE = configFile('settings.json');\n\nconst settingsSchema = z\n .object({\n maxAmount: z.number().positive(),\n })\n .partial();\n\ntype Settings = z.infer<typeof settingsSchema>;\n\nexport const getSettings = (): Settings => {\n if (!fs.existsSync(SETTINGS_FILE)) {\n return {};\n }\n\n const content = fs.readFileSync(SETTINGS_FILE, 'utf-8');\n const result = settingsSchema.safeParse(JSON.parse(content));\n if (!result.success) {\n return {};\n }\n return result.data;\n};\n\nexport const setSettings = (settings: Settings) => {\n const existing = getSettings();\n const newSettings = settingsSchema.parse({ ...existing, ...settings });\n fs.writeFileSync(SETTINGS_FILE, JSON.stringify(newSettings, null, 2));\n};\n","import type { GlobalFlags } from '@/types';\nimport type { Wallets } from '@/wallet';\nimport type { PaymentProtocol } from '@/shared/protocols/types';\nimport type z from 'zod';\nimport type { fetchShape } from '@/shared/request/schemas/core';\nimport type { Network } from '@agentcash/networks';\n\n// Type aliases (not interfaces) so PaymentInfo remains assignable to\n// JsonStringifyValue in successResponse — interfaces are augmentable and\n// therefore not assignable to index-signature types.\n/* eslint-disable @typescript-eslint/consistent-type-definitions */\ntype SettledPayment = { success: boolean; transactionHash: string };\n\ntype ChannelPayment = { success: boolean; channelId: string };\n\ntype PaymentInfo = {\n protocol: PaymentProtocol;\n price: string;\n network: Network;\n payment: SettledPayment | ChannelPayment | null;\n};\n/* eslint-enable @typescript-eslint/consistent-type-definitions */\n\nexport interface ExecuteFetchResult {\n response: Response;\n paymentInfo: PaymentInfo | null;\n}\n\n/** Default max amount (in USD/USDC) allowed without explicit opt-in. */\nexport const DEFAULT_MAX_AMOUNT = 5;\n\nexport interface ExecuteFetchOptions {\n surface: string;\n wallets: Wallets;\n flags: GlobalFlags;\n params: z.infer<z.ZodObject<typeof fetchShape>>;\n}\n"],"mappings":";;;;;AAAA,OAAO,OAAO;AACd,OAAO,QAAQ;AAIf,IAAM,gBAAgB,WAAW,eAAe;AAEhD,IAAM,iBAAiB,EACpB,OAAO;AAAA,EACN,WAAW,EAAE,OAAO,EAAE,SAAS;AACjC,CAAC,EACA,QAAQ;AAIJ,IAAM,cAAc,MAAgB;AACzC,MAAI,CAAC,GAAG,WAAW,aAAa,GAAG;AACjC,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,UAAU,GAAG,aAAa,eAAe,OAAO;AACtD,QAAM,SAAS,eAAe,UAAU,KAAK,MAAM,OAAO,CAAC;AAC3D,MAAI,CAAC,OAAO,SAAS;AACnB,WAAO,CAAC;AAAA,EACV;AACA,SAAO,OAAO;AAChB;AAEO,IAAM,cAAc,CAAC,aAAuB;AACjD,QAAM,WAAW,YAAY;AAC7B,QAAM,cAAc,eAAe,MAAM,EAAE,GAAG,UAAU,GAAG,SAAS,CAAC;AACrE,KAAG,cAAc,eAAe,KAAK,UAAU,aAAa,MAAM,CAAC,CAAC;AACtE;;;ACHO,IAAM,qBAAqB;","names":[]}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-27DZCYDB.js";
|
|
7
7
|
import {
|
|
8
8
|
INSTALL_PACKAGE_SPECIFIER
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ULB5PPKW.js";
|
|
10
10
|
import {
|
|
11
11
|
log,
|
|
12
12
|
safeReadFile,
|
|
@@ -628,4 +628,4 @@ export {
|
|
|
628
628
|
tryAddServer,
|
|
629
629
|
addServer
|
|
630
630
|
};
|
|
631
|
-
//# sourceMappingURL=chunk-
|
|
631
|
+
//# sourceMappingURL=chunk-5MITNOWT.js.map
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-ISF2WVEZ.js";
|
|
5
5
|
import {
|
|
6
6
|
safeFetchJson
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RAS5DZPQ.js";
|
|
8
8
|
import {
|
|
9
9
|
optionalNetworkSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HTGTKVXB.js";
|
|
11
11
|
import {
|
|
12
12
|
getBaseUrl
|
|
13
13
|
} from "./chunk-U6FRXL3X.js";
|
|
@@ -87,4 +87,4 @@ var redeemInviteCode = async (surface, args, globalArgs, wallets) => {
|
|
|
87
87
|
export {
|
|
88
88
|
redeemInviteCode
|
|
89
89
|
};
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-BIO4Y27B.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-BIO4Y27B.js";
|
|
7
7
|
import {
|
|
8
8
|
EVM_CONFIGS,
|
|
9
9
|
getTxExplorerUrl
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HTGTKVXB.js";
|
|
11
11
|
import {
|
|
12
12
|
getDepositLink
|
|
13
13
|
} from "./chunk-U6FRXL3X.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-C7B6LEPE.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
safeFetchJson
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RAS5DZPQ.js";
|
|
4
4
|
import {
|
|
5
5
|
ALL_NETWORK_CONFIGS,
|
|
6
6
|
EVM_CONFIGS,
|
|
7
7
|
ethereumAddressSchema,
|
|
8
8
|
networkSchema,
|
|
9
9
|
solanaAddressSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HTGTKVXB.js";
|
|
11
11
|
import {
|
|
12
12
|
getBaseUrl
|
|
13
13
|
} from "./chunk-U6FRXL3X.js";
|
|
@@ -59,4 +59,4 @@ var getBalance = async (surface, input, flags) => {
|
|
|
59
59
|
export {
|
|
60
60
|
getBalance
|
|
61
61
|
};
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-EM6OE6WL.js.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EVM_CONFIGS
|
|
3
|
+
} from "./chunk-HTGTKVXB.js";
|
|
4
|
+
import {
|
|
5
|
+
err,
|
|
6
|
+
ok,
|
|
7
|
+
resultFromPromise,
|
|
8
|
+
resultFromThrowable
|
|
9
|
+
} from "./chunk-YWNBUUBR.js";
|
|
10
|
+
|
|
11
|
+
// src/shared/protocols/mpp/index.ts
|
|
12
|
+
import { Challenge, Receipt } from "mppx";
|
|
13
|
+
import { Methods } from "mppx/tempo";
|
|
14
|
+
import { Mppx, tempo as tempoMethod } from "mppx/client";
|
|
15
|
+
import { createClient, http } from "viem";
|
|
16
|
+
var errorType = "mpp";
|
|
17
|
+
var mppOk = (value) => ok(value);
|
|
18
|
+
var mppErr = (surface, error) => err(errorType, surface, error);
|
|
19
|
+
var formatErrMsg = (e, prefix) => {
|
|
20
|
+
const msg = e instanceof Error ? e.message : typeof e === "string" ? e : String(e);
|
|
21
|
+
return prefix ? `${prefix}: ${msg}` : msg;
|
|
22
|
+
};
|
|
23
|
+
var sessionRequestFailedErr = (e, prefix) => ({
|
|
24
|
+
cause: "mpp_session_request_failed",
|
|
25
|
+
message: formatErrMsg(e, prefix)
|
|
26
|
+
});
|
|
27
|
+
var sessionCloseFailedErr = (e, prefix) => ({
|
|
28
|
+
cause: "mpp_session_close_failed",
|
|
29
|
+
message: formatErrMsg(e, prefix)
|
|
30
|
+
});
|
|
31
|
+
var mppResultFromPromise = (surface, promise, error) => resultFromPromise(errorType, surface, promise, error);
|
|
32
|
+
var mppResultFromThrowable = (surface, fn, error) => resultFromThrowable(errorType, surface, fn, error);
|
|
33
|
+
var createTempoClient = () => createClient({
|
|
34
|
+
chain: EVM_CONFIGS["tempo" /* TEMPO */].chain,
|
|
35
|
+
transport: http(EVM_CONFIGS["tempo" /* TEMPO */].rpcUrl)
|
|
36
|
+
});
|
|
37
|
+
var assertTempoUsdc = (surface, tokenAddress) => {
|
|
38
|
+
const expected = EVM_CONFIGS["tempo" /* TEMPO */].usdcAddress;
|
|
39
|
+
if (tokenAddress.toLowerCase() === expected.toLowerCase()) {
|
|
40
|
+
return mppOk(true);
|
|
41
|
+
}
|
|
42
|
+
return mppErr(surface, {
|
|
43
|
+
cause: "unsupported_token",
|
|
44
|
+
message: `Endpoint requires payment in token ${tokenAddress} on Tempo, but agentcash only supports ${expected}. The endpoint may be configured for a different token (e.g. PathUSD vs USDC).`
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var safeGetMppChallenge = (surface, response) => {
|
|
48
|
+
return mppResultFromThrowable(
|
|
49
|
+
surface,
|
|
50
|
+
() => Challenge.fromResponse(response, {
|
|
51
|
+
methods: [Methods.charge, Methods.session]
|
|
52
|
+
}),
|
|
53
|
+
(error) => ({
|
|
54
|
+
cause: "parse_mpp_challenge",
|
|
55
|
+
message: error instanceof Error ? error.message : "Failed to parse MPP challenge from response"
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
var safeCreateMppCredential = (surface, wallets, response) => {
|
|
60
|
+
const client = Mppx.create({
|
|
61
|
+
polyfill: false,
|
|
62
|
+
methods: [
|
|
63
|
+
tempoMethod({
|
|
64
|
+
account: wallets.evm,
|
|
65
|
+
getClient: createTempoClient
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
return mppResultFromPromise(
|
|
70
|
+
surface,
|
|
71
|
+
client.createCredential(response),
|
|
72
|
+
(error) => ({
|
|
73
|
+
cause: "create_mpp_credential",
|
|
74
|
+
message: error instanceof Error ? error.message : "Failed to create MPP credential"
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
var safeGetMppReceipt = (surface, response) => {
|
|
79
|
+
return mppResultFromThrowable(
|
|
80
|
+
surface,
|
|
81
|
+
() => Receipt.fromResponse(response),
|
|
82
|
+
(error) => ({
|
|
83
|
+
cause: "parse_mpp_receipt",
|
|
84
|
+
message: error instanceof Error ? error.message : "Failed to parse MPP receipt from response"
|
|
85
|
+
})
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
mppOk,
|
|
91
|
+
mppErr,
|
|
92
|
+
sessionRequestFailedErr,
|
|
93
|
+
sessionCloseFailedErr,
|
|
94
|
+
mppResultFromPromise,
|
|
95
|
+
mppResultFromThrowable,
|
|
96
|
+
createTempoClient,
|
|
97
|
+
assertTempoUsdc,
|
|
98
|
+
safeGetMppChallenge,
|
|
99
|
+
safeCreateMppCredential,
|
|
100
|
+
safeGetMppReceipt
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=chunk-FBGNOXFP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shared/protocols/mpp/index.ts"],"sourcesContent":["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 { type Address, createClient, http } from 'viem';\n\nimport { EVM_CONFIGS, Network } from '@agentcash/networks';\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 formatErrMsg = (e: unknown, prefix?: string) => {\n const msg =\n e instanceof Error ? e.message : typeof e === 'string' ? e : String(e);\n return prefix ? `${prefix}: ${msg}` : msg;\n};\n\nexport const sessionRequestFailedErr = (e: unknown, prefix?: string) => ({\n cause: 'mpp_session_request_failed' as const,\n message: formatErrMsg(e, prefix),\n});\n\nexport const sessionCloseFailedErr = (e: unknown, prefix?: string) => ({\n cause: 'mpp_session_close_failed' as const,\n message: formatErrMsg(e, prefix),\n});\n\nexport const mppResultFromPromise = <T>(\n surface: string,\n promise: Promise<T>,\n error: (e: unknown) => BaseMppError\n) => resultFromPromise(errorType, surface, promise, error);\n\nexport const mppResultFromThrowable = <T>(\n surface: string,\n fn: () => T,\n error: (e: unknown) => BaseMppError\n) => resultFromThrowable(errorType, surface, fn, error);\n\nexport const createTempoClient = () =>\n createClient({\n chain: EVM_CONFIGS[Network.TEMPO].chain,\n transport: http(EVM_CONFIGS[Network.TEMPO].rpcUrl),\n });\n\nexport const assertTempoUsdc = (surface: string, tokenAddress: Address) => {\n const expected = EVM_CONFIGS[Network.TEMPO].usdcAddress;\n if (tokenAddress.toLowerCase() === expected.toLowerCase()) {\n return mppOk(true);\n }\n return mppErr(surface, {\n cause: 'unsupported_token',\n message: `Endpoint requires payment in token ${tokenAddress} on Tempo, but agentcash only supports ${expected}. The endpoint may be configured for a different token (e.g. PathUSD vs USDC).`,\n });\n};\n\nexport const safeGetMppChallenge = (surface: string, response: Response) => {\n return mppResultFromThrowable(\n surface,\n () =>\n Challenge.fromResponse(response, {\n methods: [Methods.charge, Methods.session],\n }),\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 client = Mppx.create({\n polyfill: false,\n methods: [\n tempoMethod({\n account: wallets.evm,\n getClient: createTempoClient,\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"],"mappings":";;;;;;;;;;;AAAA,SAAS,WAAW,eAAe;AACnC,SAAS,eAAe;AAQxB,SAAS,MAAM,SAAS,mBAAmB;AAE3C,SAAuB,cAAc,YAAY;AAOjD,IAAM,YAAY;AAEX,IAAM,QAAQ,CAAI,UAAa,GAAG,KAAK;AACvC,IAAM,SAAS,CAAC,SAAiB,UACtC,IAAI,WAAW,SAAS,KAAK;AAE/B,IAAM,eAAe,CAAC,GAAY,WAAoB;AACpD,QAAM,MACJ,aAAa,QAAQ,EAAE,UAAU,OAAO,MAAM,WAAW,IAAI,OAAO,CAAC;AACvE,SAAO,SAAS,GAAG,MAAM,KAAK,GAAG,KAAK;AACxC;AAEO,IAAM,0BAA0B,CAAC,GAAY,YAAqB;AAAA,EACvE,OAAO;AAAA,EACP,SAAS,aAAa,GAAG,MAAM;AACjC;AAEO,IAAM,wBAAwB,CAAC,GAAY,YAAqB;AAAA,EACrE,OAAO;AAAA,EACP,SAAS,aAAa,GAAG,MAAM;AACjC;AAEO,IAAM,uBAAuB,CAClC,SACA,SACA,UACG,kBAAkB,WAAW,SAAS,SAAS,KAAK;AAElD,IAAM,yBAAyB,CACpC,SACA,IACA,UACG,oBAAoB,WAAW,SAAS,IAAI,KAAK;AAE/C,IAAM,oBAAoB,MAC/B,aAAa;AAAA,EACX,OAAO,+BAAyB,EAAE;AAAA,EAClC,WAAW,KAAK,+BAAyB,EAAE,MAAM;AACnD,CAAC;AAEI,IAAM,kBAAkB,CAAC,SAAiB,iBAA0B;AACzE,QAAM,WAAW,+BAAyB,EAAE;AAC5C,MAAI,aAAa,YAAY,MAAM,SAAS,YAAY,GAAG;AACzD,WAAO,MAAM,IAAI;AAAA,EACnB;AACA,SAAO,OAAO,SAAS;AAAA,IACrB,OAAO;AAAA,IACP,SAAS,sCAAsC,YAAY,0CAA0C,QAAQ;AAAA,EAC/G,CAAC;AACH;AAEO,IAAM,sBAAsB,CAAC,SAAiB,aAAuB;AAC1E,SAAO;AAAA,IACL;AAAA,IACA,MACE,UAAU,aAAa,UAAU;AAAA,MAC/B,SAAS,CAAC,QAAQ,QAAQ,QAAQ,OAAO;AAAA,IAC3C,CAAC;AAAA,IACH,YAAU;AAAA,MACR,OAAO;AAAA,MACP,SACE,iBAAiB,QACb,MAAM,UACN;AAAA,IACR;AAAA,EACF;AACF;AAEO,IAAM,0BAA0B,CACrC,SACA,SACA,aACG;AACH,QAAM,SAAS,KAAK,OAAO;AAAA,IACzB,UAAU;AAAA,IACV,SAAS;AAAA,MACP,YAAY;AAAA,QACV,SAAS,QAAQ;AAAA,QACjB,WAAW;AAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA,OAAO,iBAAiB,QAAQ;AAAA,IAChC,YAAU;AAAA,MACR,OAAO;AAAA,MACP,SACE,iBAAiB,QACb,MAAM,UACN;AAAA,IACR;AAAA,EACF;AACF;AAEO,IAAM,oBAAoB,CAAC,SAAiB,aAAuB;AACxE,SAAO;AAAA,IACL;AAAA,IACA,MAAM,QAAQ,aAAa,QAAQ;AAAA,IACnC,YAAU;AAAA,MACR,OAAO;AAAA,MACP,SACE,iBAAiB,QACb,MAAM,UACN;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
|