@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.
- package/CHANGELOG.md +28 -0
- package/LICENSE +21 -0
- package/README.md +172 -0
- package/dist/chunk-5OTKSRHM.js +128 -0
- package/dist/chunk-5OTKSRHM.js.map +1 -0
- package/dist/chunk-ABS77JB2.js +94 -0
- package/dist/chunk-ABS77JB2.js.map +1 -0
- package/dist/chunk-GN5DYVN5.js +35 -0
- package/dist/chunk-GN5DYVN5.js.map +1 -0
- package/dist/chunk-KJMR6OGC.js +1198 -0
- package/dist/chunk-KJMR6OGC.js.map +1 -0
- package/dist/chunk-YORZNYZZ.js +107 -0
- package/dist/chunk-YORZNYZZ.js.map +1 -0
- package/dist/components/agenc-components.css +570 -0
- package/dist/components/index.cjs +1335 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +5 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +5 -0
- package/dist/components/index.js.map +1 -0
- package/dist/hooks/index.cjs +493 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +294 -0
- package/dist/hooks/index.d.ts +294 -0
- package/dist/hooks/index.js +339 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index-BLrlBVj-.d.cts +1129 -0
- package/dist/index-CKTYsNPH.d.ts +1129 -0
- package/dist/index.cjs +1690 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +235 -0
- package/dist/index.d.ts +235 -0
- package/dist/index.js +127 -0
- package/dist/index.js.map +1 -0
- package/dist/signers/index.cjs +166 -0
- package/dist/signers/index.cjs.map +1 -0
- package/dist/signers/index.d.cts +136 -0
- package/dist/signers/index.d.ts +136 -0
- package/dist/signers/index.js +4 -0
- package/dist/signers/index.js.map +1 -0
- package/dist/testing/index.cjs +62 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +71 -0
- package/dist/testing/index.d.ts +71 -0
- package/dist/testing/index.js +60 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/theme/agenc-tailwind-preset.cjs +184 -0
- package/dist/theme/agenc-tokens.css +132 -0
- package/dist/types-jvISR6bc.d.cts +135 -0
- package/dist/types-jvISR6bc.d.ts +135 -0
- package/dist/useAgentTrackRecord-BLf1nrbu.d.cts +249 -0
- package/dist/useAgentTrackRecord-BLf1nrbu.d.ts +249 -0
- package/package.json +139 -0
- package/src/components/DisputeBanner.stories.tsx +39 -0
- package/src/components/DisputeBanner.tsx +110 -0
- package/src/components/HireButton.stories.tsx +72 -0
- package/src/components/HireButton.tsx +151 -0
- package/src/components/HireCheckoutModal.stories.tsx +107 -0
- package/src/components/HireCheckoutModal.tsx +284 -0
- package/src/components/ListingCard.stories.tsx +55 -0
- package/src/components/ListingCard.tsx +148 -0
- package/src/components/ListingGrid.stories.tsx +44 -0
- package/src/components/ListingGrid.tsx +137 -0
- package/src/components/Modal.tsx +121 -0
- package/src/components/PoweredByAgenC.tsx +85 -0
- package/src/components/ProviderCard.stories.tsx +61 -0
- package/src/components/ProviderCard.tsx +154 -0
- package/src/components/ReferrerDisclosure.tsx +67 -0
- package/src/components/ReviewPanel.stories.tsx +65 -0
- package/src/components/ReviewPanel.tsx +141 -0
- package/src/components/TaskTimeline.stories.tsx +43 -0
- package/src/components/TaskTimeline.tsx +156 -0
- package/src/components/__fixtures__/index.tsx +173 -0
- package/src/components/agenc-components.css +570 -0
- package/src/components/badges.tsx +115 -0
- package/src/components/format.ts +150 -0
- package/src/components/index.ts +102 -0
- package/src/components/primitives.tsx +236 -0
- package/src/components/strings.ts +131 -0
- package/src/components/useFocusTrap.ts +122 -0
- package/src/hooks/index.ts +90 -0
- package/src/hooks/internal.ts +70 -0
- package/src/hooks/useAgentTrackRecord.ts +166 -0
- package/src/hooks/useDispute.ts +130 -0
- package/src/hooks/useHire.ts +198 -0
- package/src/hooks/useListing.ts +138 -0
- package/src/hooks/useListings.ts +133 -0
- package/src/hooks/useReferrerEarnings.ts +134 -0
- package/src/hooks/useSubmissionReview.ts +179 -0
- package/src/hooks/useTaskStatus.ts +192 -0
- package/src/hooks/useWalletSigner.ts +99 -0
- package/src/index.ts +170 -0
- package/src/provider/AgencProvider.tsx +169 -0
- package/src/provider/context.ts +35 -0
- package/src/provider/index.ts +17 -0
- package/src/provider/network.ts +68 -0
- package/src/provider/referrer.ts +97 -0
- package/src/signers/README.md +130 -0
- package/src/signers/embedded-wallet-mock.ts +158 -0
- package/src/signers/embedded-wallet.ts +64 -0
- package/src/signers/index.ts +48 -0
- package/src/signers/strings.ts +39 -0
- package/src/signers/types.ts +158 -0
- package/src/signers/wallet-account.ts +128 -0
- package/src/signers/wallet-adapter.ts +149 -0
- package/src/strings/index.ts +119 -0
- package/src/testing/index.ts +24 -0
- package/src/theme/agenc-tailwind-preset.cjs +184 -0
- package/src/theme/agenc-tokens.css +132 -0
- package/src/theme/index.ts +94 -0
- package/src/transport/index.ts +164 -0
- package/src/types.ts +224 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { KeyPairSigner } from '@solana/kit';
|
|
2
|
+
import { E as EmbeddedWalletConnection, a as EmbeddedWalletProvider } from '../types-jvISR6bc.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Local-keypair MOCK embedded-wallet adapter (PLAN_2 D-1 test seam).
|
|
6
|
+
*
|
|
7
|
+
* A WORKING {@link EmbeddedWalletProvider} backed by a freshly generated kit
|
|
8
|
+
* keypair — it stands in for a real vendor (Privy / Dynamic / Web3Auth) so the
|
|
9
|
+
* "no wallet, no SOL" Done-when runs against localnet WITHOUT committing to a
|
|
10
|
+
* vendor. `connect()` mimics "email login provisions a wallet": first call
|
|
11
|
+
* generates (or adopts a supplied) keypair; the address is then fundable by a
|
|
12
|
+
* localnet/devnet airdrop exactly like a real freshly created embedded wallet.
|
|
13
|
+
*
|
|
14
|
+
* NOT for production: it holds the private key in-process. The REAL vendor
|
|
15
|
+
* adapter is `[HUMAN]`-gated (it must NOT live here). The interface it
|
|
16
|
+
* implements is the only contract templates/widget depend on.
|
|
17
|
+
*
|
|
18
|
+
* Published ONLY behind the `@tetsuo-ai/marketplace-react/testing` subpath — it
|
|
19
|
+
* is deliberately NOT in the package root barrel or the `./signers` export, so
|
|
20
|
+
* it cannot reach a production bundle by accident. It also warns once if it is
|
|
21
|
+
* ever invoked under `NODE_ENV === "production"`.
|
|
22
|
+
*
|
|
23
|
+
* SSR-safe: generation is lazy (inside `connect()`); nothing touches `window`.
|
|
24
|
+
*
|
|
25
|
+
* @module signers/embedded-wallet-mock
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** Options for {@link createMockEmbeddedWallet}. */
|
|
29
|
+
interface MockEmbeddedWalletOptions {
|
|
30
|
+
/**
|
|
31
|
+
* Adopt an existing 64-byte secret key instead of generating one (e.g. to
|
|
32
|
+
* reuse a wallet across a test or pre-seed a known address). When omitted,
|
|
33
|
+
* `connect()` generates a fresh keypair on first call — the realistic
|
|
34
|
+
* "new email user" flow.
|
|
35
|
+
*/
|
|
36
|
+
secretKeyBytes?: Uint8Array;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A mock embedded-wallet provider whose connection exposes the backing
|
|
40
|
+
* {@link KeyPairSigner} (test escape hatch — real vendors never leak the key).
|
|
41
|
+
*/
|
|
42
|
+
interface MockEmbeddedWalletProvider extends EmbeddedWalletProvider {
|
|
43
|
+
connect(): Promise<MockEmbeddedWalletConnection>;
|
|
44
|
+
getConnection(): MockEmbeddedWalletConnection | null;
|
|
45
|
+
}
|
|
46
|
+
/** A mock connection that also surfaces the underlying keypair signer. */
|
|
47
|
+
interface MockEmbeddedWalletConnection extends EmbeddedWalletConnection {
|
|
48
|
+
/** The local keypair signer backing this connection (test-only). */
|
|
49
|
+
readonly keyPairSigner: KeyPairSigner;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create a local-keypair-backed mock {@link EmbeddedWalletProvider}.
|
|
53
|
+
*
|
|
54
|
+
* Use it to exercise the walletless path end-to-end: `connect()` to provision
|
|
55
|
+
* the wallet, airdrop/fund its `address`, then `signerFromEmbeddedWallet(conn)`
|
|
56
|
+
* to drive a real hire through the SDK client.
|
|
57
|
+
*
|
|
58
|
+
* @param options - Optionally adopt a known secret key.
|
|
59
|
+
* @returns A mock provider (its connection leaks the keypair, for tests only).
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const provider = createMockEmbeddedWallet();
|
|
64
|
+
* const conn = await provider.connect(); // "email login"
|
|
65
|
+
* svm.airdrop(address(conn.address), lamports(1_000_000_000n)); // fund it
|
|
66
|
+
* const signer = signerFromEmbeddedWallet(conn);
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare function createMockEmbeddedWallet(options?: MockEmbeddedWalletOptions): MockEmbeddedWalletProvider;
|
|
70
|
+
|
|
71
|
+
export { type MockEmbeddedWalletConnection, type MockEmbeddedWalletOptions, type MockEmbeddedWalletProvider, createMockEmbeddedWallet };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { KeyPairSigner } from '@solana/kit';
|
|
2
|
+
import { E as EmbeddedWalletConnection, a as EmbeddedWalletProvider } from '../types-jvISR6bc.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Local-keypair MOCK embedded-wallet adapter (PLAN_2 D-1 test seam).
|
|
6
|
+
*
|
|
7
|
+
* A WORKING {@link EmbeddedWalletProvider} backed by a freshly generated kit
|
|
8
|
+
* keypair — it stands in for a real vendor (Privy / Dynamic / Web3Auth) so the
|
|
9
|
+
* "no wallet, no SOL" Done-when runs against localnet WITHOUT committing to a
|
|
10
|
+
* vendor. `connect()` mimics "email login provisions a wallet": first call
|
|
11
|
+
* generates (or adopts a supplied) keypair; the address is then fundable by a
|
|
12
|
+
* localnet/devnet airdrop exactly like a real freshly created embedded wallet.
|
|
13
|
+
*
|
|
14
|
+
* NOT for production: it holds the private key in-process. The REAL vendor
|
|
15
|
+
* adapter is `[HUMAN]`-gated (it must NOT live here). The interface it
|
|
16
|
+
* implements is the only contract templates/widget depend on.
|
|
17
|
+
*
|
|
18
|
+
* Published ONLY behind the `@tetsuo-ai/marketplace-react/testing` subpath — it
|
|
19
|
+
* is deliberately NOT in the package root barrel or the `./signers` export, so
|
|
20
|
+
* it cannot reach a production bundle by accident. It also warns once if it is
|
|
21
|
+
* ever invoked under `NODE_ENV === "production"`.
|
|
22
|
+
*
|
|
23
|
+
* SSR-safe: generation is lazy (inside `connect()`); nothing touches `window`.
|
|
24
|
+
*
|
|
25
|
+
* @module signers/embedded-wallet-mock
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** Options for {@link createMockEmbeddedWallet}. */
|
|
29
|
+
interface MockEmbeddedWalletOptions {
|
|
30
|
+
/**
|
|
31
|
+
* Adopt an existing 64-byte secret key instead of generating one (e.g. to
|
|
32
|
+
* reuse a wallet across a test or pre-seed a known address). When omitted,
|
|
33
|
+
* `connect()` generates a fresh keypair on first call — the realistic
|
|
34
|
+
* "new email user" flow.
|
|
35
|
+
*/
|
|
36
|
+
secretKeyBytes?: Uint8Array;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A mock embedded-wallet provider whose connection exposes the backing
|
|
40
|
+
* {@link KeyPairSigner} (test escape hatch — real vendors never leak the key).
|
|
41
|
+
*/
|
|
42
|
+
interface MockEmbeddedWalletProvider extends EmbeddedWalletProvider {
|
|
43
|
+
connect(): Promise<MockEmbeddedWalletConnection>;
|
|
44
|
+
getConnection(): MockEmbeddedWalletConnection | null;
|
|
45
|
+
}
|
|
46
|
+
/** A mock connection that also surfaces the underlying keypair signer. */
|
|
47
|
+
interface MockEmbeddedWalletConnection extends EmbeddedWalletConnection {
|
|
48
|
+
/** The local keypair signer backing this connection (test-only). */
|
|
49
|
+
readonly keyPairSigner: KeyPairSigner;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create a local-keypair-backed mock {@link EmbeddedWalletProvider}.
|
|
53
|
+
*
|
|
54
|
+
* Use it to exercise the walletless path end-to-end: `connect()` to provision
|
|
55
|
+
* the wallet, airdrop/fund its `address`, then `signerFromEmbeddedWallet(conn)`
|
|
56
|
+
* to drive a real hire through the SDK client.
|
|
57
|
+
*
|
|
58
|
+
* @param options - Optionally adopt a known secret key.
|
|
59
|
+
* @returns A mock provider (its connection leaks the keypair, for tests only).
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const provider = createMockEmbeddedWallet();
|
|
64
|
+
* const conn = await provider.connect(); // "email login"
|
|
65
|
+
* svm.airdrop(address(conn.address), lamports(1_000_000_000n)); // fund it
|
|
66
|
+
* const signer = signerFromEmbeddedWallet(conn);
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare function createMockEmbeddedWallet(options?: MockEmbeddedWalletOptions): MockEmbeddedWalletProvider;
|
|
70
|
+
|
|
71
|
+
export { type MockEmbeddedWalletConnection, type MockEmbeddedWalletOptions, type MockEmbeddedWalletProvider, createMockEmbeddedWallet };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createKeyPairSignerFromBytes, generateKeyPairSigner } from '@solana/kit';
|
|
2
|
+
|
|
3
|
+
// src/signers/embedded-wallet-mock.ts
|
|
4
|
+
var warnedInProduction = false;
|
|
5
|
+
function warnIfProduction() {
|
|
6
|
+
if (warnedInProduction) return;
|
|
7
|
+
warnedInProduction = true;
|
|
8
|
+
const nodeEnv = typeof process !== "undefined" ? process.env?.NODE_ENV : void 0;
|
|
9
|
+
if (nodeEnv === "production") {
|
|
10
|
+
console.warn(
|
|
11
|
+
"[@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()."
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function connectionFromKeyPair(keyPairSigner) {
|
|
16
|
+
const signerAddress = keyPairSigner.address;
|
|
17
|
+
return {
|
|
18
|
+
address: signerAddress,
|
|
19
|
+
keyPairSigner,
|
|
20
|
+
async signTransactions(transactions) {
|
|
21
|
+
const dictionaries = await keyPairSigner.signTransactions(
|
|
22
|
+
transactions
|
|
23
|
+
);
|
|
24
|
+
return dictionaries.map((dict, i) => {
|
|
25
|
+
const signature = dict[signerAddress];
|
|
26
|
+
if (!signature) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
`mock embedded wallet: keypair produced no signature for transaction ${i}`
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
return signature;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function createMockEmbeddedWallet(options = {}) {
|
|
37
|
+
warnIfProduction();
|
|
38
|
+
let connection = null;
|
|
39
|
+
return {
|
|
40
|
+
async connect() {
|
|
41
|
+
if (connection) return connection;
|
|
42
|
+
const keyPairSigner = options.secretKeyBytes ? await createKeyPairSignerFromBytes(options.secretKeyBytes) : await generateKeyPairSigner();
|
|
43
|
+
connection = connectionFromKeyPair(keyPairSigner);
|
|
44
|
+
return connection;
|
|
45
|
+
},
|
|
46
|
+
isConnected() {
|
|
47
|
+
return connection !== null;
|
|
48
|
+
},
|
|
49
|
+
getConnection() {
|
|
50
|
+
return connection;
|
|
51
|
+
},
|
|
52
|
+
async disconnect() {
|
|
53
|
+
connection = null;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { createMockEmbeddedWallet };
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/signers/embedded-wallet-mock.ts"],"names":[],"mappings":";;;AAyCA,IAAI,kBAAA,GAAqB,KAAA;AACzB,SAAS,gBAAA,GAAyB;AAChC,EAAA,IAAI,kBAAA,EAAoB;AACxB,EAAA,kBAAA,GAAqB,IAAA;AACrB,EAAA,MAAM,UACJ,OAAO,OAAA,KAAY,WAAA,GAAc,OAAA,CAAQ,KAAK,QAAA,GAAW,MAAA;AAC3D,EAAA,IAAI,YAAY,YAAA,EAAc;AAE5B,IAAA,OAAA,CAAQ,IAAA;AAAA,MACN;AAAA,KAIF;AAAA,EACF;AACF;AA6BA,SAAS,sBACP,aAAA,EAC8B;AAC9B,EAAA,MAAM,gBAAgB,aAAA,CAAc,OAAA;AACpC,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,aAAA;AAAA,IACT,aAAA;AAAA,IACA,MAAM,iBACJ,YAAA,EACoC;AAIpC,MAAA,MAAM,YAAA,GAAe,MAAM,aAAA,CAAc,gBAAA;AAAA,QACvC;AAAA,OACF;AACA,MAAA,OAAO,YAAA,CAAa,GAAA,CAAI,CAAC,IAAA,EAAM,CAAA,KAAM;AACnC,QAAA,MAAM,SAAA,GAAY,KAAK,aAAa,CAAA;AACpC,QAAA,IAAI,CAAC,SAAA,EAAW;AACd,UAAA,MAAM,IAAI,KAAA;AAAA,YACR,uEAAuE,CAAC,CAAA;AAAA,WAC1E;AAAA,QACF;AACA,QAAA,OAAO,SAAA;AAAA,MACT,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF;AAoBO,SAAS,wBAAA,CACd,OAAA,GAAqC,EAAC,EACV;AAC5B,EAAA,gBAAA,EAAiB;AACjB,EAAA,IAAI,UAAA,GAAkD,IAAA;AAEtD,EAAA,OAAO;AAAA,IACL,MAAM,OAAA,GAAiD;AACrD,MAAA,IAAI,YAAY,OAAO,UAAA;AACvB,MAAA,MAAM,aAAA,GAAgB,QAAQ,cAAA,GAC1B,MAAM,6BAA6B,OAAA,CAAQ,cAAc,CAAA,GACzD,MAAM,qBAAA,EAAsB;AAChC,MAAA,UAAA,GAAa,sBAAsB,aAAa,CAAA;AAChD,MAAA,OAAO,UAAA;AAAA,IACT,CAAA;AAAA,IACA,WAAA,GAAuB;AACrB,MAAA,OAAO,UAAA,KAAe,IAAA;AAAA,IACxB,CAAA;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.js","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"]}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* VENDORED — do not hand-edit for brand changes; re-sync from source.
|
|
3
|
+
*
|
|
4
|
+
* Source repo: agenc-ui-design-skill (sibling repo, NOT importable in CI)
|
|
5
|
+
* Source path: tokens/tailwind.config.cjs
|
|
6
|
+
* Source commit: c842bba8eb9e8d029a13fbfd111686f831cd566f (2026-04-29)
|
|
7
|
+
* Vendored into: packages/marketplace-react/src/theme/agenc-tailwind-preset.cjs
|
|
8
|
+
* Reason: cross-repo imports are impossible in CI; consumers read the
|
|
9
|
+
* AgenC Tailwind preset FROM this package via
|
|
10
|
+
* "@tetsuo-ai/marketplace-react/tailwind-preset".
|
|
11
|
+
* Resync: copy tokens/tailwind.config.cjs from agenc-ui-design-skill
|
|
12
|
+
* HEAD and update the commit line above.
|
|
13
|
+
* ============================================================================
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Tetsuo.ai / AgenC Tailwind config fragment.
|
|
18
|
+
*
|
|
19
|
+
* Drop-in extension for an existing Tailwind v3+ project (works alongside
|
|
20
|
+
* shadcn/ui's default config). Colors are sRGB hex.
|
|
21
|
+
*
|
|
22
|
+
* Usage in your tailwind.config.{js,cjs,ts}:
|
|
23
|
+
*
|
|
24
|
+
* const tetsuo = require('./path/to/tokens/tailwind.config.cjs');
|
|
25
|
+
* module.exports = {
|
|
26
|
+
* content: [...],
|
|
27
|
+
* theme: {
|
|
28
|
+
* extend: {
|
|
29
|
+
* ...tetsuo.theme.extend,
|
|
30
|
+
* },
|
|
31
|
+
* },
|
|
32
|
+
* plugins: [tetsuo.plugin],
|
|
33
|
+
* };
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
const plugin = require('tailwindcss/plugin');
|
|
37
|
+
|
|
38
|
+
const colors = {
|
|
39
|
+
// AgenC neon (canonical product palette)
|
|
40
|
+
agenc: {
|
|
41
|
+
void: '#0A0612',
|
|
42
|
+
surface: '#16102A',
|
|
43
|
+
'surface-2': '#221638',
|
|
44
|
+
'surface-3': '#2E1A4A',
|
|
45
|
+
violet: '#7B3FFF',
|
|
46
|
+
magenta: '#FF2E93',
|
|
47
|
+
orange: '#FF6B1A',
|
|
48
|
+
cyan: '#48C8EF',
|
|
49
|
+
grid: '#3A1F66',
|
|
50
|
+
text: '#F5F0FF',
|
|
51
|
+
'text-muted': '#B8A8D9',
|
|
52
|
+
'text-dim': '#6E5C8F',
|
|
53
|
+
success: '#3FFFA0',
|
|
54
|
+
warning: '#FFC53F',
|
|
55
|
+
danger: '#FF3D3D',
|
|
56
|
+
border: '#2E1A4A',
|
|
57
|
+
'border-strong': '#4A2E7A',
|
|
58
|
+
},
|
|
59
|
+
// Tetsuo.ai noir (marketing / community)
|
|
60
|
+
tetsuo: {
|
|
61
|
+
noir: '#0A0A0A',
|
|
62
|
+
'noir-2': '#141414',
|
|
63
|
+
paper: '#F8F5E9',
|
|
64
|
+
'akira-red': '#E30426',
|
|
65
|
+
'akira-red-bright': '#FA1232',
|
|
66
|
+
blood: '#7A0000',
|
|
67
|
+
cyan: '#48C8EF',
|
|
68
|
+
magenta: '#D01D7D',
|
|
69
|
+
'synth-pink': '#EF5EC2',
|
|
70
|
+
'synth-pink-soft': '#F3A8CE',
|
|
71
|
+
'synth-purple': '#7B3FFF',
|
|
72
|
+
'synth-eggplant': '#441535',
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const backgroundImage = {
|
|
77
|
+
'agenc-gradient': 'linear-gradient(135deg, #7B3FFF 0%, #FF2E93 60%, #FF6B1A 100%)',
|
|
78
|
+
'agenc-gradient-cool': 'linear-gradient(135deg, #48C8EF 0%, #7B3FFF 100%)',
|
|
79
|
+
'agenc-gradient-text': 'linear-gradient(90deg, #7B3FFF 0%, #FF2E93 50%, #FF6B1A 100%)',
|
|
80
|
+
'tetsuo-gradient-glitch': 'linear-gradient(90deg, #48C8EF 0%, #D01D7D 100%)',
|
|
81
|
+
'tetsuo-gradient-synth':
|
|
82
|
+
'linear-gradient(135deg, #441535 0%, #D01D7D 50%, #EF5EC2 100%)',
|
|
83
|
+
// Synthwave grid floor — pair with a perspective transform on a child
|
|
84
|
+
'agenc-grid-floor':
|
|
85
|
+
'linear-gradient(transparent 95%, #3A1F66 95%), linear-gradient(90deg, transparent 95%, #3A1F66 95%)',
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const boxShadow = {
|
|
89
|
+
'glow-violet': '0 0 24px rgba(123, 63, 255, 0.4), 0 0 48px rgba(123, 63, 255, 0.2)',
|
|
90
|
+
'glow-magenta': '0 0 24px rgba(255, 46, 147, 0.4), 0 0 48px rgba(255, 46, 147, 0.2)',
|
|
91
|
+
'glow-cyan': '0 0 24px rgba(72, 200, 239, 0.4), 0 0 48px rgba(72, 200, 239, 0.2)',
|
|
92
|
+
'glow-orange': '0 0 24px rgba(255, 107, 26, 0.4), 0 0 48px rgba(255, 107, 26, 0.2)',
|
|
93
|
+
'glow-akira': '0 0 24px rgba(227, 4, 38, 0.5), 0 0 64px rgba(227, 4, 38, 0.25)',
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const fontFamily = {
|
|
97
|
+
// Display: jagged / glitch / cyberpunk. Pick one and load via @font-face.
|
|
98
|
+
'agenc-display': ['"Audiowide"', '"Major Mono Display"', 'system-ui', 'sans-serif'],
|
|
99
|
+
// Body: clean geometric sans
|
|
100
|
+
'agenc-body': ['"Geist"', '"Inter"', 'system-ui', 'sans-serif'],
|
|
101
|
+
// Mono: for HUD / status / readouts
|
|
102
|
+
'agenc-mono': ['"JetBrains Mono"', '"IBM Plex Mono"', 'ui-monospace', 'monospace'],
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const fontSize = {
|
|
106
|
+
// Display scale skews dramatic — these are AgenC-specific overrides.
|
|
107
|
+
'display-xs': ['2rem', { lineHeight: '1.05', letterSpacing: '-0.02em' }],
|
|
108
|
+
'display-sm': ['2.5rem', { lineHeight: '1.05', letterSpacing: '-0.02em' }],
|
|
109
|
+
'display-md': ['3.5rem', { lineHeight: '1.0', letterSpacing: '-0.03em' }],
|
|
110
|
+
'display-lg': ['5rem', { lineHeight: '0.95', letterSpacing: '-0.04em' }],
|
|
111
|
+
'display-xl': ['7rem', { lineHeight: '0.9', letterSpacing: '-0.04em' }],
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// Plugin: utilities that aren't trivially expressible as theme extensions.
|
|
115
|
+
const tetsuoPlugin = plugin(function ({ addUtilities, addComponents }) {
|
|
116
|
+
addUtilities({
|
|
117
|
+
// Chromatic aberration glitch text — drop on any text element.
|
|
118
|
+
'.text-glitch': {
|
|
119
|
+
position: 'relative',
|
|
120
|
+
color: '#F8F5E9',
|
|
121
|
+
textShadow: '2px 0 0 #48C8EF, -2px 0 0 #D01D7D',
|
|
122
|
+
},
|
|
123
|
+
'.text-glitch-strong': {
|
|
124
|
+
position: 'relative',
|
|
125
|
+
color: '#F8F5E9',
|
|
126
|
+
textShadow: '3px 0 0 #48C8EF, -3px 0 0 #D01D7D, 0 0 8px rgba(255,255,255,0.15)',
|
|
127
|
+
},
|
|
128
|
+
// Neon-stroked outline text
|
|
129
|
+
'.text-neon-stroke': {
|
|
130
|
+
color: 'transparent',
|
|
131
|
+
WebkitTextStroke: '1.5px #FF2E93',
|
|
132
|
+
textShadow: '0 0 12px rgba(255, 46, 147, 0.6)',
|
|
133
|
+
},
|
|
134
|
+
// Scanline overlay — apply to a positioned container.
|
|
135
|
+
'.bg-scanlines': {
|
|
136
|
+
backgroundImage:
|
|
137
|
+
'repeating-linear-gradient(0deg, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(0,0,0,0.18) 2px, rgba(0,0,0,0.18) 3px)',
|
|
138
|
+
},
|
|
139
|
+
// CRT vignette
|
|
140
|
+
'.bg-vignette': {
|
|
141
|
+
backgroundImage:
|
|
142
|
+
'radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.55) 100%)',
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
addComponents({
|
|
147
|
+
// HUD frame: corner brackets only, transparent middle.
|
|
148
|
+
'.hud-frame': {
|
|
149
|
+
position: 'relative',
|
|
150
|
+
padding: '24px',
|
|
151
|
+
'&::before, &::after': {
|
|
152
|
+
content: '""',
|
|
153
|
+
position: 'absolute',
|
|
154
|
+
width: '24px',
|
|
155
|
+
height: '24px',
|
|
156
|
+
borderColor: '#7B3FFF',
|
|
157
|
+
borderStyle: 'solid',
|
|
158
|
+
},
|
|
159
|
+
'&::before': {
|
|
160
|
+
top: '0',
|
|
161
|
+
left: '0',
|
|
162
|
+
borderWidth: '2px 0 0 2px',
|
|
163
|
+
},
|
|
164
|
+
'&::after': {
|
|
165
|
+
bottom: '0',
|
|
166
|
+
right: '0',
|
|
167
|
+
borderWidth: '0 2px 2px 0',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
module.exports = {
|
|
174
|
+
theme: {
|
|
175
|
+
extend: {
|
|
176
|
+
colors,
|
|
177
|
+
backgroundImage,
|
|
178
|
+
boxShadow,
|
|
179
|
+
fontFamily,
|
|
180
|
+
fontSize,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
plugin: tetsuoPlugin,
|
|
184
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* VENDORED — do not hand-edit for brand changes; re-sync from source.
|
|
3
|
+
*
|
|
4
|
+
* Source repo: agenc-ui-design-skill (sibling repo, NOT importable in CI)
|
|
5
|
+
* Source path: tokens/colors.css
|
|
6
|
+
* Source commit: c842bba8eb9e8d029a13fbfd111686f831cd566f (2026-04-29)
|
|
7
|
+
* Vendored into: packages/marketplace-react/src/theme/agenc-tokens.css
|
|
8
|
+
* Reason: cross-repo imports are impossible in CI; store-core and every
|
|
9
|
+
* downstream consumer reads the AgenC theme FROM this package,
|
|
10
|
+
* never from the design-skill repo directly.
|
|
11
|
+
* Resync: copy tokens/colors.css from agenc-ui-design-skill HEAD and
|
|
12
|
+
* update the commit line above.
|
|
13
|
+
* ============================================================================
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/* Tetsuo.ai / AgenC color tokens.
|
|
17
|
+
*
|
|
18
|
+
* All values are 8-bit sRGB hex. Sampled from official brand assets
|
|
19
|
+
* (mood-board/) where possible; the AgenC neon palette is derived from the
|
|
20
|
+
* AgenC "prompt cache > giant agent bills" infographic.
|
|
21
|
+
*
|
|
22
|
+
* Two modes:
|
|
23
|
+
* - .agenc → AgenC framework UI (canonical for product surfaces)
|
|
24
|
+
* - .tetsuo-noir → Tetsuo.ai marketing/community surfaces (Akira homage)
|
|
25
|
+
*
|
|
26
|
+
* Default :root applies the AgenC neon mode. Add `class="tetsuo-noir"` to a
|
|
27
|
+
* surface root to switch into the noir palette.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
:root,
|
|
31
|
+
.agenc {
|
|
32
|
+
/* Surfaces */
|
|
33
|
+
--agenc-void: #0A0612; /* deepest layer, page background */
|
|
34
|
+
--agenc-surface: #16102A; /* card / panel */
|
|
35
|
+
--agenc-surface-2: #221638; /* raised surface, modal */
|
|
36
|
+
--agenc-surface-3: #2E1A4A; /* hover / elevated */
|
|
37
|
+
|
|
38
|
+
/* Brand accents */
|
|
39
|
+
--agenc-violet: #7B3FFF; /* primary brand purple */
|
|
40
|
+
--agenc-magenta: #FF2E93; /* secondary accent */
|
|
41
|
+
--agenc-orange: #FF6B1A; /* highlight only */
|
|
42
|
+
--agenc-cyan: #48C8EF; /* HUD / readout accent */
|
|
43
|
+
--agenc-grid: #3A1F66; /* circuit lines, grid floor */
|
|
44
|
+
|
|
45
|
+
/* Text */
|
|
46
|
+
--agenc-text: #F5F0FF; /* primary on dark */
|
|
47
|
+
--agenc-text-muted: #B8A8D9; /* secondary on dark */
|
|
48
|
+
--agenc-text-dim: #6E5C8F; /* tertiary / disabled */
|
|
49
|
+
|
|
50
|
+
/* Semantic */
|
|
51
|
+
--agenc-success: #3FFFA0;
|
|
52
|
+
--agenc-warning: #FFC53F;
|
|
53
|
+
--agenc-danger: #FF3D3D;
|
|
54
|
+
|
|
55
|
+
/* Gradients */
|
|
56
|
+
--agenc-gradient-primary:
|
|
57
|
+
linear-gradient(135deg, #7B3FFF 0%, #FF2E93 60%, #FF6B1A 100%);
|
|
58
|
+
--agenc-gradient-cool:
|
|
59
|
+
linear-gradient(135deg, #48C8EF 0%, #7B3FFF 100%);
|
|
60
|
+
--agenc-gradient-text:
|
|
61
|
+
linear-gradient(90deg, #7B3FFF 0%, #FF2E93 50%, #FF6B1A 100%);
|
|
62
|
+
|
|
63
|
+
/* Glows (use as box-shadow / filter drop-shadow) */
|
|
64
|
+
--agenc-glow-violet: 0 0 24px #7B3FFF66, 0 0 48px #7B3FFF33;
|
|
65
|
+
--agenc-glow-magenta: 0 0 24px #FF2E9366, 0 0 48px #FF2E9333;
|
|
66
|
+
--agenc-glow-cyan: 0 0 24px #48C8EF66, 0 0 48px #48C8EF33;
|
|
67
|
+
|
|
68
|
+
/* Strokes */
|
|
69
|
+
--agenc-border: #2E1A4A;
|
|
70
|
+
--agenc-border-strong: #4A2E7A;
|
|
71
|
+
|
|
72
|
+
/* Radii (pixel-honest, not over-rounded) */
|
|
73
|
+
--agenc-radius-sm: 4px;
|
|
74
|
+
--agenc-radius: 8px;
|
|
75
|
+
--agenc-radius-lg: 12px;
|
|
76
|
+
--agenc-radius-pill: 9999px;
|
|
77
|
+
|
|
78
|
+
/* Spacing (4px base) */
|
|
79
|
+
--agenc-space-1: 4px;
|
|
80
|
+
--agenc-space-2: 8px;
|
|
81
|
+
--agenc-space-3: 12px;
|
|
82
|
+
--agenc-space-4: 16px;
|
|
83
|
+
--agenc-space-6: 24px;
|
|
84
|
+
--agenc-space-8: 32px;
|
|
85
|
+
--agenc-space-12: 48px;
|
|
86
|
+
--agenc-space-16: 64px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.tetsuo-noir {
|
|
90
|
+
/* Tetsuo.ai marketing/community palette. Akira homage + manga off-white. */
|
|
91
|
+
|
|
92
|
+
/* Surfaces */
|
|
93
|
+
--tetsuo-noir: #0A0A0A; /* true black background */
|
|
94
|
+
--tetsuo-noir-2: #141414; /* card */
|
|
95
|
+
--tetsuo-paper: #F8F5E9; /* manga off-white (sampled from circle logo) */
|
|
96
|
+
|
|
97
|
+
/* Reds (Akira) */
|
|
98
|
+
--tetsuo-akira-red: #E30426; /* primary red — sampled from banner */
|
|
99
|
+
--tetsuo-akira-red-bright: #FA1232;
|
|
100
|
+
--tetsuo-blood: #7A0000; /* deep red shadow (sampled from malware art) */
|
|
101
|
+
|
|
102
|
+
/* TETSUO.AI logo + $TETSUO synthwave */
|
|
103
|
+
--tetsuo-cyan: #48C8EF; /* sampled from logo */
|
|
104
|
+
--tetsuo-magenta: #D01D7D; /* sampled drop shadow */
|
|
105
|
+
--tetsuo-synth-pink: #EF5EC2; /* sampled from $TETSUO Solana banner */
|
|
106
|
+
--tetsuo-synth-pink-soft: #F3A8CE;
|
|
107
|
+
--tetsuo-synth-purple: #7B3FFF; /* matches AgenC violet — brand-consistent */
|
|
108
|
+
--tetsuo-synth-eggplant: #441535;
|
|
109
|
+
|
|
110
|
+
/* Text */
|
|
111
|
+
--tetsuo-text: #F8F5E9; /* paper on noir */
|
|
112
|
+
--tetsuo-text-muted: #C8BFAA;
|
|
113
|
+
--tetsuo-text-on-paper: #0A0A0A;
|
|
114
|
+
|
|
115
|
+
/* Glitch (chromatic aberration: use cyan + magenta offsets) */
|
|
116
|
+
--tetsuo-glitch-cyan: #48C8EF;
|
|
117
|
+
--tetsuo-glitch-magenta: #D01D7D;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Convenience: when a surface is the noir mode, redefine the AgenC tokens to
|
|
121
|
+
* the noir equivalents so component recipes that target --agenc-* still work
|
|
122
|
+
* without rewriting. Use sparingly — most marketing pages should stay on
|
|
123
|
+
* .tetsuo-noir directly. */
|
|
124
|
+
.tetsuo-noir.bridge-tokens {
|
|
125
|
+
--agenc-void: var(--tetsuo-noir);
|
|
126
|
+
--agenc-surface: var(--tetsuo-noir-2);
|
|
127
|
+
--agenc-text: var(--tetsuo-text);
|
|
128
|
+
--agenc-text-muted: var(--tetsuo-text-muted);
|
|
129
|
+
--agenc-violet: var(--tetsuo-synth-purple);
|
|
130
|
+
--agenc-magenta: var(--tetsuo-magenta);
|
|
131
|
+
--agenc-cyan: var(--tetsuo-cyan);
|
|
132
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Transaction, SignatureBytes } from '@solana/kit';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Signer-adapter contracts for `@tetsuo-ai/marketplace-react`.
|
|
5
|
+
*
|
|
6
|
+
* Two browser → kit `TransactionSigner` bridges live in this subtree:
|
|
7
|
+
*
|
|
8
|
+
* - **Wallet Standard** ({@link signerFromWalletAccount}): wraps a connected
|
|
9
|
+
* browser wallet (the `@solana/react` /
|
|
10
|
+
* `useWalletAccountTransactionSendingSigner` Wallet Standard path, or any
|
|
11
|
+
* object exposing the `solana:signTransaction` feature) into the kit
|
|
12
|
+
* {@link TransactionSigner} the SDK's `createMarketplaceClient` consumes.
|
|
13
|
+
* - **Embedded / walletless** ({@link signerFromEmbeddedWallet}): the
|
|
14
|
+
* PLAN_2 D-1 "no wallet, no SOL" path. Defines the vendor-neutral
|
|
15
|
+
* {@link EmbeddedWalletProvider} interface ONE chosen vendor (Privy / Dynamic
|
|
16
|
+
* / Web3Auth — `[HUMAN]`-gated) implements, plus a working local-keypair MOCK
|
|
17
|
+
* so the walletless Done-when is testable against localnet without a vendor.
|
|
18
|
+
*
|
|
19
|
+
* SSR-safe: nothing here touches `window`/`document` at module scope. The
|
|
20
|
+
* adapters are plain factory functions; only `provider.connect()` (a user
|
|
21
|
+
* gesture) is browser-bound, and that is the vendor's concern, not ours.
|
|
22
|
+
*
|
|
23
|
+
* @module signers/types
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A Wallet Standard `solana:signTransaction` feature method, narrowed to the
|
|
28
|
+
* single shape {@link signerFromWalletAccount} needs.
|
|
29
|
+
*
|
|
30
|
+
* This mirrors `@solana/wallet-standard-features`'s `SolanaSignTransactionMethod`
|
|
31
|
+
* structurally so callers can pass either the real feature function or a test
|
|
32
|
+
* double without a hard dependency on that package's exact version.
|
|
33
|
+
*
|
|
34
|
+
* Given one or more `{ transaction }` wire-format inputs, it returns one
|
|
35
|
+
* `{ signedTransaction }` output per input (a fully serialized, signed
|
|
36
|
+
* transaction — wallets may modify it, which is why we diff signatures rather
|
|
37
|
+
* than assume identity).
|
|
38
|
+
*/
|
|
39
|
+
type WalletStandardSignTransaction = (...inputs: ReadonlyArray<{
|
|
40
|
+
/** Serialized transaction (wire format) to sign. */
|
|
41
|
+
readonly transaction: Uint8Array;
|
|
42
|
+
/** CAIP-2 chain id (e.g. `"solana:devnet"`); forwarded to the wallet. */
|
|
43
|
+
readonly chain?: string;
|
|
44
|
+
/** Optional Wallet Standard account handle (forwarded verbatim). */
|
|
45
|
+
readonly account?: unknown;
|
|
46
|
+
}>) => Promise<ReadonlyArray<{
|
|
47
|
+
/** Serialized, signed transaction (wire format). */
|
|
48
|
+
readonly signedTransaction: Uint8Array;
|
|
49
|
+
}>>;
|
|
50
|
+
/**
|
|
51
|
+
* The minimal Wallet Standard account shape {@link signerFromWalletAccount}
|
|
52
|
+
* consumes. A real `UiWalletAccount` (from `@solana/react` /
|
|
53
|
+
* `@wallet-standard/ui`) is structurally assignable to this; a test double only
|
|
54
|
+
* needs `address` plus a `solana:signTransaction` feature.
|
|
55
|
+
*
|
|
56
|
+
* The feature may be supplied two ways:
|
|
57
|
+
* - inline under `features["solana:signTransaction"].signTransaction`
|
|
58
|
+
* (the raw Wallet Standard layout), or
|
|
59
|
+
* - via the {@link SignerFromWalletAccountOptions.signTransaction} override.
|
|
60
|
+
*/
|
|
61
|
+
interface WalletStandardAccountLike {
|
|
62
|
+
/** Base58 account address (becomes the signer's `address`). */
|
|
63
|
+
readonly address: string;
|
|
64
|
+
/** CAIP-2 chains this account supports (used to pick a default `chain`). */
|
|
65
|
+
readonly chains?: readonly string[];
|
|
66
|
+
/** Raw Wallet Standard feature bag, when resolvable off the account. */
|
|
67
|
+
readonly features?: Readonly<Record<string, {
|
|
68
|
+
readonly signTransaction?: WalletStandardSignTransaction;
|
|
69
|
+
} | unknown>>;
|
|
70
|
+
}
|
|
71
|
+
/** Options for {@link signerFromWalletAccount}. */
|
|
72
|
+
interface SignerFromWalletAccountOptions {
|
|
73
|
+
/**
|
|
74
|
+
* CAIP-2 chain id forwarded to the wallet on each sign (e.g.
|
|
75
|
+
* `"solana:devnet"`, `"solana:mainnet"`). Defaults to the account's first
|
|
76
|
+
* `solana:*` chain, else `"solana:mainnet"`.
|
|
77
|
+
*/
|
|
78
|
+
chain?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Explicit `solana:signTransaction` feature method. Overrides any feature
|
|
81
|
+
* resolved off `account.features`. This is the seam tests and non-Wallet-
|
|
82
|
+
* Standard wrappers use, and the recommended way to pass the result of
|
|
83
|
+
* `@solana/react`'s wallet hooks when you hold the feature directly.
|
|
84
|
+
*/
|
|
85
|
+
signTransaction?: WalletStandardSignTransaction;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Vendor-neutral embedded-wallet provider — the PLAN_2 D-1 walletless seam.
|
|
89
|
+
*
|
|
90
|
+
* ONE `[HUMAN]`-chosen vendor (Privy / Dynamic / Web3Auth) implements this
|
|
91
|
+
* behind their email/social login + key custody. The marketplace layer only
|
|
92
|
+
* ever sees this interface, so templates/widget toggle the vendor by config
|
|
93
|
+
* (the C2 `payments.embedded` boolean) without an API break.
|
|
94
|
+
*
|
|
95
|
+
* The {@link createMockEmbeddedWallet} local-keypair adapter implements it for
|
|
96
|
+
* tests so the "no wallet, no SOL" Done-when runs against localnet today.
|
|
97
|
+
*/
|
|
98
|
+
interface EmbeddedWalletProvider {
|
|
99
|
+
/**
|
|
100
|
+
* Trigger the vendor's login/onboarding (email, social, passkey, …) and
|
|
101
|
+
* return a ready signer. Idempotent: calling it again after a connection
|
|
102
|
+
* resolves the existing wallet rather than provisioning a new one.
|
|
103
|
+
*
|
|
104
|
+
* This is the ONLY browser-bound method (it runs behind a user gesture); the
|
|
105
|
+
* factory that wraps the provider stays SSR-safe.
|
|
106
|
+
*/
|
|
107
|
+
connect(): Promise<EmbeddedWalletConnection>;
|
|
108
|
+
/** Whether a wallet is currently connected (for headless gating/SSR). */
|
|
109
|
+
isConnected(): boolean;
|
|
110
|
+
/** The connected wallet, or `null` before {@link connect}. */
|
|
111
|
+
getConnection(): EmbeddedWalletConnection | null;
|
|
112
|
+
/** Tear down the session (sign out). Optional — not all vendors expose it. */
|
|
113
|
+
disconnect?(): Promise<void>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A live embedded-wallet connection: the funded account address plus the
|
|
117
|
+
* primitive that produces signatures.
|
|
118
|
+
*
|
|
119
|
+
* `signTransactions` is the lowest-honest-common-denominator across vendors:
|
|
120
|
+
* given kit {@link Transaction} objects, return this account's
|
|
121
|
+
* {@link SignatureBytes} for each (a partial-signer contract — the vendor never
|
|
122
|
+
* broadcasts, the SDK client's transport does). {@link signerFromEmbeddedWallet}
|
|
123
|
+
* lifts it into a kit {@link TransactionSigner}.
|
|
124
|
+
*/
|
|
125
|
+
interface EmbeddedWalletConnection {
|
|
126
|
+
/** The embedded wallet's base58 address. */
|
|
127
|
+
readonly address: string;
|
|
128
|
+
/**
|
|
129
|
+
* Produce this account's signature over each provided transaction WITHOUT
|
|
130
|
+
* sending it. One {@link SignatureBytes} per input, in order.
|
|
131
|
+
*/
|
|
132
|
+
signTransactions(transactions: readonly Transaction[]): Promise<readonly SignatureBytes[]>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type { EmbeddedWalletConnection as E, SignerFromWalletAccountOptions as S, WalletStandardAccountLike as W, EmbeddedWalletProvider as a, WalletStandardSignTransaction as b };
|