@tetsuo-ai/marketplace-react 0.1.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.
Files changed (112) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE +21 -0
  3. package/README.md +172 -0
  4. package/dist/chunk-5OTKSRHM.js +128 -0
  5. package/dist/chunk-5OTKSRHM.js.map +1 -0
  6. package/dist/chunk-ABS77JB2.js +94 -0
  7. package/dist/chunk-ABS77JB2.js.map +1 -0
  8. package/dist/chunk-GN5DYVN5.js +35 -0
  9. package/dist/chunk-GN5DYVN5.js.map +1 -0
  10. package/dist/chunk-KJMR6OGC.js +1198 -0
  11. package/dist/chunk-KJMR6OGC.js.map +1 -0
  12. package/dist/chunk-YORZNYZZ.js +107 -0
  13. package/dist/chunk-YORZNYZZ.js.map +1 -0
  14. package/dist/components/agenc-components.css +570 -0
  15. package/dist/components/index.cjs +1335 -0
  16. package/dist/components/index.cjs.map +1 -0
  17. package/dist/components/index.d.cts +5 -0
  18. package/dist/components/index.d.ts +5 -0
  19. package/dist/components/index.js +5 -0
  20. package/dist/components/index.js.map +1 -0
  21. package/dist/hooks/index.cjs +493 -0
  22. package/dist/hooks/index.cjs.map +1 -0
  23. package/dist/hooks/index.d.cts +294 -0
  24. package/dist/hooks/index.d.ts +294 -0
  25. package/dist/hooks/index.js +339 -0
  26. package/dist/hooks/index.js.map +1 -0
  27. package/dist/index-BLrlBVj-.d.cts +1129 -0
  28. package/dist/index-CKTYsNPH.d.ts +1129 -0
  29. package/dist/index.cjs +1690 -0
  30. package/dist/index.cjs.map +1 -0
  31. package/dist/index.d.cts +235 -0
  32. package/dist/index.d.ts +235 -0
  33. package/dist/index.js +127 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/signers/index.cjs +166 -0
  36. package/dist/signers/index.cjs.map +1 -0
  37. package/dist/signers/index.d.cts +136 -0
  38. package/dist/signers/index.d.ts +136 -0
  39. package/dist/signers/index.js +4 -0
  40. package/dist/signers/index.js.map +1 -0
  41. package/dist/testing/index.cjs +62 -0
  42. package/dist/testing/index.cjs.map +1 -0
  43. package/dist/testing/index.d.cts +71 -0
  44. package/dist/testing/index.d.ts +71 -0
  45. package/dist/testing/index.js +60 -0
  46. package/dist/testing/index.js.map +1 -0
  47. package/dist/theme/agenc-tailwind-preset.cjs +184 -0
  48. package/dist/theme/agenc-tokens.css +132 -0
  49. package/dist/types-jvISR6bc.d.cts +135 -0
  50. package/dist/types-jvISR6bc.d.ts +135 -0
  51. package/dist/useAgentTrackRecord-BLf1nrbu.d.cts +249 -0
  52. package/dist/useAgentTrackRecord-BLf1nrbu.d.ts +249 -0
  53. package/package.json +139 -0
  54. package/src/components/DisputeBanner.stories.tsx +39 -0
  55. package/src/components/DisputeBanner.tsx +110 -0
  56. package/src/components/HireButton.stories.tsx +72 -0
  57. package/src/components/HireButton.tsx +151 -0
  58. package/src/components/HireCheckoutModal.stories.tsx +107 -0
  59. package/src/components/HireCheckoutModal.tsx +284 -0
  60. package/src/components/ListingCard.stories.tsx +55 -0
  61. package/src/components/ListingCard.tsx +148 -0
  62. package/src/components/ListingGrid.stories.tsx +44 -0
  63. package/src/components/ListingGrid.tsx +137 -0
  64. package/src/components/Modal.tsx +121 -0
  65. package/src/components/PoweredByAgenC.tsx +85 -0
  66. package/src/components/ProviderCard.stories.tsx +61 -0
  67. package/src/components/ProviderCard.tsx +154 -0
  68. package/src/components/ReferrerDisclosure.tsx +67 -0
  69. package/src/components/ReviewPanel.stories.tsx +65 -0
  70. package/src/components/ReviewPanel.tsx +141 -0
  71. package/src/components/TaskTimeline.stories.tsx +43 -0
  72. package/src/components/TaskTimeline.tsx +156 -0
  73. package/src/components/__fixtures__/index.tsx +173 -0
  74. package/src/components/agenc-components.css +570 -0
  75. package/src/components/badges.tsx +115 -0
  76. package/src/components/format.ts +150 -0
  77. package/src/components/index.ts +102 -0
  78. package/src/components/primitives.tsx +236 -0
  79. package/src/components/strings.ts +131 -0
  80. package/src/components/useFocusTrap.ts +122 -0
  81. package/src/hooks/index.ts +90 -0
  82. package/src/hooks/internal.ts +70 -0
  83. package/src/hooks/useAgentTrackRecord.ts +166 -0
  84. package/src/hooks/useDispute.ts +130 -0
  85. package/src/hooks/useHire.ts +198 -0
  86. package/src/hooks/useListing.ts +138 -0
  87. package/src/hooks/useListings.ts +133 -0
  88. package/src/hooks/useReferrerEarnings.ts +134 -0
  89. package/src/hooks/useSubmissionReview.ts +179 -0
  90. package/src/hooks/useTaskStatus.ts +192 -0
  91. package/src/hooks/useWalletSigner.ts +99 -0
  92. package/src/index.ts +170 -0
  93. package/src/provider/AgencProvider.tsx +169 -0
  94. package/src/provider/context.ts +35 -0
  95. package/src/provider/index.ts +17 -0
  96. package/src/provider/network.ts +68 -0
  97. package/src/provider/referrer.ts +97 -0
  98. package/src/signers/README.md +130 -0
  99. package/src/signers/embedded-wallet-mock.ts +158 -0
  100. package/src/signers/embedded-wallet.ts +64 -0
  101. package/src/signers/index.ts +48 -0
  102. package/src/signers/strings.ts +39 -0
  103. package/src/signers/types.ts +158 -0
  104. package/src/signers/wallet-account.ts +128 -0
  105. package/src/signers/wallet-adapter.ts +149 -0
  106. package/src/strings/index.ts +119 -0
  107. package/src/testing/index.ts +24 -0
  108. package/src/theme/agenc-tailwind-preset.cjs +184 -0
  109. package/src/theme/agenc-tokens.css +132 -0
  110. package/src/theme/index.ts +94 -0
  111. package/src/transport/index.ts +164 -0
  112. package/src/types.ts +224 -0
@@ -0,0 +1,166 @@
1
+ 'use strict';
2
+
3
+ var kit = require('@solana/kit');
4
+
5
+ // src/signers/wallet-account.ts
6
+
7
+ // src/strings/index.ts
8
+ var EN_STRINGS = {
9
+ // Provider / context wiring errors (developer-facing, but routed for parity).
10
+ "provider.missingContext": "useAgencContext must be used within <AgencProvider>.",
11
+ "provider.missingWriteClient": "No write client is configured. Pass config.client, or config.rpcUrl + config.signer, to <AgencProvider> before using a mutating hook.",
12
+ "provider.missingSigner": "No signer is configured on <AgencProvider>. Connect a wallet or pass config.signer.",
13
+ // Referrer config validation (the P6.2 gate surface).
14
+ "referrer.invalidWallet": "Referrer wallet is not a valid base58 Solana address: {wallet}.",
15
+ "referrer.invalidFeeBps": "Referrer feeBps must be an integer between {min} and {max} (basis points); got {feeBps}.",
16
+ "referrer.notLive": "This site earns a referral fee (pending protocol support).",
17
+ "referrer.notLiveReason": "Referral settlement is not yet deployed on this cluster (PLAN.md P6.2). Referrer config is accepted and validated but not injected into hires.",
18
+ // Read transport.
19
+ "transport.noReadSource": "No read source is configured. Pass an indexer baseUrl, an rpc/queryTransport, to <AgencProvider> or createReadTransport().",
20
+ // Generic loading / empty / error states (components extend these).
21
+ "state.loading": "Loading\u2026",
22
+ "state.empty": "Nothing to show yet.",
23
+ "state.error": "Something went wrong.",
24
+ // Hire flow shells (components fill out the rest).
25
+ "hire.cta": "Hire",
26
+ "hire.pending": "Confirming\u2026",
27
+ "hire.funded": "Escrow funded."
28
+ };
29
+ function t(id, vars, options) {
30
+ const catalog = options?.catalog ?? EN_STRINGS;
31
+ const template = catalog[id] ?? id;
32
+ if (vars === void 0) return template;
33
+ return template.replace(/\{(\w+)\}/g, (match, key) => {
34
+ const value = vars[key];
35
+ return value === void 0 ? match : String(value);
36
+ });
37
+ }
38
+
39
+ // src/signers/strings.ts
40
+ var EN_SIGNER_STRINGS = {
41
+ "signer.walletNoSignFeature": "Wallet account {address} does not expose a solana:signTransaction feature. Pass options.signTransaction explicitly, or use a Wallet Standard account that supports transaction signing.",
42
+ "signer.walletNoSignature": "The wallet returned no signature for account {address}. The wallet may have rejected or modified the transaction so the fee-payer signature is absent.",
43
+ "signer.embeddedSignatureCount": "Embedded wallet returned {got} signatures for {expected} transactions; expected one per transaction.",
44
+ "signer.walletAdapterDisconnected": "The wallet adapter is not connected (publicKey is null). Connect the wallet before creating a signer.",
45
+ "signer.walletAdapterNoSign": "The wallet adapter does not expose signTransaction. Use a wallet that supports transaction signing, or migrate to the Wallet Standard path (signerFromWalletAccount)."
46
+ };
47
+ function ts(id, vars) {
48
+ return t(id, vars, { catalog: EN_SIGNER_STRINGS });
49
+ }
50
+
51
+ // src/signers/wallet-account.ts
52
+ var SOLANA_SIGN_TRANSACTION = "solana:signTransaction";
53
+ function resolveSignTransaction(account, options) {
54
+ if (options.signTransaction) return options.signTransaction;
55
+ const feature = account.features?.[SOLANA_SIGN_TRANSACTION];
56
+ if (feature?.signTransaction) return feature.signTransaction;
57
+ throw new Error(ts("signer.walletNoSignFeature", { address: account.address }));
58
+ }
59
+ function resolveChain(account, options) {
60
+ if (options.chain) return options.chain;
61
+ return account.chains?.find((c) => c.startsWith("solana:"));
62
+ }
63
+ function signerFromWalletAccount(account, options = {}) {
64
+ const signerAddress = kit.address(account.address);
65
+ const signTransaction = resolveSignTransaction(account, options);
66
+ const chain = resolveChain(account, options);
67
+ const encoder = kit.getTransactionEncoder();
68
+ const decoder = kit.getTransactionDecoder();
69
+ async function signOne(transaction) {
70
+ const wireBytes = new Uint8Array(encoder.encode(transaction));
71
+ const [output] = await signTransaction({
72
+ transaction: wireBytes,
73
+ ...chain ? { chain } : {}
74
+ });
75
+ if (!output) {
76
+ throw new Error(ts("signer.walletNoSignature", { address: account.address }));
77
+ }
78
+ const signed = decoder.decode(output.signedTransaction);
79
+ const signature = signed.signatures[signerAddress];
80
+ if (!signature) {
81
+ throw new Error(ts("signer.walletNoSignature", { address: account.address }));
82
+ }
83
+ return signature;
84
+ }
85
+ return {
86
+ address: signerAddress,
87
+ async signTransactions(transactions) {
88
+ return Promise.all(
89
+ transactions.map(async (transaction) => ({
90
+ [signerAddress]: await signOne(transaction)
91
+ }))
92
+ );
93
+ }
94
+ };
95
+ }
96
+ function resolveAdapterAddress(adapter) {
97
+ const { publicKey } = adapter;
98
+ if (publicKey == null) {
99
+ throw new Error(ts("signer.walletAdapterDisconnected"));
100
+ }
101
+ if (typeof publicKey === "string") return publicKey;
102
+ if ("toBase58" in publicKey && typeof publicKey.toBase58 === "function") {
103
+ return publicKey.toBase58();
104
+ }
105
+ return String(publicKey);
106
+ }
107
+ function signerFromWalletAdapter(adapter, options) {
108
+ const signerAddress = kit.address(resolveAdapterAddress(adapter));
109
+ const { signTransaction } = adapter;
110
+ if (typeof signTransaction !== "function") {
111
+ throw new Error(ts("signer.walletAdapterNoSign"));
112
+ }
113
+ const { VersionedTransaction } = options;
114
+ const encoder = kit.getTransactionEncoder();
115
+ const decoder = kit.getTransactionDecoder();
116
+ async function signOne(transaction) {
117
+ const wireBytes = new Uint8Array(encoder.encode(transaction));
118
+ const legacyTx = VersionedTransaction.deserialize(wireBytes);
119
+ const signed = await signTransaction(legacyTx);
120
+ const signedTx = decoder.decode(new Uint8Array(signed.serialize()));
121
+ const signature = signedTx.signatures[signerAddress];
122
+ if (!signature) {
123
+ throw new Error(
124
+ ts("signer.walletNoSignature", { address: signerAddress })
125
+ );
126
+ }
127
+ return signature;
128
+ }
129
+ return {
130
+ address: signerAddress,
131
+ async signTransactions(transactions) {
132
+ return Promise.all(
133
+ transactions.map(async (transaction) => ({
134
+ [signerAddress]: await signOne(transaction)
135
+ }))
136
+ );
137
+ }
138
+ };
139
+ }
140
+ function signerFromEmbeddedWallet(connection) {
141
+ const signerAddress = kit.address(connection.address);
142
+ return {
143
+ address: signerAddress,
144
+ async signTransactions(transactions) {
145
+ const signatures = await connection.signTransactions(transactions);
146
+ if (signatures.length !== transactions.length) {
147
+ throw new Error(
148
+ ts("signer.embeddedSignatureCount", {
149
+ expected: transactions.length,
150
+ got: signatures.length
151
+ })
152
+ );
153
+ }
154
+ return transactions.map((_, i) => ({
155
+ [signerAddress]: signatures[i]
156
+ }));
157
+ }
158
+ };
159
+ }
160
+
161
+ exports.EN_SIGNER_STRINGS = EN_SIGNER_STRINGS;
162
+ exports.signerFromEmbeddedWallet = signerFromEmbeddedWallet;
163
+ exports.signerFromWalletAccount = signerFromWalletAccount;
164
+ exports.signerFromWalletAdapter = signerFromWalletAdapter;
165
+ //# sourceMappingURL=index.cjs.map
166
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/strings/index.ts","../../src/signers/strings.ts","../../src/signers/wallet-account.ts","../../src/signers/wallet-adapter.ts","../../src/signers/embedded-wallet.ts"],"names":["address","getTransactionEncoder","getTransactionDecoder"],"mappings":";;;;;;;AAkCO,IAAM,UAAA,GAAa;AAAA;AAAA,EAExB,yBAAA,EACE,sDAAA;AAAA,EACF,6BAAA,EACE,uIAAA;AAAA,EACF,wBAAA,EACE,qFAAA;AAAA;AAAA,EAGF,wBAAA,EACE,iEAAA;AAAA,EACF,wBAAA,EACE,0FAAA;AAAA,EACF,kBAAA,EACE,4DAAA;AAAA,EACF,wBAAA,EACE,gJAAA;AAAA;AAAA,EAGF,wBAAA,EACE,4HAAA;AAAA;AAAA,EAGF,eAAA,EAAiB,eAAA;AAAA,EACjB,aAAA,EAAe,sBAAA;AAAA,EACf,aAAA,EAAe,uBAAA;AAAA;AAAA,EAGf,UAAA,EAAY,MAAA;AAAA,EACZ,cAAA,EAAgB,kBAAA;AAAA,EAChB,aAAA,EAAe;AACjB,CAAA;AAwCO,SAAS,CAAA,CACd,EAAA,EACA,IAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,OAAA,GAAyB,SAAS,OAAA,IAAW,UAAA;AACnD,EAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,EAAE,CAAA,IAAK,EAAA;AAChC,EAAA,IAAI,IAAA,KAAS,QAAW,OAAO,QAAA;AAC/B,EAAA,OAAO,QAAA,CAAS,OAAA,CAAQ,YAAA,EAAc,CAAC,OAAO,GAAA,KAAgB;AAC5D,IAAA,MAAM,KAAA,GAAQ,KAAK,GAAG,CAAA;AACtB,IAAA,OAAO,KAAA,KAAU,MAAA,GAAY,KAAA,GAAQ,MAAA,CAAO,KAAK,CAAA;AAAA,EACnD,CAAC,CAAA;AACH;;;ACzGO,IAAM,iBAAA,GAAoB;AAAA,EAC/B,4BAAA,EACE,yLAAA;AAAA,EACF,0BAA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A,IAAA,OAAO,SAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,aAAA;AAAA,IACT,MAAM,iBAAiB,YAAA,EAAc;AACnC,MAAA,OAAO,OAAA,CAAQ,GAAA;AAAA,QACb,YAAA,CAAa,GAAA,CAAI,OAAO,WAAA,MAAiB;AAAA,UACvC,CAAC,aAAa,GAAG,MAAM,QAAQ,WAAW;AAAA,SAC5C,CAAE;AAAA,OACJ;AAAA,IACF;AAAA,GACF;AACF;AC5GO,SAAS,yBACd,UAAA,EACmB;AACnB,EAAA,MAAM,aAAA,GAAgBF,WAAAA,CAAQ,UAAA,CAAW,OAAO,CAAA;AAEhD,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,aAAA;AAAA,IACT,MAAM,iBAAiB,YAAA,EAAsC;AAC3D,MAAA,MAAM,UAAA,GACJ,MAAM,UAAA,CAAW,gBAAA,CAAiB,YAAY,CAAA;AAChD,MAAA,IAAI,UAAA,CAAW,MAAA,KAAW,YAAA,CAAa,MAAA,EAAQ;AAC7C,QAAA,MAAM,IAAI,KAAA;AAAA,UACR,GAAG,+BAAA,EAAiC;AAAA,YAClC,UAAU,YAAA,CAAa,MAAA;AAAA,YACvB,KAAK,UAAA,CAAW;AAAA,WACjB;AAAA,SACH;AAAA,MACF;AACA,MAAA,OAAO,YAAA,CAAa,GAAA,CAAI,CAAC,CAAA,EAAG,CAAA,MAAO;AAAA,QACjC,CAAC,aAAa,GAAG,UAAA,CAAW,CAAC;AAAA,OAC/B,CAAE,CAAA;AAAA,IACJ;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["/**\n * Minimal English string catalog + a `t(id, vars?)` resolver.\n *\n * Every user-facing string in this package and its downstream hooks/components\n * routes through this module so a future `{ locale }` can resolve translations\n * **without an API break** (PLAN_2 Part A design constraint). v1 ships English\n * only; the resolver signature is already locale-shaped.\n *\n * ## Why a catalog and not inline literals\n *\n * Components published to third parties cannot assume the host's language. By\n * keying every literal here:\n * - adding a locale is a data change (a new {@link StringCatalog}), not a code\n * change to every component;\n * - the message ids are a stable contract the components agent binds to;\n * - `{var}` interpolation is centralized and SSR-safe (pure string ops, no\n * `Intl` global assumptions at module scope).\n *\n * @module strings\n */\n\n/**\n * The catalog shape: every message id maps to an English template. `{name}`\n * placeholders are filled by {@link t} from the `vars` argument.\n */\nexport interface StringCatalog {\n readonly [id: string]: string;\n}\n\n/**\n * Default English catalog. Keep ids namespaced by surface\n * (`provider.*`, `referrer.*`, `transport.*`, `hire.*`, ...) so the components\n * agent can extend it without collisions.\n */\nexport const EN_STRINGS = {\n // Provider / context wiring errors (developer-facing, but routed for parity).\n \"provider.missingContext\":\n \"useAgencContext must be used within <AgencProvider>.\",\n \"provider.missingWriteClient\":\n \"No write client is configured. Pass config.client, or config.rpcUrl + config.signer, to <AgencProvider> before using a mutating hook.\",\n \"provider.missingSigner\":\n \"No signer is configured on <AgencProvider>. Connect a wallet or pass config.signer.\",\n\n // Referrer config validation (the P6.2 gate surface).\n \"referrer.invalidWallet\":\n \"Referrer wallet is not a valid base58 Solana address: {wallet}.\",\n \"referrer.invalidFeeBps\":\n \"Referrer feeBps must be an integer between {min} and {max} (basis points); got {feeBps}.\",\n \"referrer.notLive\":\n \"This site earns a referral fee (pending protocol support).\",\n \"referrer.notLiveReason\":\n \"Referral settlement is not yet deployed on this cluster (PLAN.md P6.2). Referrer config is accepted and validated but not injected into hires.\",\n\n // Read transport.\n \"transport.noReadSource\":\n \"No read source is configured. Pass an indexer baseUrl, an rpc/queryTransport, to <AgencProvider> or createReadTransport().\",\n\n // Generic loading / empty / error states (components extend these).\n \"state.loading\": \"Loading…\",\n \"state.empty\": \"Nothing to show yet.\",\n \"state.error\": \"Something went wrong.\",\n\n // Hire flow shells (components fill out the rest).\n \"hire.cta\": \"Hire\",\n \"hire.pending\": \"Confirming…\",\n \"hire.funded\": \"Escrow funded.\",\n} as const satisfies StringCatalog;\n\n/** A message id present in the default English catalog. */\nexport type StringId = keyof typeof EN_STRINGS;\n\n/** Interpolation variables for {@link t}: `{name}` → `vars.name`. */\nexport type StringVars = Record<string, string | number | bigint>;\n\n/**\n * Options for {@link t}. `locale` is accepted today (English-only) so adding\n * real locales later does not break the call signature; `catalog` lets a host\n * inject an override/extension catalog.\n */\nexport interface TranslateOptions {\n /** BCP-47 locale tag. v1 resolves everything to English regardless. */\n locale?: string;\n /** Override catalog (e.g. a future locale, or host-supplied copy). */\n catalog?: StringCatalog;\n}\n\n/**\n * Resolve a message id to its localized string with `{var}` interpolation.\n *\n * Unknown ids and unmatched placeholders are returned verbatim (the id itself,\n * or the `{placeholder}` left intact) rather than throwing — a missing string\n * must never crash a money-handling UI.\n *\n * @param id - The message id (a {@link StringId}, or any string for host\n * catalogs).\n * @param vars - Values for `{name}` placeholders in the template.\n * @param options - Optional `locale` (forward-compatible) and `catalog`\n * override.\n * @returns The interpolated string.\n *\n * @example\n * ```ts\n * t(\"referrer.invalidFeeBps\", { min: 0, max: 10000, feeBps: 99999 });\n * // -> \"Referrer feeBps must be an integer between 0 and 10000 ...; got 99999.\"\n * ```\n */\nexport function t(\n id: StringId | (string & {}),\n vars?: StringVars,\n options?: TranslateOptions,\n): string {\n const catalog: StringCatalog = options?.catalog ?? EN_STRINGS;\n const template = catalog[id] ?? id;\n if (vars === undefined) return template;\n return template.replace(/\\{(\\w+)\\}/g, (match, key: string) => {\n const value = vars[key];\n return value === undefined ? match : String(value);\n });\n}\n","/**\n * Signer-adapter string catalog (the `signer.*` namespace).\n *\n * Kept local to `src/signers/**` so the adapters route every user-facing string\n * through the package's {@link t} resolver (the PLAN_2 Part A locale contract)\n * WITHOUT cross-editing the shared `src/strings` catalog owned by another\n * surface. A future locale can extend `EN_SIGNER_STRINGS` the same way.\n *\n * @module signers/strings\n */\nimport { t, type StringCatalog } from \"../strings/index.js\";\n\n/** English `signer.*` strings used by the wallet/embedded adapters. */\nexport const EN_SIGNER_STRINGS = {\n \"signer.walletNoSignFeature\":\n \"Wallet account {address} does not expose a solana:signTransaction feature. Pass options.signTransaction explicitly, or use a Wallet Standard account that supports transaction signing.\",\n \"signer.walletNoSignature\":\n \"The wallet returned no signature for account {address}. The wallet may have rejected or modified the transaction so the fee-payer signature is absent.\",\n \"signer.embeddedSignatureCount\":\n \"Embedded wallet returned {got} signatures for {expected} transactions; expected one per transaction.\",\n \"signer.walletAdapterDisconnected\":\n \"The wallet adapter is not connected (publicKey is null). Connect the wallet before creating a signer.\",\n \"signer.walletAdapterNoSign\":\n \"The wallet adapter does not expose signTransaction. Use a wallet that supports transaction signing, or migrate to the Wallet Standard path (signerFromWalletAccount).\",\n} as const satisfies StringCatalog;\n\n/** A `signer.*` message id. */\nexport type SignerStringId = keyof typeof EN_SIGNER_STRINGS;\n\n/**\n * `t()` bound to the signer catalog: resolves `signer.*` ids while preserving\n * the shared resolver's interpolation + verbatim-fallback behavior.\n */\nexport function ts(\n id: SignerStringId,\n vars?: Record<string, string | number | bigint>,\n): string {\n return t(id, vars, { catalog: EN_SIGNER_STRINGS });\n}\n","/**\n * Wallet Standard → kit `TransactionSigner` bridge (PLAN.md P4.1 / PLAN_2 D-1).\n *\n * Turns a connected browser wallet into the {@link TransactionSigner} the SDK's\n * `createMarketplaceClient` consumes. The SDK client signs via\n * `signTransactionMessageWithSigners(...)` and submits through its OWN transport\n * — so it needs a PARTIAL signer (one that returns signatures without sending),\n * NOT a `TransactionSendingSigner` (which `signTransactionMessageWithSigners`\n * deliberately ignores). This bridge therefore produces a\n * {@link TransactionPartialSigner}: it serializes each transaction, hands it to\n * the wallet's `solana:signTransaction` feature, and diffs the returned signed\n * transaction to recover THIS account's signature.\n *\n * @see {@link signerFromWalletAccount}\n * @module signers/wallet-account\n */\nimport {\n address,\n getTransactionDecoder,\n getTransactionEncoder,\n type Address,\n type SignatureBytes,\n type Transaction,\n} from \"@solana/kit\";\nimport { ts } from \"./strings.js\";\nimport type {\n SignerFromWalletAccountOptions,\n TransactionSigner,\n WalletStandardAccountLike,\n WalletStandardSignTransaction,\n} from \"./types.js\";\n\nconst SOLANA_SIGN_TRANSACTION = \"solana:signTransaction\";\n\n/** Resolve the wallet's `solana:signTransaction` method from account/options. */\nfunction resolveSignTransaction(\n account: WalletStandardAccountLike,\n options: SignerFromWalletAccountOptions,\n): WalletStandardSignTransaction {\n if (options.signTransaction) return options.signTransaction;\n const feature = account.features?.[SOLANA_SIGN_TRANSACTION] as\n | { signTransaction?: WalletStandardSignTransaction }\n | undefined;\n if (feature?.signTransaction) return feature.signTransaction;\n throw new Error(ts(\"signer.walletNoSignFeature\", { address: account.address }));\n}\n\n/** Pick the CAIP-2 chain to forward to the wallet. */\nfunction resolveChain(\n account: WalletStandardAccountLike,\n options: SignerFromWalletAccountOptions,\n): string | undefined {\n if (options.chain) return options.chain;\n return account.chains?.find((c) => c.startsWith(\"solana:\"));\n}\n\n/**\n * Bridge a Wallet Standard account into a kit {@link TransactionSigner}.\n *\n * Accepts either a real `UiWalletAccount` (the `@solana/react` path — pass the\n * account and a `chain`, or pass the hook's feature via\n * {@link SignerFromWalletAccountOptions.signTransaction}) or any object exposing\n * the `solana:signTransaction` feature. The returned signer is a\n * {@link TransactionPartialSigner}, the exact shape the SDK client expects.\n *\n * Wallets may MODIFY a transaction before signing (priority fees, guard\n * instructions). We honor that by decoding the wallet's returned signed\n * transaction and extracting only THIS account's signature; the SDK client then\n * re-assembles and submits. (If a wallet rewrites the message such that the\n * fee-payer's own prior signing is invalidated, that is a wallet contract the\n * SDK's single-fee-payer flow already assumes won't happen for the payer.)\n *\n * SSR-safe: constructs no browser globals; the wallet round-trip only runs when\n * a transaction is actually signed.\n *\n * @param account - The connected Wallet Standard account (needs `address`).\n * @param options - Chain + an optional explicit `signTransaction` override.\n * @returns A kit {@link TransactionSigner} usable as `config.signer`.\n * @throws Error if no `solana:signTransaction` feature can be resolved.\n *\n * @example\n * ```ts\n * // With @solana/react (Wallet Standard):\n * const account = useSelectedWalletAccount(); // UiWalletAccount\n * const signer = signerFromWalletAccount(account, { chain: \"solana:devnet\" });\n * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.\n * ```\n */\nexport function signerFromWalletAccount(\n account: WalletStandardAccountLike,\n options: SignerFromWalletAccountOptions = {},\n): TransactionSigner {\n const signerAddress: Address = address(account.address);\n const signTransaction = resolveSignTransaction(account, options);\n const chain = resolveChain(account, options);\n const encoder = getTransactionEncoder();\n const decoder = getTransactionDecoder();\n\n async function signOne(transaction: Transaction): Promise<SignatureBytes> {\n const wireBytes = new Uint8Array(encoder.encode(transaction));\n const [output] = await signTransaction({\n transaction: wireBytes,\n ...(chain ? { chain } : {}),\n });\n if (!output) {\n throw new Error(ts(\"signer.walletNoSignature\", { address: account.address }));\n }\n const signed = decoder.decode(output.signedTransaction);\n const signature = signed.signatures[signerAddress];\n if (!signature) {\n throw new Error(ts(\"signer.walletNoSignature\", { address: account.address }));\n }\n return signature as SignatureBytes;\n }\n\n return {\n address: signerAddress,\n async signTransactions(transactions) {\n // Sign in parallel — partial signers are order-independent (each returns a\n // single-entry SignatureDictionary the caller merges).\n return Promise.all(\n transactions.map(async (transaction) => ({\n [signerAddress]: await signOne(transaction),\n })),\n );\n },\n } satisfies TransactionSigner;\n}\n","/**\n * LEGACY `@solana/wallet-adapter` compatibility shim (PLAN.md P4.1).\n *\n * The supported, robust path for browser wallets is the Wallet Standard bridge\n * ({@link signerFromWalletAccount} via `@solana/react`): every modern wallet —\n * including all wallet-adapter wallets — registers as a Wallet Standard wallet,\n * so a wallet-adapter app can migrate by reading the selected account through\n * `@solana/react` and dropping it into `signerFromWalletAccount`. PREFER THAT.\n *\n * This shim exists for apps still holding a raw wallet-adapter\n * `WalletContextState` (web3.js v1 `signTransaction`). It bridges WITHOUT a hard\n * dependency on `@solana/wallet-adapter-*` OR `@solana/web3.js` (1.x): the\n * caller injects the web3.js `VersionedTransaction` class (the only piece we\n * cannot reconstruct), and we round-trip through the shared wire format — a kit\n * {@link Transaction} and a web3.js `VersionedTransaction` serialize to the SAME\n * bytes, so no semantic re-encoding is needed.\n *\n * SSR-safe: no browser globals at module scope.\n *\n * @module signers/wallet-adapter\n */\nimport {\n address,\n getTransactionDecoder,\n getTransactionEncoder,\n type SignatureBytes,\n type Transaction,\n} from \"@solana/kit\";\nimport { ts } from \"./strings.js\";\nimport type { TransactionSigner } from \"./types.js\";\n\n/**\n * The web3.js v1 `VersionedTransaction` surface this shim needs: a static\n * `deserialize(bytes)` and an instance `serialize()`. Pass the real class from\n * `@solana/web3.js` — typed structurally so this module never imports it.\n */\nexport interface VersionedTransactionLike {\n serialize(): Uint8Array;\n}\n\n/** The static side of the injected `VersionedTransaction` class. */\nexport interface VersionedTransactionCtor {\n deserialize(bytes: Uint8Array): VersionedTransactionLike;\n}\n\n/**\n * The minimal slice of a wallet-adapter `WalletContextState` this shim consumes.\n * Both `publicKey` (anything with a base58 `toString()`/`toBase58()`) and the\n * v1 `signTransaction` are required; a connected adapter exposes both.\n */\nexport interface WalletAdapterLike {\n /** The connected account's public key (base58 via `toBase58()`/`toString()`). */\n readonly publicKey:\n | { toBase58(): string }\n | { toString(): string }\n | string\n | null;\n /** web3.js v1 sign — returns the same transaction type, signed. */\n signTransaction?: <T extends VersionedTransactionLike>(\n transaction: T,\n ) => Promise<T>;\n}\n\n/** Options for {@link signerFromWalletAdapter}. */\nexport interface SignerFromWalletAdapterOptions {\n /**\n * The web3.js `VersionedTransaction` class (`import { VersionedTransaction }\n * from \"@solana/web3.js\"`). Required — it is the one piece this no-dep shim\n * cannot supply itself.\n */\n VersionedTransaction: VersionedTransactionCtor;\n}\n\nfunction resolveAdapterAddress(adapter: WalletAdapterLike): string {\n const { publicKey } = adapter;\n if (publicKey == null) {\n throw new Error(ts(\"signer.walletAdapterDisconnected\"));\n }\n if (typeof publicKey === \"string\") return publicKey;\n if (\"toBase58\" in publicKey && typeof publicKey.toBase58 === \"function\") {\n return publicKey.toBase58();\n }\n return String(publicKey);\n}\n\n/**\n * Bridge a LEGACY `@solana/wallet-adapter` `WalletContextState` into a kit\n * {@link TransactionSigner}.\n *\n * Use only when you cannot reach the wallet through `@solana/react`. The result\n * is a {@link TransactionPartialSigner} (the SDK client owns submission), built\n * by serializing the kit transaction to wire bytes, rehydrating it as a web3.js\n * `VersionedTransaction`, handing THAT to the adapter's `signTransaction`, then\n * decoding the signed wire bytes back to a kit transaction to extract this\n * account's signature.\n *\n * @param adapter - A connected wallet-adapter state (`publicKey` + `signTransaction`).\n * @param options - Must inject the web3.js `VersionedTransaction` class.\n * @returns A kit {@link TransactionSigner} usable as `config.signer`.\n * @throws Error if the adapter is disconnected or lacks `signTransaction`.\n *\n * @example\n * ```ts\n * import { VersionedTransaction } from \"@solana/web3.js\";\n * import { useWallet } from \"@solana/wallet-adapter-react\";\n *\n * const wallet = useWallet();\n * const signer = signerFromWalletAdapter(wallet, { VersionedTransaction });\n * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.\n * ```\n */\nexport function signerFromWalletAdapter(\n adapter: WalletAdapterLike,\n options: SignerFromWalletAdapterOptions,\n): TransactionSigner {\n const signerAddress = address(resolveAdapterAddress(adapter));\n const { signTransaction } = adapter;\n if (typeof signTransaction !== \"function\") {\n throw new Error(ts(\"signer.walletAdapterNoSign\"));\n }\n const { VersionedTransaction } = options;\n const encoder = getTransactionEncoder();\n const decoder = getTransactionDecoder();\n\n async function signOne(transaction: Transaction): Promise<SignatureBytes> {\n const wireBytes = new Uint8Array(encoder.encode(transaction));\n const legacyTx = VersionedTransaction.deserialize(wireBytes);\n const signed = await signTransaction!(legacyTx);\n const signedTx = decoder.decode(new Uint8Array(signed.serialize()));\n const signature = signedTx.signatures[signerAddress];\n if (!signature) {\n throw new Error(\n ts(\"signer.walletNoSignature\", { address: signerAddress }),\n );\n }\n return signature as SignatureBytes;\n }\n\n return {\n address: signerAddress,\n async signTransactions(transactions) {\n return Promise.all(\n transactions.map(async (transaction) => ({\n [signerAddress]: await signOne(transaction),\n })),\n );\n },\n } satisfies TransactionSigner;\n}\n","/**\n * Embedded / walletless → kit `TransactionSigner` bridge (PLAN_2 D-1).\n *\n * The \"no wallet, no SOL\" buyer path. A vendor-neutral\n * {@link EmbeddedWalletProvider} (Privy / Dynamic / Web3Auth — `[HUMAN]`-gated)\n * handles email/social login + key custody; this module lifts a live\n * {@link EmbeddedWalletConnection} into the kit {@link TransactionSigner} the SDK\n * client consumes. As with the Wallet Standard bridge, the result is a PARTIAL\n * signer — the vendor signs, the SDK client's transport broadcasts.\n *\n * @see {@link signerFromEmbeddedWallet}\n * @see {@link createMockEmbeddedWallet} — the local-keypair test adapter.\n * @module signers/embedded-wallet\n */\nimport { address, type SignatureBytes, type Transaction } from \"@solana/kit\";\nimport { ts } from \"./strings.js\";\nimport type {\n EmbeddedWalletConnection,\n TransactionSigner,\n} from \"./types.js\";\n\n/**\n * Bridge a CONNECTED embedded-wallet connection into a kit\n * {@link TransactionSigner}.\n *\n * Call this AFTER `provider.connect()` resolves — it needs the live\n * {@link EmbeddedWalletConnection} (address + `signTransactions`). The hooks\n * layer (`useWalletSigner`) is expected to own the connect lifecycle and call\n * this once a connection exists.\n *\n * @param connection - A live embedded-wallet connection.\n * @returns A kit {@link TransactionSigner} usable as `config.signer`.\n *\n * @example\n * ```ts\n * const connection = await provider.connect(); // vendor login\n * const signer = signerFromEmbeddedWallet(connection);\n * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.\n * ```\n */\nexport function signerFromEmbeddedWallet(\n connection: EmbeddedWalletConnection,\n): TransactionSigner {\n const signerAddress = address(connection.address);\n\n return {\n address: signerAddress,\n async signTransactions(transactions: readonly Transaction[]) {\n const signatures: readonly SignatureBytes[] =\n await connection.signTransactions(transactions);\n if (signatures.length !== transactions.length) {\n throw new Error(\n ts(\"signer.embeddedSignatureCount\", {\n expected: transactions.length,\n got: signatures.length,\n }),\n );\n }\n return transactions.map((_, i) => ({\n [signerAddress]: signatures[i] as SignatureBytes,\n }));\n },\n } satisfies TransactionSigner;\n}\n"]}
@@ -0,0 +1,136 @@
1
+ import { W as WalletStandardAccountLike, S as SignerFromWalletAccountOptions, E as EmbeddedWalletConnection } from '../types-jvISR6bc.cjs';
2
+ export { a as EmbeddedWalletProvider, b as WalletStandardSignTransaction } from '../types-jvISR6bc.cjs';
3
+ import { TransactionSigner } from '@solana/kit';
4
+ export { TransactionSigner } from '@solana/kit';
5
+
6
+ /**
7
+ * Bridge a Wallet Standard account into a kit {@link TransactionSigner}.
8
+ *
9
+ * Accepts either a real `UiWalletAccount` (the `@solana/react` path — pass the
10
+ * account and a `chain`, or pass the hook's feature via
11
+ * {@link SignerFromWalletAccountOptions.signTransaction}) or any object exposing
12
+ * the `solana:signTransaction` feature. The returned signer is a
13
+ * {@link TransactionPartialSigner}, the exact shape the SDK client expects.
14
+ *
15
+ * Wallets may MODIFY a transaction before signing (priority fees, guard
16
+ * instructions). We honor that by decoding the wallet's returned signed
17
+ * transaction and extracting only THIS account's signature; the SDK client then
18
+ * re-assembles and submits. (If a wallet rewrites the message such that the
19
+ * fee-payer's own prior signing is invalidated, that is a wallet contract the
20
+ * SDK's single-fee-payer flow already assumes won't happen for the payer.)
21
+ *
22
+ * SSR-safe: constructs no browser globals; the wallet round-trip only runs when
23
+ * a transaction is actually signed.
24
+ *
25
+ * @param account - The connected Wallet Standard account (needs `address`).
26
+ * @param options - Chain + an optional explicit `signTransaction` override.
27
+ * @returns A kit {@link TransactionSigner} usable as `config.signer`.
28
+ * @throws Error if no `solana:signTransaction` feature can be resolved.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * // With @solana/react (Wallet Standard):
33
+ * const account = useSelectedWalletAccount(); // UiWalletAccount
34
+ * const signer = signerFromWalletAccount(account, { chain: "solana:devnet" });
35
+ * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.
36
+ * ```
37
+ */
38
+ declare function signerFromWalletAccount(account: WalletStandardAccountLike, options?: SignerFromWalletAccountOptions): TransactionSigner;
39
+
40
+ /**
41
+ * The web3.js v1 `VersionedTransaction` surface this shim needs: a static
42
+ * `deserialize(bytes)` and an instance `serialize()`. Pass the real class from
43
+ * `@solana/web3.js` — typed structurally so this module never imports it.
44
+ */
45
+ interface VersionedTransactionLike {
46
+ serialize(): Uint8Array;
47
+ }
48
+ /** The static side of the injected `VersionedTransaction` class. */
49
+ interface VersionedTransactionCtor {
50
+ deserialize(bytes: Uint8Array): VersionedTransactionLike;
51
+ }
52
+ /**
53
+ * The minimal slice of a wallet-adapter `WalletContextState` this shim consumes.
54
+ * Both `publicKey` (anything with a base58 `toString()`/`toBase58()`) and the
55
+ * v1 `signTransaction` are required; a connected adapter exposes both.
56
+ */
57
+ interface WalletAdapterLike {
58
+ /** The connected account's public key (base58 via `toBase58()`/`toString()`). */
59
+ readonly publicKey: {
60
+ toBase58(): string;
61
+ } | {
62
+ toString(): string;
63
+ } | string | null;
64
+ /** web3.js v1 sign — returns the same transaction type, signed. */
65
+ signTransaction?: <T extends VersionedTransactionLike>(transaction: T) => Promise<T>;
66
+ }
67
+ /** Options for {@link signerFromWalletAdapter}. */
68
+ interface SignerFromWalletAdapterOptions {
69
+ /**
70
+ * The web3.js `VersionedTransaction` class (`import { VersionedTransaction }
71
+ * from "@solana/web3.js"`). Required — it is the one piece this no-dep shim
72
+ * cannot supply itself.
73
+ */
74
+ VersionedTransaction: VersionedTransactionCtor;
75
+ }
76
+ /**
77
+ * Bridge a LEGACY `@solana/wallet-adapter` `WalletContextState` into a kit
78
+ * {@link TransactionSigner}.
79
+ *
80
+ * Use only when you cannot reach the wallet through `@solana/react`. The result
81
+ * is a {@link TransactionPartialSigner} (the SDK client owns submission), built
82
+ * by serializing the kit transaction to wire bytes, rehydrating it as a web3.js
83
+ * `VersionedTransaction`, handing THAT to the adapter's `signTransaction`, then
84
+ * decoding the signed wire bytes back to a kit transaction to extract this
85
+ * account's signature.
86
+ *
87
+ * @param adapter - A connected wallet-adapter state (`publicKey` + `signTransaction`).
88
+ * @param options - Must inject the web3.js `VersionedTransaction` class.
89
+ * @returns A kit {@link TransactionSigner} usable as `config.signer`.
90
+ * @throws Error if the adapter is disconnected or lacks `signTransaction`.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * import { VersionedTransaction } from "@solana/web3.js";
95
+ * import { useWallet } from "@solana/wallet-adapter-react";
96
+ *
97
+ * const wallet = useWallet();
98
+ * const signer = signerFromWalletAdapter(wallet, { VersionedTransaction });
99
+ * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.
100
+ * ```
101
+ */
102
+ declare function signerFromWalletAdapter(adapter: WalletAdapterLike, options: SignerFromWalletAdapterOptions): TransactionSigner;
103
+
104
+ /**
105
+ * Bridge a CONNECTED embedded-wallet connection into a kit
106
+ * {@link TransactionSigner}.
107
+ *
108
+ * Call this AFTER `provider.connect()` resolves — it needs the live
109
+ * {@link EmbeddedWalletConnection} (address + `signTransactions`). The hooks
110
+ * layer (`useWalletSigner`) is expected to own the connect lifecycle and call
111
+ * this once a connection exists.
112
+ *
113
+ * @param connection - A live embedded-wallet connection.
114
+ * @returns A kit {@link TransactionSigner} usable as `config.signer`.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * const connection = await provider.connect(); // vendor login
119
+ * const signer = signerFromEmbeddedWallet(connection);
120
+ * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.
121
+ * ```
122
+ */
123
+ declare function signerFromEmbeddedWallet(connection: EmbeddedWalletConnection): TransactionSigner;
124
+
125
+ /** English `signer.*` strings used by the wallet/embedded adapters. */
126
+ declare const EN_SIGNER_STRINGS: {
127
+ readonly "signer.walletNoSignFeature": "Wallet account {address} does not expose a solana:signTransaction feature. Pass options.signTransaction explicitly, or use a Wallet Standard account that supports transaction signing.";
128
+ readonly "signer.walletNoSignature": "The wallet returned no signature for account {address}. The wallet may have rejected or modified the transaction so the fee-payer signature is absent.";
129
+ readonly "signer.embeddedSignatureCount": "Embedded wallet returned {got} signatures for {expected} transactions; expected one per transaction.";
130
+ readonly "signer.walletAdapterDisconnected": "The wallet adapter is not connected (publicKey is null). Connect the wallet before creating a signer.";
131
+ readonly "signer.walletAdapterNoSign": "The wallet adapter does not expose signTransaction. Use a wallet that supports transaction signing, or migrate to the Wallet Standard path (signerFromWalletAccount).";
132
+ };
133
+ /** A `signer.*` message id. */
134
+ type SignerStringId = keyof typeof EN_SIGNER_STRINGS;
135
+
136
+ export { EN_SIGNER_STRINGS, EmbeddedWalletConnection, SignerFromWalletAccountOptions, type SignerFromWalletAdapterOptions, type SignerStringId, type VersionedTransactionCtor, type VersionedTransactionLike, type WalletAdapterLike, WalletStandardAccountLike, signerFromEmbeddedWallet, signerFromWalletAccount, signerFromWalletAdapter };
@@ -0,0 +1,136 @@
1
+ import { W as WalletStandardAccountLike, S as SignerFromWalletAccountOptions, E as EmbeddedWalletConnection } from '../types-jvISR6bc.js';
2
+ export { a as EmbeddedWalletProvider, b as WalletStandardSignTransaction } from '../types-jvISR6bc.js';
3
+ import { TransactionSigner } from '@solana/kit';
4
+ export { TransactionSigner } from '@solana/kit';
5
+
6
+ /**
7
+ * Bridge a Wallet Standard account into a kit {@link TransactionSigner}.
8
+ *
9
+ * Accepts either a real `UiWalletAccount` (the `@solana/react` path — pass the
10
+ * account and a `chain`, or pass the hook's feature via
11
+ * {@link SignerFromWalletAccountOptions.signTransaction}) or any object exposing
12
+ * the `solana:signTransaction` feature. The returned signer is a
13
+ * {@link TransactionPartialSigner}, the exact shape the SDK client expects.
14
+ *
15
+ * Wallets may MODIFY a transaction before signing (priority fees, guard
16
+ * instructions). We honor that by decoding the wallet's returned signed
17
+ * transaction and extracting only THIS account's signature; the SDK client then
18
+ * re-assembles and submits. (If a wallet rewrites the message such that the
19
+ * fee-payer's own prior signing is invalidated, that is a wallet contract the
20
+ * SDK's single-fee-payer flow already assumes won't happen for the payer.)
21
+ *
22
+ * SSR-safe: constructs no browser globals; the wallet round-trip only runs when
23
+ * a transaction is actually signed.
24
+ *
25
+ * @param account - The connected Wallet Standard account (needs `address`).
26
+ * @param options - Chain + an optional explicit `signTransaction` override.
27
+ * @returns A kit {@link TransactionSigner} usable as `config.signer`.
28
+ * @throws Error if no `solana:signTransaction` feature can be resolved.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * // With @solana/react (Wallet Standard):
33
+ * const account = useSelectedWalletAccount(); // UiWalletAccount
34
+ * const signer = signerFromWalletAccount(account, { chain: "solana:devnet" });
35
+ * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.
36
+ * ```
37
+ */
38
+ declare function signerFromWalletAccount(account: WalletStandardAccountLike, options?: SignerFromWalletAccountOptions): TransactionSigner;
39
+
40
+ /**
41
+ * The web3.js v1 `VersionedTransaction` surface this shim needs: a static
42
+ * `deserialize(bytes)` and an instance `serialize()`. Pass the real class from
43
+ * `@solana/web3.js` — typed structurally so this module never imports it.
44
+ */
45
+ interface VersionedTransactionLike {
46
+ serialize(): Uint8Array;
47
+ }
48
+ /** The static side of the injected `VersionedTransaction` class. */
49
+ interface VersionedTransactionCtor {
50
+ deserialize(bytes: Uint8Array): VersionedTransactionLike;
51
+ }
52
+ /**
53
+ * The minimal slice of a wallet-adapter `WalletContextState` this shim consumes.
54
+ * Both `publicKey` (anything with a base58 `toString()`/`toBase58()`) and the
55
+ * v1 `signTransaction` are required; a connected adapter exposes both.
56
+ */
57
+ interface WalletAdapterLike {
58
+ /** The connected account's public key (base58 via `toBase58()`/`toString()`). */
59
+ readonly publicKey: {
60
+ toBase58(): string;
61
+ } | {
62
+ toString(): string;
63
+ } | string | null;
64
+ /** web3.js v1 sign — returns the same transaction type, signed. */
65
+ signTransaction?: <T extends VersionedTransactionLike>(transaction: T) => Promise<T>;
66
+ }
67
+ /** Options for {@link signerFromWalletAdapter}. */
68
+ interface SignerFromWalletAdapterOptions {
69
+ /**
70
+ * The web3.js `VersionedTransaction` class (`import { VersionedTransaction }
71
+ * from "@solana/web3.js"`). Required — it is the one piece this no-dep shim
72
+ * cannot supply itself.
73
+ */
74
+ VersionedTransaction: VersionedTransactionCtor;
75
+ }
76
+ /**
77
+ * Bridge a LEGACY `@solana/wallet-adapter` `WalletContextState` into a kit
78
+ * {@link TransactionSigner}.
79
+ *
80
+ * Use only when you cannot reach the wallet through `@solana/react`. The result
81
+ * is a {@link TransactionPartialSigner} (the SDK client owns submission), built
82
+ * by serializing the kit transaction to wire bytes, rehydrating it as a web3.js
83
+ * `VersionedTransaction`, handing THAT to the adapter's `signTransaction`, then
84
+ * decoding the signed wire bytes back to a kit transaction to extract this
85
+ * account's signature.
86
+ *
87
+ * @param adapter - A connected wallet-adapter state (`publicKey` + `signTransaction`).
88
+ * @param options - Must inject the web3.js `VersionedTransaction` class.
89
+ * @returns A kit {@link TransactionSigner} usable as `config.signer`.
90
+ * @throws Error if the adapter is disconnected or lacks `signTransaction`.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * import { VersionedTransaction } from "@solana/web3.js";
95
+ * import { useWallet } from "@solana/wallet-adapter-react";
96
+ *
97
+ * const wallet = useWallet();
98
+ * const signer = signerFromWalletAdapter(wallet, { VersionedTransaction });
99
+ * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.
100
+ * ```
101
+ */
102
+ declare function signerFromWalletAdapter(adapter: WalletAdapterLike, options: SignerFromWalletAdapterOptions): TransactionSigner;
103
+
104
+ /**
105
+ * Bridge a CONNECTED embedded-wallet connection into a kit
106
+ * {@link TransactionSigner}.
107
+ *
108
+ * Call this AFTER `provider.connect()` resolves — it needs the live
109
+ * {@link EmbeddedWalletConnection} (address + `signTransactions`). The hooks
110
+ * layer (`useWalletSigner`) is expected to own the connect lifecycle and call
111
+ * this once a connection exists.
112
+ *
113
+ * @param connection - A live embedded-wallet connection.
114
+ * @returns A kit {@link TransactionSigner} usable as `config.signer`.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * const connection = await provider.connect(); // vendor login
119
+ * const signer = signerFromEmbeddedWallet(connection);
120
+ * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.
121
+ * ```
122
+ */
123
+ declare function signerFromEmbeddedWallet(connection: EmbeddedWalletConnection): TransactionSigner;
124
+
125
+ /** English `signer.*` strings used by the wallet/embedded adapters. */
126
+ declare const EN_SIGNER_STRINGS: {
127
+ readonly "signer.walletNoSignFeature": "Wallet account {address} does not expose a solana:signTransaction feature. Pass options.signTransaction explicitly, or use a Wallet Standard account that supports transaction signing.";
128
+ readonly "signer.walletNoSignature": "The wallet returned no signature for account {address}. The wallet may have rejected or modified the transaction so the fee-payer signature is absent.";
129
+ readonly "signer.embeddedSignatureCount": "Embedded wallet returned {got} signatures for {expected} transactions; expected one per transaction.";
130
+ readonly "signer.walletAdapterDisconnected": "The wallet adapter is not connected (publicKey is null). Connect the wallet before creating a signer.";
131
+ readonly "signer.walletAdapterNoSign": "The wallet adapter does not expose signTransaction. Use a wallet that supports transaction signing, or migrate to the Wallet Standard path (signerFromWalletAccount).";
132
+ };
133
+ /** A `signer.*` message id. */
134
+ type SignerStringId = keyof typeof EN_SIGNER_STRINGS;
135
+
136
+ export { EN_SIGNER_STRINGS, EmbeddedWalletConnection, SignerFromWalletAccountOptions, type SignerFromWalletAdapterOptions, type SignerStringId, type VersionedTransactionCtor, type VersionedTransactionLike, type WalletAdapterLike, WalletStandardAccountLike, signerFromEmbeddedWallet, signerFromWalletAccount, signerFromWalletAdapter };
@@ -0,0 +1,4 @@
1
+ export { EN_SIGNER_STRINGS, signerFromEmbeddedWallet, signerFromWalletAccount, signerFromWalletAdapter } from '../chunk-5OTKSRHM.js';
2
+ import '../chunk-GN5DYVN5.js';
3
+ //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ var kit = require('@solana/kit');
4
+
5
+ // src/signers/embedded-wallet-mock.ts
6
+ var warnedInProduction = false;
7
+ function warnIfProduction() {
8
+ if (warnedInProduction) return;
9
+ warnedInProduction = true;
10
+ const nodeEnv = typeof process !== "undefined" ? process.env?.NODE_ENV : void 0;
11
+ if (nodeEnv === "production") {
12
+ console.warn(
13
+ "[@tetsuo-ai/marketplace-react] createMockEmbeddedWallet() was called with NODE_ENV=production. This mock holds a private key in-process and is for tests ONLY \u2014 never ship it. Use a real embedded-wallet vendor adapter via signerFromEmbeddedWallet()."
14
+ );
15
+ }
16
+ }
17
+ function connectionFromKeyPair(keyPairSigner) {
18
+ const signerAddress = keyPairSigner.address;
19
+ return {
20
+ address: signerAddress,
21
+ keyPairSigner,
22
+ async signTransactions(transactions) {
23
+ const dictionaries = await keyPairSigner.signTransactions(
24
+ transactions
25
+ );
26
+ return dictionaries.map((dict, i) => {
27
+ const signature = dict[signerAddress];
28
+ if (!signature) {
29
+ throw new Error(
30
+ `mock embedded wallet: keypair produced no signature for transaction ${i}`
31
+ );
32
+ }
33
+ return signature;
34
+ });
35
+ }
36
+ };
37
+ }
38
+ function createMockEmbeddedWallet(options = {}) {
39
+ warnIfProduction();
40
+ let connection = null;
41
+ return {
42
+ async connect() {
43
+ if (connection) return connection;
44
+ const keyPairSigner = options.secretKeyBytes ? await kit.createKeyPairSignerFromBytes(options.secretKeyBytes) : await kit.generateKeyPairSigner();
45
+ connection = connectionFromKeyPair(keyPairSigner);
46
+ return connection;
47
+ },
48
+ isConnected() {
49
+ return connection !== null;
50
+ },
51
+ getConnection() {
52
+ return connection;
53
+ },
54
+ async disconnect() {
55
+ connection = null;
56
+ }
57
+ };
58
+ }
59
+
60
+ exports.createMockEmbeddedWallet = createMockEmbeddedWallet;
61
+ //# sourceMappingURL=index.cjs.map
62
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/signers/embedded-wallet-mock.ts"],"names":["createKeyPairSignerFromBytes","generateKeyPairSigner"],"mappings":";;;;;AAyCA,IAAI,kBAAA,GAAqB,KAAA;AACzB,SAAS,gBAAA,GAAyB;AAChC,EAAA,IAAI,kBAAA,EAAoB;AACxB,EAAA,kBAAA,GAAqB,IAAA;AACrB,EAAA,MAAM,U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;AAAA,IACA,aAAA,GAAqD;AACnD,MAAA,OAAO,UAAA;AAAA,IACT,CAAA;AAAA,IACA,MAAM,UAAA,GAA4B;AAChC,MAAA,UAAA,GAAa,IAAA;AAAA,IACf;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["/**\n * Local-keypair MOCK embedded-wallet adapter (PLAN_2 D-1 test seam).\n *\n * A WORKING {@link EmbeddedWalletProvider} backed by a freshly generated kit\n * keypair — it stands in for a real vendor (Privy / Dynamic / Web3Auth) so the\n * \"no wallet, no SOL\" Done-when runs against localnet WITHOUT committing to a\n * vendor. `connect()` mimics \"email login provisions a wallet\": first call\n * generates (or adopts a supplied) keypair; the address is then fundable by a\n * localnet/devnet airdrop exactly like a real freshly created embedded wallet.\n *\n * NOT for production: it holds the private key in-process. The REAL vendor\n * adapter is `[HUMAN]`-gated (it must NOT live here). The interface it\n * implements is the only contract templates/widget depend on.\n *\n * Published ONLY behind the `@tetsuo-ai/marketplace-react/testing` subpath — it\n * is deliberately NOT in the package root barrel or the `./signers` export, so\n * it cannot reach a production bundle by accident. It also warns once if it is\n * ever invoked under `NODE_ENV === \"production\"`.\n *\n * SSR-safe: generation is lazy (inside `connect()`); nothing touches `window`.\n *\n * @module signers/embedded-wallet-mock\n */\nimport {\n createKeyPairSignerFromBytes,\n generateKeyPairSigner,\n type KeyPairSigner,\n type SignatureBytes,\n type Transaction,\n} from \"@solana/kit\";\nimport type {\n EmbeddedWalletConnection,\n EmbeddedWalletProvider,\n} from \"./types.js\";\n\n/**\n * One-time production guard. The mock holds a private key IN-PROCESS and must\n * never ship to production; it lives behind the `./testing` subpath (not the\n * root barrel) so it can't be imported by accident. As a second layer, warn\n * loudly (once) if it is ever invoked under `NODE_ENV === \"production\"`.\n */\nlet warnedInProduction = false;\nfunction warnIfProduction(): void {\n if (warnedInProduction) return;\n warnedInProduction = true;\n const nodeEnv =\n typeof process !== \"undefined\" ? process.env?.NODE_ENV : undefined;\n if (nodeEnv === \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n \"[@tetsuo-ai/marketplace-react] createMockEmbeddedWallet() was called \" +\n \"with NODE_ENV=production. This mock holds a private key in-process \" +\n \"and is for tests ONLY — never ship it. Use a real embedded-wallet \" +\n \"vendor adapter via signerFromEmbeddedWallet().\",\n );\n }\n}\n\n/** Options for {@link createMockEmbeddedWallet}. */\nexport interface MockEmbeddedWalletOptions {\n /**\n * Adopt an existing 64-byte secret key instead of generating one (e.g. to\n * reuse a wallet across a test or pre-seed a known address). When omitted,\n * `connect()` generates a fresh keypair on first call — the realistic\n * \"new email user\" flow.\n */\n secretKeyBytes?: Uint8Array;\n}\n\n/**\n * A mock embedded-wallet provider whose connection exposes the backing\n * {@link KeyPairSigner} (test escape hatch — real vendors never leak the key).\n */\nexport interface MockEmbeddedWalletProvider extends EmbeddedWalletProvider {\n connect(): Promise<MockEmbeddedWalletConnection>;\n getConnection(): MockEmbeddedWalletConnection | null;\n}\n\n/** A mock connection that also surfaces the underlying keypair signer. */\nexport interface MockEmbeddedWalletConnection extends EmbeddedWalletConnection {\n /** The local keypair signer backing this connection (test-only). */\n readonly keyPairSigner: KeyPairSigner;\n}\n\n/** Lift a kit {@link KeyPairSigner} into the embedded-wallet connection shape. */\nfunction connectionFromKeyPair(\n keyPairSigner: KeyPairSigner,\n): MockEmbeddedWalletConnection {\n const signerAddress = keyPairSigner.address;\n return {\n address: signerAddress,\n keyPairSigner,\n async signTransactions(\n transactions: readonly Transaction[],\n ): Promise<readonly SignatureBytes[]> {\n // KeyPairSigner.signTransactions returns one SignatureDictionary per tx;\n // pull THIS address's signature out of each to match the embedded\n // connection's flat SignatureBytes[] contract.\n const dictionaries = await keyPairSigner.signTransactions(\n transactions as Parameters<KeyPairSigner[\"signTransactions\"]>[0],\n );\n return dictionaries.map((dict, i) => {\n const signature = dict[signerAddress];\n if (!signature) {\n throw new Error(\n `mock embedded wallet: keypair produced no signature for transaction ${i}`,\n );\n }\n return signature;\n });\n },\n };\n}\n\n/**\n * Create a local-keypair-backed mock {@link EmbeddedWalletProvider}.\n *\n * Use it to exercise the walletless path end-to-end: `connect()` to provision\n * the wallet, airdrop/fund its `address`, then `signerFromEmbeddedWallet(conn)`\n * to drive a real hire through the SDK client.\n *\n * @param options - Optionally adopt a known secret key.\n * @returns A mock provider (its connection leaks the keypair, for tests only).\n *\n * @example\n * ```ts\n * const provider = createMockEmbeddedWallet();\n * const conn = await provider.connect(); // \"email login\"\n * svm.airdrop(address(conn.address), lamports(1_000_000_000n)); // fund it\n * const signer = signerFromEmbeddedWallet(conn);\n * ```\n */\nexport function createMockEmbeddedWallet(\n options: MockEmbeddedWalletOptions = {},\n): MockEmbeddedWalletProvider {\n warnIfProduction();\n let connection: MockEmbeddedWalletConnection | null = null;\n\n return {\n async connect(): Promise<MockEmbeddedWalletConnection> {\n if (connection) return connection;\n const keyPairSigner = options.secretKeyBytes\n ? await createKeyPairSignerFromBytes(options.secretKeyBytes)\n : await generateKeyPairSigner();\n connection = connectionFromKeyPair(keyPairSigner);\n return connection;\n },\n isConnected(): boolean {\n return connection !== null;\n },\n getConnection(): MockEmbeddedWalletConnection | null {\n return connection;\n },\n async disconnect(): Promise<void> {\n connection = null;\n },\n };\n}\n"]}