@intent-engine/cli 0.1.22 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/dist/src/admin-commands.d.ts +12 -0
  2. package/dist/src/admin-commands.js +140 -0
  3. package/dist/src/admin-commands.js.map +1 -0
  4. package/dist/src/agent/actions.d.ts +2 -0
  5. package/dist/src/agent/actions.js +1 -1
  6. package/dist/src/agent/actions.js.map +1 -1
  7. package/dist/src/agent/claims.js +13 -12
  8. package/dist/src/agent/claims.js.map +1 -1
  9. package/dist/src/agent/create.d.ts +1 -0
  10. package/dist/src/agent/create.js +18 -4
  11. package/dist/src/agent/create.js.map +1 -1
  12. package/dist/src/agent/mandate-agent.d.ts +2 -0
  13. package/dist/src/agent/mandate-agent.js +136 -0
  14. package/dist/src/agent/mandate-agent.js.map +1 -0
  15. package/dist/src/agent/mandate-grant.d.ts +2 -0
  16. package/dist/src/agent/mandate-grant.js +192 -0
  17. package/dist/src/agent/mandate-grant.js.map +1 -0
  18. package/dist/src/agent/mandate-revoke.d.ts +1 -0
  19. package/dist/src/agent/mandate-revoke.js +142 -0
  20. package/dist/src/agent/mandate-revoke.js.map +1 -0
  21. package/dist/src/agent/mandate-state.d.ts +33 -0
  22. package/dist/src/agent/mandate-state.js +85 -0
  23. package/dist/src/agent/mandate-state.js.map +1 -0
  24. package/dist/src/agent/mandate.d.ts +4 -26
  25. package/dist/src/agent/mandate.js +4 -479
  26. package/dist/src/agent/mandate.js.map +1 -1
  27. package/dist/src/agent/mcp.js +10 -5
  28. package/dist/src/agent/mcp.js.map +1 -1
  29. package/dist/src/agent/prepare.js +1 -1
  30. package/dist/src/agent/prepare.js.map +1 -1
  31. package/dist/src/agent/problems.d.ts +15 -1
  32. package/dist/src/agent/problems.js +38 -2
  33. package/dist/src/agent/problems.js.map +1 -1
  34. package/dist/src/agent/read.d.ts +13 -0
  35. package/dist/src/agent/read.js +56 -7
  36. package/dist/src/agent/read.js.map +1 -1
  37. package/dist/src/agent/registry.js +8 -2
  38. package/dist/src/agent/registry.js.map +1 -1
  39. package/dist/src/agent/relay.d.ts +2 -0
  40. package/dist/src/agent/relay.js +11 -3
  41. package/dist/src/agent/relay.js.map +1 -1
  42. package/dist/src/agent/sales.d.ts +29 -0
  43. package/dist/src/agent/sales.js +248 -0
  44. package/dist/src/agent/sales.js.map +1 -0
  45. package/dist/src/agent/signed-prepare.d.ts +1 -0
  46. package/dist/src/agent/signed-prepare.js +141 -0
  47. package/dist/src/agent/signed-prepare.js.map +1 -0
  48. package/dist/src/agent/signed-relay.d.ts +25 -0
  49. package/dist/src/agent/signed-relay.js +68 -0
  50. package/dist/src/agent/signed-relay.js.map +1 -0
  51. package/dist/src/agent/signed-submit.d.ts +2 -0
  52. package/dist/src/agent/signed-submit.js +137 -0
  53. package/dist/src/agent/signed-submit.js.map +1 -0
  54. package/dist/src/agent/signed-terms.d.ts +85 -0
  55. package/dist/src/agent/signed-terms.js +84 -0
  56. package/dist/src/agent/signed-terms.js.map +1 -0
  57. package/dist/src/agent/signed.d.ts +4 -13
  58. package/dist/src/agent/signed.js +4 -361
  59. package/dist/src/agent/signed.js.map +1 -1
  60. package/dist/src/agent/wallet/account.d.ts +4 -0
  61. package/dist/src/agent/wallet/account.js +84 -0
  62. package/dist/src/agent/wallet/account.js.map +1 -0
  63. package/dist/src/agent/wallet/attest.d.ts +4 -0
  64. package/dist/src/agent/wallet/attest.js +178 -0
  65. package/dist/src/agent/wallet/attest.js.map +1 -0
  66. package/dist/src/agent/wallet/delivery.d.ts +13 -0
  67. package/dist/src/agent/wallet/delivery.js +171 -0
  68. package/dist/src/agent/wallet/delivery.js.map +1 -0
  69. package/dist/src/agent/wallet/escrow.d.ts +7 -0
  70. package/dist/src/agent/wallet/escrow.js +164 -0
  71. package/dist/src/agent/wallet/escrow.js.map +1 -0
  72. package/dist/src/agent/wallet/fills.d.ts +27 -0
  73. package/dist/src/agent/wallet/fills.js +80 -0
  74. package/dist/src/agent/wallet/fills.js.map +1 -0
  75. package/dist/src/agent/wallet/guard.d.ts +57 -0
  76. package/dist/src/agent/wallet/guard.js +205 -0
  77. package/dist/src/agent/wallet/guard.js.map +1 -0
  78. package/dist/src/agent/wallet/offer.d.ts +50 -0
  79. package/dist/src/agent/wallet/offer.js +80 -0
  80. package/dist/src/agent/wallet/offer.js.map +1 -0
  81. package/dist/src/agent/wallet/receipt.d.ts +42 -0
  82. package/dist/src/agent/wallet/receipt.js +102 -0
  83. package/dist/src/agent/wallet/receipt.js.map +1 -0
  84. package/dist/src/agent/wallet/record.d.ts +31 -0
  85. package/dist/src/agent/wallet/record.js +178 -0
  86. package/dist/src/agent/wallet/record.js.map +1 -0
  87. package/dist/src/agent/wallet/releases.d.ts +40 -0
  88. package/dist/src/agent/wallet/releases.js +236 -0
  89. package/dist/src/agent/wallet/releases.js.map +1 -0
  90. package/dist/src/agent/wallet/split.d.ts +10 -0
  91. package/dist/src/agent/wallet/split.js +271 -0
  92. package/dist/src/agent/wallet/split.js.map +1 -0
  93. package/dist/src/agent/wallet/trade.d.ts +14 -0
  94. package/dist/src/agent/wallet/trade.js +243 -0
  95. package/dist/src/agent/wallet/trade.js.map +1 -0
  96. package/dist/src/agent/wallet/wait.d.ts +5 -0
  97. package/dist/src/agent/wallet/wait.js +99 -0
  98. package/dist/src/agent/wallet/wait.js.map +1 -0
  99. package/dist/src/agent/wallet.d.ts +18 -72
  100. package/dist/src/agent/wallet.js +26 -1216
  101. package/dist/src/agent/wallet.js.map +1 -1
  102. package/dist/src/arg-options.d.ts +333 -0
  103. package/dist/src/arg-options.js +310 -0
  104. package/dist/src/arg-options.js.map +1 -0
  105. package/dist/src/arg-usage.d.ts +7 -0
  106. package/dist/src/arg-usage.js +53 -0
  107. package/dist/src/arg-usage.js.map +1 -0
  108. package/dist/src/arg-values.d.ts +47 -0
  109. package/dist/src/arg-values.js +280 -0
  110. package/dist/src/arg-values.js.map +1 -0
  111. package/dist/src/args.d.ts +7 -487
  112. package/dist/src/args.js +89 -880
  113. package/dist/src/args.js.map +1 -1
  114. package/dist/src/artifact.d.ts +22 -0
  115. package/dist/src/artifact.js +89 -0
  116. package/dist/src/artifact.js.map +1 -0
  117. package/dist/src/check-process.d.ts +39 -0
  118. package/dist/src/check-process.js +338 -0
  119. package/dist/src/check-process.js.map +1 -0
  120. package/dist/src/command-builders.d.ts +37 -0
  121. package/dist/src/command-builders.js +216 -0
  122. package/dist/src/command-builders.js.map +1 -0
  123. package/dist/src/command-types.d.ts +227 -0
  124. package/dist/src/command-types.js +2 -0
  125. package/dist/src/command-types.js.map +1 -0
  126. package/dist/src/commands.d.ts +7 -43
  127. package/dist/src/commands.js +67 -426
  128. package/dist/src/commands.js.map +1 -1
  129. package/dist/src/event-feed.d.ts +13 -0
  130. package/dist/src/event-feed.js +46 -0
  131. package/dist/src/event-feed.js.map +1 -0
  132. package/dist/src/flow-commands.d.ts +8 -0
  133. package/dist/src/flow-commands.js +116 -0
  134. package/dist/src/flow-commands.js.map +1 -0
  135. package/dist/src/flows.d.ts +6 -0
  136. package/dist/src/flows.js +84 -10
  137. package/dist/src/flows.js.map +1 -1
  138. package/dist/src/job-commands.d.ts +9 -0
  139. package/dist/src/job-commands.js +89 -0
  140. package/dist/src/job-commands.js.map +1 -0
  141. package/dist/src/judge-errors.d.ts +12 -0
  142. package/dist/src/judge-errors.js +16 -0
  143. package/dist/src/judge-errors.js.map +1 -0
  144. package/dist/src/judge.d.ts +28 -0
  145. package/dist/src/judge.js +169 -0
  146. package/dist/src/judge.js.map +1 -0
  147. package/dist/src/main.d.ts +4 -1
  148. package/dist/src/main.js +26 -10
  149. package/dist/src/main.js.map +1 -1
  150. package/dist/src/order-builders.d.ts +10 -0
  151. package/dist/src/order-builders.js +172 -0
  152. package/dist/src/order-builders.js.map +1 -0
  153. package/dist/src/render.d.ts +1 -0
  154. package/dist/src/render.js +9 -0
  155. package/dist/src/render.js.map +1 -1
  156. package/dist/src/runtime.d.ts +22 -0
  157. package/dist/src/runtime.js +2 -0
  158. package/dist/src/runtime.js.map +1 -0
  159. package/dist/src/solve-commands.d.ts +25 -0
  160. package/dist/src/solve-commands.js +171 -0
  161. package/dist/src/solve-commands.js.map +1 -0
  162. package/dist/src/tokens.js +2 -1
  163. package/dist/src/tokens.js.map +1 -1
  164. package/dist/src/version.d.ts +1 -1
  165. package/dist/src/version.js +1 -1
  166. package/dist/src/wallet.d.ts +4 -1
  167. package/dist/src/wallet.js +25 -5
  168. package/dist/src/wallet.js.map +1 -1
  169. package/package.json +16 -7
  170. package/dist/src/events.d.ts +0 -8
  171. package/dist/src/events.js +0 -43
  172. package/dist/src/events.js.map +0 -1
  173. package/dist/src/transport.d.ts +0 -208
  174. package/dist/src/transport.js +0 -441
  175. package/dist/src/transport.js.map +0 -1
@@ -0,0 +1,137 @@
1
+ import { getPublicKeyFromAddress, verifySignature } from "@solana/kit";
2
+ import { buildEd25519Instruction, describeSignedIntent, formatAmount, findIntentPda, getIntentDecoder, signedIntentMessage, validate, } from "@intent-engine/core";
3
+ import { chainTime, clusterDomain, createdAccount, loadUser, mintOf, tokenAccountIfMissing } from "@intent-engine/client";
4
+ import { define } from "./actions.js";
5
+ import { tool } from "./names.js";
6
+ import { prepare } from "./prepare.js";
7
+ import { AgentRefusal } from "./problems.js";
8
+ import { createCost, rentFor, SIGNATURE_FEE, TOKEN_ACCOUNT_RENT_BYTES } from "./budget.js";
9
+ import { admitRelay } from "./relay.js";
10
+ import { enter } from "./claims.js";
11
+ import { paramsOf } from "./shapes.js";
12
+ import { tokenNames } from "../tokens.js";
13
+ import { account, amount, integer, list, nullable, object, text } from "./schema.js";
14
+ import { fieldsOf, published, publishedUrl, publishesLine, sameTerms, signatureBytes, signedTerms, SPEC_URL_UNSIGNED, } from "./signed-terms.js";
15
+ import { paying, preparedFits, RELAY_TOO_LARGE, relayCreate, relayFloor, refuseRepricing, SPEC_URL_TOO_LONG, } from "./signed-relay.js";
16
+ export const submitSignedIntent = define({
17
+ name: tool("submit_signed_intent"),
18
+ title: "Submit a signed intent",
19
+ description: `Relay an owner's signed intent: the relayer key this server was started with (--relayer) pays the fee and creates the intent on chain, within the relayer's limits: accepted input tokens and their minimum fee, lamport cost per intent and per hour, expiry, transaction size and intents per owner per hour. Pass the submit object from ${tool("prepare_signed_intent")} unchanged plus the owner's base58 signature of its message; ${tool("preview_signed_intent")} checks the same input first without sending. When submit carries a spec_url, the relayer also records it in a memo it signs with the create, so ${tool("find_jobs")} lists it; that url is not part of the owner's signature. Calling again after success returns the same intent without sending anything.`,
20
+ effect: "submit",
21
+ input: object({ ...signedTerms, signature: text("the owner's base58 Ed25519 signature of the message") }),
22
+ output: object({ intent: account(), signature: nullable(text("the relayed transaction's signature; null if it already existed")) }),
23
+ run: async ({ transport, relay, claims }, input, call) => {
24
+ if (relay === undefined) {
25
+ throw new AgentRefusal("RelayerNotConfigured", "this server has no relayer key; start it with --relayer to submit signed intents");
26
+ }
27
+ const leave = enter(claims, `${input.owner}:${input.nonce}`);
28
+ try {
29
+ return await relaySigned(transport, relay, input, call);
30
+ }
31
+ finally {
32
+ leave();
33
+ }
34
+ },
35
+ });
36
+ async function relaySigned(transport, relay, input, call) {
37
+ const params = validate(paramsOf(input.order));
38
+ const specUrl = await publishedUrl(transport, params, input.spec_url);
39
+ const outputToken = await mintOf(transport, input.output_mint);
40
+ const { config, inputToken, fields } = await fieldsOf(transport, input, params, outputToken.tokenProgram);
41
+ const [intent] = await findIntentPda({ owner: input.owner, nonce: input.nonce });
42
+ const existing = await createdAccount(transport, intent);
43
+ if (existing !== null) {
44
+ if (!sameTerms(getIntentDecoder().decode(existing.data), fields)) {
45
+ throw new AgentRefusal("NonceTaken", "a different intent already uses this owner's nonce; these signed terms can never be submitted");
46
+ }
47
+ return { intent, signature: null };
48
+ }
49
+ const floor = relayFloor(relay, input.input_mint);
50
+ if (input.relayer_fee < floor) {
51
+ throw new AgentRefusal("RelayFeeTooLow", `this relayer charges ${floor} raw units of ${input.input_mint} per intent; prepare and sign the intent again on this server`);
52
+ }
53
+ const message = await signedIntentMessage(fields);
54
+ const signature = signatureBytes(input.signature);
55
+ if (!(await verifySignature(await getPublicKeyFromAddress(input.owner), signature, message))) {
56
+ throw new AgentRefusal("SignatureInvalid", `the signature is not the owner's signature of these exact terms; sign the message from ${tool("prepare_signed_intent")} again`);
57
+ }
58
+ const feeAccount = input.relayer_fee === 0n
59
+ ? { create: [] }
60
+ : await tokenAccountIfMissing(transport, relay.signer, relay.signer.address, input.input_mint, inputToken.tokenProgram);
61
+ const relayed = [
62
+ buildEd25519Instruction({ publicKey: input.owner, signature, message }),
63
+ await relayCreate(input, relay, config, params, { input: inputToken.tokenProgram, output: outputToken.tokenProgram }),
64
+ ...published(relay.signer, specUrl),
65
+ ];
66
+ const now = await chainTime(transport);
67
+ let prepared = await prepare(transport, [...feeAccount.create, ...relayed], relay.signer.address);
68
+ const split = feeAccount.create.length !== 0 && !preparedFits(prepared);
69
+ const ticket = admitRelay(relay, input.owner, BigInt(config.createFee) + BigInt(config.crankBounty) + prepared.priorityLamports, createCost(config) +
70
+ prepared.priorityLamports +
71
+ (feeAccount.create.length > 0 ? rentFor(TOKEN_ACCOUNT_RENT_BYTES) : 0n) +
72
+ (split ? SIGNATURE_FEE + prepared.priorityLamports : 0n), input.expires_at, now);
73
+ const paid = { any: false };
74
+ call.undo.push(() => {
75
+ if (!paid.any) {
76
+ ticket.cancel();
77
+ }
78
+ });
79
+ const admitted = prepared.priorityLamports;
80
+ if (split) {
81
+ await paying(paid, transport.send(feeAccount.create, relay.signer));
82
+ prepared = await prepare(transport, relayed, relay.signer.address);
83
+ refuseRepricing(admitted, prepared.priorityLamports);
84
+ }
85
+ if (!preparedFits(prepared)) {
86
+ throw new AgentRefusal("RelayTooLarge", specUrl === undefined ? RELAY_TOO_LARGE : SPEC_URL_TOO_LONG);
87
+ }
88
+ return { intent, signature: await paying(paid, transport.send(prepared.instructions, relay.signer)) };
89
+ }
90
+ export const previewSignedIntent = define({
91
+ name: tool("preview_signed_intent"),
92
+ title: "Check a signed intent before relaying it",
93
+ description: `Verify an owner's signature over signed terms and describe what relaying them creates, without sending anything.`,
94
+ effect: "read",
95
+ input: object({ ...signedTerms, signature: text("the owner's base58 Ed25519 signature of the message") }),
96
+ output: object({
97
+ intent: account(),
98
+ exists: integer(0, 1, "1 if the intent is already on chain, else 0"),
99
+ relayer_fee: amount("raw input-token units the relayer receives"),
100
+ summary: list(text(), 32, "what relaying creates"),
101
+ warnings: list(text(), 16, "anything to check before relaying"),
102
+ }),
103
+ run: async ({ transport }, input) => {
104
+ const params = validate(paramsOf(input.order));
105
+ const specUrl = await publishedUrl(transport, params, input.spec_url);
106
+ const outputToken = await mintOf(transport, input.output_mint);
107
+ const { config, inputToken, fields } = await fieldsOf(transport, input, params, outputToken.tokenProgram);
108
+ const message = await signedIntentMessage(fields);
109
+ if (!(await verifySignature(await getPublicKeyFromAddress(input.owner), signatureBytes(input.signature), message))) {
110
+ throw new AgentRefusal("SignatureInvalid", "the signature is not the owner's signature of these exact terms");
111
+ }
112
+ const [intent] = await findIntentPda({ owner: input.owner, nonce: input.nonce });
113
+ const exists = (await createdAccount(transport, intent)) !== null;
114
+ const user = await loadUser(transport, input.owner);
115
+ const description = await describeSignedIntent(fields, {
116
+ now: await chainTime(transport),
117
+ currentEpoch: user?.epoch ?? 0n,
118
+ expectedDomain: await clusterDomain(transport),
119
+ outputTokenProgram: outputToken.tokenProgram,
120
+ inputDecimals: inputToken.decimals,
121
+ outputDecimals: outputToken.decimals,
122
+ ...tokenNames(fields.inputMint, fields.outputMint),
123
+ });
124
+ return {
125
+ intent,
126
+ exists: exists ? 1 : 0,
127
+ relayer_fee: input.relayer_fee,
128
+ summary: [
129
+ ...description.lines,
130
+ `Relaying costs you ${createCost(config)} lamports in create fee, crank bounty, rent and signature fee, plus any priority fee; you receive ${formatAmount(input.relayer_fee, inputToken.decimals)} of ${input.input_mint}`,
131
+ ...(specUrl === undefined ? [] : [publishesLine(specUrl)]),
132
+ ],
133
+ warnings: [...description.warnings, ...(specUrl === undefined ? [] : [SPEC_URL_UNSIGNED])],
134
+ };
135
+ },
136
+ });
137
+ //# sourceMappingURL=signed-submit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signed-submit.js","sourceRoot":"","sources":["../../../src/agent/signed-submit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,qBAAqB,EAAkB,MAAM,uBAAuB,CAAC;AAC1I,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAc,MAAM,YAAY,CAAC;AACpD,OAAO,EAAa,KAAK,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EACL,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,aAAa,EACb,SAAS,EACT,cAAc,EACd,WAAW,EAEX,iBAAiB,GAClB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;QACH,OAAO;YACL,MAAM;YACN,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACtB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,OAAO,EAAE;gBACP,GAAG,WAAW,CAAC,KAAK;gBACpB,sBAAsB,UAAU,CAAC,MAAM,CAAC,qGAAqG,YAAY,CAAC,KAAK,CAAC,WAAW,EAAE,UAAU,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,UAAU,EAAE;gBAC1N,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;aAC3D;YACD,QAAQ,EAAE,CAAC,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;SAC3F,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { type Address, type Instruction, type SignatureBytes, type TransactionSigner } from "@solana/kit";
2
+ import { type Intent, type IntentParams, type SignedIntentFields } from "@intent-engine/core";
3
+ import { type Transport } from "@intent-engine/client";
4
+ import { type Order } from "./shapes.js";
5
+ export declare const DEFAULT_SUBMIT_WITHIN: number;
6
+ export declare const MAX_SUBMIT_WITHIN: number;
7
+ export declare const signedTerms: {
8
+ owner: import("./schema.js").Schema<Address>;
9
+ input_mint: import("./schema.js").Schema<Address>;
10
+ output_mint: import("./schema.js").Schema<Address>;
11
+ order: import("./schema.js").Schema<({
12
+ kind: "attested";
13
+ } & {
14
+ amount_in: bigint;
15
+ min_result: bigint;
16
+ max_result: bigint;
17
+ attestor: Address;
18
+ } & {
19
+ spec_hash?: string;
20
+ judge_fee?: bigint;
21
+ }) | ({
22
+ kind: "dutch";
23
+ } & {
24
+ amount_in: bigint;
25
+ start_out: bigint;
26
+ end_out: bigint;
27
+ start_time: bigint;
28
+ end_time: bigint;
29
+ } & {}) | ({
30
+ kind: "limit";
31
+ } & {
32
+ make_amount: bigint;
33
+ take_amount: bigint;
34
+ } & {}) | ({
35
+ kind: "swap";
36
+ } & {
37
+ amount_in: bigint;
38
+ min_out: bigint;
39
+ } & {})>;
40
+ expires_at: import("./schema.js").Schema<bigint>;
41
+ nonce: import("./schema.js").Schema<bigint>;
42
+ submit_by: import("./schema.js").Schema<bigint>;
43
+ epoch: import("./schema.js").Schema<bigint>;
44
+ relayer_fee: import("./schema.js").Schema<bigint>;
45
+ partner: {
46
+ optional: import("./schema.js").Schema<{
47
+ account: Address;
48
+ bps: number;
49
+ } & {}>;
50
+ };
51
+ spec_url: {
52
+ optional: import("./schema.js").Schema<string>;
53
+ };
54
+ };
55
+ export type SignedTerms = {
56
+ owner: Address;
57
+ input_mint: Address;
58
+ output_mint: Address;
59
+ order: Order;
60
+ expires_at: bigint;
61
+ nonce: bigint;
62
+ submit_by: bigint;
63
+ epoch: bigint;
64
+ relayer_fee: bigint;
65
+ partner?: {
66
+ account: Address;
67
+ bps: number;
68
+ };
69
+ spec_url?: string;
70
+ };
71
+ export declare const SPEC_URL_UNSIGNED: string;
72
+ export declare const publishesLine: (url: string) => string;
73
+ export declare function publishedUrl(transport: Transport, params: IntentParams, url: string | undefined): Promise<string | undefined>;
74
+ export declare const published: (signer: TransactionSigner, url: string | undefined) => Instruction[];
75
+ export declare function fieldsOf(transport: Transport, t: SignedTerms, params: IntentParams, outputTokenProgram: Address): Promise<{
76
+ config: import("@intent-engine/core").Config;
77
+ inputToken: {
78
+ tokenProgram: Address;
79
+ decimals: number;
80
+ scaled: boolean;
81
+ };
82
+ fields: SignedIntentFields;
83
+ }>;
84
+ export declare function sameTerms(stored: Intent, fields: SignedIntentFields): boolean;
85
+ export declare function signatureBytes(text: string): SignatureBytes;
@@ -0,0 +1,84 @@
1
+ import { getBase58Encoder } from "@solana/kit";
2
+ import { createExt, encodeParams, findAssociatedTokenAddress, isMemoUrl, Kind, MEMO_URL_RULE, partnerOf, specMemo, } from "@intent-engine/core";
3
+ import { loadConfig, memoInstruction, mintOf, plainHttpOnPublic } from "@intent-engine/client";
4
+ import { tool } from "./names.js";
5
+ import { SPEC_URL_PLAIN } from "./create.js";
6
+ import { AgentRefusal } from "./problems.js";
7
+ import { orderSchema, partnerSchema } from "./shapes.js";
8
+ import { account, amount, InvalidInput, optional, text, time } from "./schema.js";
9
+ export const DEFAULT_SUBMIT_WITHIN = 60 * 60;
10
+ export const MAX_SUBMIT_WITHIN = 24 * 60 * 60;
11
+ const SIGNATURE_PATTERN = "^[1-9A-HJ-NP-Za-km-z]{64,88}$";
12
+ export const signedTerms = {
13
+ owner: account("the wallet that signs the message and sells"),
14
+ input_mint: account(),
15
+ output_mint: account(),
16
+ order: orderSchema,
17
+ expires_at: time(),
18
+ nonce: amount(),
19
+ submit_by: time("unix seconds after which the signature can no longer be submitted"),
20
+ epoch: amount("the owner's signing epoch the signature is bound to"),
21
+ relayer_fee: amount("raw input units the owner pays, from the same allowance, to whoever submits the signature"),
22
+ partner: optional(partnerSchema),
23
+ spec_url: optional(text(`where the acceptance spec is published, ${MEMO_URL_RULE}; the relayer records it in a memo it signs with the create. It is not part of the owner's signature`)),
24
+ };
25
+ export const SPEC_URL_UNSIGNED = `the spec url is not part of what the owner signs: the relayer publishes it in a memo it signs with the create, and a relayer could leave it out or change it; ${tool("find_jobs")} shows the url that was published`;
26
+ export const publishesLine = (url) => `Publishes: the acceptance spec's url ${url}, in a memo the relayer signs`;
27
+ export async function publishedUrl(transport, params, url) {
28
+ if (url === undefined) {
29
+ return undefined;
30
+ }
31
+ if (params.kind !== Kind.AttestedResult || params.specHash.every((b) => b === 0)) {
32
+ throw new InvalidInput([{ path: "spec_url", message: "needs an attested order with spec_hash" }]);
33
+ }
34
+ if (!isMemoUrl(url)) {
35
+ throw new InvalidInput([{ path: "spec_url", message: `must be ${MEMO_URL_RULE}` }]);
36
+ }
37
+ if (await plainHttpOnPublic(transport, url)) {
38
+ throw new InvalidInput([{ path: "spec_url", message: SPEC_URL_PLAIN }]);
39
+ }
40
+ return url;
41
+ }
42
+ export const published = (signer, url) => url === undefined ? [] : [memoInstruction(signer, specMemo(url))];
43
+ export async function fieldsOf(transport, t, params, outputTokenProgram) {
44
+ const { config } = await loadConfig(transport);
45
+ const inputToken = await mintOf(transport, t.input_mint);
46
+ const fields = {
47
+ domain: Uint8Array.from(config.domain),
48
+ owner: t.owner,
49
+ ownerInput: await findAssociatedTokenAddress({ owner: t.owner, mint: t.input_mint, tokenProgram: inputToken.tokenProgram }),
50
+ inputMint: t.input_mint,
51
+ outputMint: t.output_mint,
52
+ receiver: await findAssociatedTokenAddress({ owner: t.owner, mint: t.output_mint, tokenProgram: outputTokenProgram }),
53
+ nonce: t.nonce,
54
+ expiresAt: t.expires_at,
55
+ submitBy: t.submit_by,
56
+ kind: params.kind,
57
+ params: encodeParams(params),
58
+ epoch: t.epoch,
59
+ relayerFee: t.relayer_fee,
60
+ ext: createExt(t.partner === undefined ? {} : { partner: { key: t.partner.account, bps: t.partner.bps } }),
61
+ };
62
+ return { config, inputToken, fields };
63
+ }
64
+ export function sameTerms(stored, fields) {
65
+ const partner = partnerOf(fields.ext ?? new Uint8Array());
66
+ return (stored.inputMint === fields.inputMint &&
67
+ stored.outputMint === fields.outputMint &&
68
+ stored.receiver === fields.receiver &&
69
+ stored.expiresAt === fields.expiresAt &&
70
+ stored.kind === fields.kind &&
71
+ stored.flags === (fields.flags ?? 0) &&
72
+ stored.partnerBps === (partner?.bps ?? 0) &&
73
+ (partner === undefined || stored.partner === partner.key) &&
74
+ stored.params.length === fields.params.length &&
75
+ stored.params.every((byte, i) => byte === fields.params[i]));
76
+ }
77
+ export function signatureBytes(text) {
78
+ const bytes = new RegExp(SIGNATURE_PATTERN).test(text) ? getBase58Encoder().encode(text) : new Uint8Array();
79
+ if (bytes.length !== 64) {
80
+ throw new AgentRefusal("SignatureMalformed", "the signature must be 64 bytes written in base58");
81
+ }
82
+ return bytes;
83
+ }
84
+ //# sourceMappingURL=signed-terms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signed-terms.js","sourceRoot":"","sources":["../../../src/agent/signed-terms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,gBAAgB,EAAiE,MAAM,aAAa,CAAC;AAC5H,OAAO,EACL,SAAS,EACT,YAAY,EACZ,0BAA0B,EAG1B,SAAS,EACT,IAAI,EACJ,aAAa,EACb,SAAS,EAET,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,iBAAiB,EAAkB,MAAM,uBAAuB,CAAC;AAC/G,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAc,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAElF,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,EAAE,CAAC;AAC7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAC9C,MAAM,iBAAiB,GAAG,+BAA+B,CAAC;AAE1D,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,OAAO,CAAC,6CAA6C,CAAC;IAC7D,UAAU,EAAE,OAAO,EAAE;IACrB,WAAW,EAAE,OAAO,EAAE;IACtB,KAAK,EAAE,WAAW;IAClB,UAAU,EAAE,IAAI,EAAE;IAClB,KAAK,EAAE,MAAM,EAAE;IACf,SAAS,EAAE,IAAI,CAAC,mEAAmE,CAAC;IACpF,KAAK,EA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M,KAAK,GAAG,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,CAAC;IAC5G,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,YAAY,CAAC,oBAAoB,EAAE,kDAAkD,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,KAAuB,CAAC;AACjC,CAAC"}
@@ -1,13 +1,4 @@
1
- import { type Intent, type SignedIntentFields } from "@intent-engine/core";
2
- export declare const DEFAULT_SUBMIT_WITHIN: number;
3
- export declare const MAX_SUBMIT_WITHIN: number;
4
- export declare const RELAY_TOO_LARGE = "this server's relayer cannot fit these signed terms in one Solana transaction; drop the partner fee or use a relayer that adds no priority fee";
5
- export declare const prepareSignedIntent: import("./actions.js").AnyAction;
6
- export declare const submitSignedIntent: import("./actions.js").AnyAction;
7
- export declare function paying<T>(paid: {
8
- any: boolean;
9
- }, sending: Promise<T>): Promise<T>;
10
- export declare const repriced: (admitted: bigint, now: bigint) => string;
11
- export declare function refuseRepricing(admitted: bigint, now: bigint): void;
12
- export declare const previewSignedIntent: import("./actions.js").AnyAction;
13
- export declare function sameTerms(stored: Intent, fields: SignedIntentFields): boolean;
1
+ export { DEFAULT_SUBMIT_WITHIN, MAX_SUBMIT_WITHIN, publishesLine, sameTerms, SPEC_URL_UNSIGNED } from "./signed-terms.js";
2
+ export { paying, RELAY_TOO_LARGE, refuseRepricing, repriced, SPEC_URL_TOO_LONG } from "./signed-relay.js";
3
+ export { prepareSignedIntent } from "./signed-prepare.js";
4
+ export { previewSignedIntent, submitSignedIntent } from "./signed-submit.js";