@markee_team/sdk 0.0.0-stage → 0.1.0-alpha.10
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/LICENSE +21 -0
- package/README.md +292 -2
- package/dist/amount.d.ts +5 -0
- package/dist/checkout.d.ts +7 -0
- package/dist/client.d.ts +74 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +142 -0
- package/dist/modal.d.ts +83 -0
- package/dist/presentation.d.ts +8 -0
- package/dist/react.d.ts +32 -0
- package/dist/react.js +142 -0
- package/dist/sign.d.ts +21 -0
- package/dist/styles.d.ts +1 -0
- package/dist/theme.d.ts +6 -0
- package/dist/types.d.ts +289 -0
- package/package.json +62 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Markee contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,293 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Markee SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An ESM JavaScript SDK with a self-contained, Shadow DOM modal and an optional React entry point. The SDK knows the Markee API endpoint; the host only supplies its placement and, optionally, its current wallet provider. No Alchemy, Redis, Privy, or bridge-provider key belongs in the consuming app.
|
|
4
|
+
|
|
5
|
+
Embed a Markee leaderboard in your app with wallet-funded For Sale and For Rent flows, automatic strategy detection, and a configurable theme. Eligible Base For Sale boards can also offer Markee-hosted card checkout when enabled by Markee. Incoming cross-chain funding is not included.
|
|
6
|
+
|
|
7
|
+
The package also includes a standalone **Markee sign**. It shows the board's current winner and follows Markee's moderation decisions, with an optional button to open the payment modal.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install @markee_team/sdk@latest
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Use React 18 or 19 for the optional React entry point. The plain JavaScript entry point does not require React. Both TypeScript bundler and NodeNext resolution are supported.
|
|
16
|
+
|
|
17
|
+
To build from the source repository:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm ci --prefix packages/sdk
|
|
21
|
+
npm run build --prefix packages/sdk
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Create and connect your leaderboard
|
|
25
|
+
|
|
26
|
+
The SDK connects to an existing leaderboard; installing it does not create one.
|
|
27
|
+
|
|
28
|
+
1. Open [Create a Markee](https://www.markee.xyz/create-a-markee) and complete the leaderboard setup on Markee. Choose For Sale or For Rent there. If you already have a leaderboard, use it instead.
|
|
29
|
+
2. Copy the resulting Markee page link: `https://www.markee.xyz/markee/<address>`.
|
|
30
|
+
3. Extract the `0x…` address from that link and use it in the SDK placement: `{ kind: 'board', chainId: 8453, address: yourLeaderboardAddress }`.
|
|
31
|
+
4. Open the modal to display your leaderboard. If using a coding assistant, give it the Markee page link along with the LLM implementation prompt below.
|
|
32
|
+
|
|
33
|
+
The SDK reads the leaderboard's strategy from Markee and automatically renders the appropriate For Sale or For Rent flow. You do not configure a strategy in your app.
|
|
34
|
+
|
|
35
|
+
## Automatic site verification
|
|
36
|
+
|
|
37
|
+
Pass your public page URL or domain as `siteUrl` to `MarkeeModal` or `createMarkee`, for example `siteUrl="https://your-app.example"`. The React component registers the site when mounted, even while closed; the JavaScript modal registers when opened. No API key is required. Use `onSiteVerification` to inspect success or setup errors; verification does not block browsing or payments.
|
|
38
|
+
|
|
39
|
+
Markee fetches the public page and verifies that its HTML contains the matching board marker before adding it to **Served on**. The React component renders this marker for server-rendered apps. For client-rendered apps such as Vite, include it in the deployed `index.html` (replace the address with your board):
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<span hidden data-markee-address="0xYOUR_BOARD_ADDRESS"></span>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The marker must be present in the HTML returned by the server, not only injected by JavaScript. The supplied URL must use HTTPS, match the app's origin, and return the final HTML page without redirects. Localhost and private-network sites cannot be publicly verified. Registration currently supports Base boards. It verifies the board's presence, not legal domain ownership.
|
|
46
|
+
|
|
47
|
+
For an explicit retry after deployment, call `new MarkeeClient().verifySite(placement, siteUrl)`. The endpoint is `POST /api/sdk/v1/sites/verify` with `{ placement, siteUrl }`. Unverified sites are never added to the verified list.
|
|
48
|
+
|
|
49
|
+
## Plain JavaScript
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { createMarkee } from '@markee_team/sdk';
|
|
53
|
+
|
|
54
|
+
const markee = createMarkee({
|
|
55
|
+
// Optional. Reuse the wallet selected by your application's wallet connector.
|
|
56
|
+
wallet: {
|
|
57
|
+
getProvider: async () => appWalletProvider ?? null,
|
|
58
|
+
connect: async () => connectAppWallet(),
|
|
59
|
+
},
|
|
60
|
+
onEvent: event => console.log(event.type, event.hash),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
markee.open({
|
|
64
|
+
placement: {
|
|
65
|
+
kind: 'board',
|
|
66
|
+
chainId: 8453,
|
|
67
|
+
address: '0x2768BC6e90266248BD8bCF5401C36D8049CdF671',
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// markee.close();
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Without a wallet adapter, browsing works without a wallet. On a connect click the modal discovers installed wallets using EIP-6963, with an EIP-1193 fallback. Multiple discovered wallets are offered for explicit selection. An adapter always takes precedence over injected discovery. Eligible boards also offer hosted login and card checkout when enabled by Markee; the host app does not need its own wallet integration.
|
|
75
|
+
|
|
76
|
+
## React
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
import { MarkeeModal } from '@markee_team/sdk/react';
|
|
80
|
+
|
|
81
|
+
<MarkeeModal
|
|
82
|
+
open={open}
|
|
83
|
+
onClose={() => setOpen(false)}
|
|
84
|
+
wallet={walletAdapter}
|
|
85
|
+
placement={{ kind: 'gardens-community', chainId: 100, community: communityAddress }}
|
|
86
|
+
/>;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
See [`examples/connectkit`](https://github.com/1Hive/markee/tree/feature/markee-sdk/examples/connectkit) for a complete adapter. Its connection promise resolves only once ConnectKit has selected a provider and rejects when the picker is dismissed. The SDK does not install a second wallet context.
|
|
90
|
+
|
|
91
|
+
## Embed the current Markee sign
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { MarkeeSign } from '@markee_team/sdk/react';
|
|
95
|
+
|
|
96
|
+
const placement = { kind: 'board', chainId: 8453, address: '0x2768BC6e90266248BD8bCF5401C36D8049CdF671' } as const;
|
|
97
|
+
<MarkeeSign placement={placement} theme={{ mode: 'dark' }} />;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`MarkeeSign` shows the current on-chain winner, its message and author, and an **Open Markee** button that launches the SDK modal. It uses the same optional wallet adapter and theme as `MarkeeModal`. No app-side moderation database, RPC key, or moderation provider is needed. To render from plain JavaScript, call `createMarkeeSign(containerElement, { placement })`; its return value has `refresh()`, `setTheme()`, and `destroy()`.
|
|
101
|
+
|
|
102
|
+
The SDK snapshot API reads **board moderation flags** from Markee's database. A flagged winner is blurred with a notice; the author's name is blurred too. The sign does not offer a reveal action or count a view for flagged content. If moderation data cannot be loaded, it withholds the message until the status is known. Visible, unflagged signs record one view per message. The sign refreshes every 30 seconds while mounted and can be refreshed on demand. Markee-only site flags intentionally apply only on markee.xyz; they do not censor a partner's embedded sign. Moderators still manage flags on Markee; moderation writes invalidate SDK snapshots so embedded signs can pick up changes on their next refresh.
|
|
103
|
+
|
|
104
|
+
## Modal layout
|
|
105
|
+
|
|
106
|
+
Both strategies use a consistent, compact 512px panel with a fixed header/footer, a collapsible leaderboard, the selected message or editor, and a prominent amount card. The leaderboard pins your loaded messages and offers inline funding selection. Your active rental message is selected when available; otherwise an owned message or the creation form is shown.
|
|
107
|
+
|
|
108
|
+
For Sale uses the same arrangement with a one-time ETH amount. For Rent uses an ETHx monthly rate and links to Deposit manager. Wallet balances, rewards, refunds, edits, and community treasury actions remain accessible without top-level tabs. The footer holds the review/confirmation actions and Stop streaming when applicable.
|
|
109
|
+
|
|
110
|
+
MIN and WIN/2× fill the amount without sending a payment. Suggestions use the loaded ranking, preserve integer precision, and account for the selected message's existing funding or stream contribution. Rankings can change; the server still validates and simulates each reviewed action. New rentals retain the selected rate across message creation and require a separate stream confirmation. Payment reviews and drafts survive navigation back to the editor.
|
|
111
|
+
|
|
112
|
+
## Theme
|
|
113
|
+
|
|
114
|
+
Pass a typed `theme` option to `createMarkee` or a `theme` prop to the React modal. Light is the default; `mode: 'dark'` selects the dark palette and `mode: 'system'` follows device changes while the modal is open.
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { createMarkee, type MarkeeTheme } from '@markee_team/sdk';
|
|
118
|
+
|
|
119
|
+
const theme: MarkeeTheme = {
|
|
120
|
+
mode: 'system',
|
|
121
|
+
fontFamily: '"DM Sans", system-ui, sans-serif',
|
|
122
|
+
radius: 12,
|
|
123
|
+
colors: {
|
|
124
|
+
primary: '#743a84',
|
|
125
|
+
primaryText: '#ffffff',
|
|
126
|
+
accent: '#eac6f1',
|
|
127
|
+
accentText: '#50265b',
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// React: <MarkeeModal {...modalProps} theme={theme} />
|
|
132
|
+
// JavaScript:
|
|
133
|
+
const markee = createMarkee({ theme });
|
|
134
|
+
markee.setTheme({ mode: 'dark' });
|
|
135
|
+
markee.setTheme(); // Reset to the default light theme.
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Theme changes update styles in place: drafts, focus, scroll, wallet sessions, and payment reviews stay intact. In JavaScript, `setTheme` replaces the theme for the open modal and future opens. You can also supply `open({ placement, theme })` for a single opening, or call `modal.setTheme(theme)` on the returned modal. In React, update the `theme` prop. Removing it resets the default.
|
|
139
|
+
|
|
140
|
+
| Option | Customization |
|
|
141
|
+
| --- | --- |
|
|
142
|
+
| `mode` | `light`, `dark`, or `system` |
|
|
143
|
+
| `fontFamily` | CSS font stack; the app supplies any custom font |
|
|
144
|
+
| `radius` | Panel radius in pixels, 0–48 (default 22); card and control corners scale with it |
|
|
145
|
+
| `colors` | Partial overrides for the semantic tokens below |
|
|
146
|
+
|
|
147
|
+
Color tokens: `background`, `surface`, `text`, `muted`, `border`, `inputBackground`, `inputText`, `primary`, `primaryText`, `accent`, `accentText`, `accentSurface`, `accentSurfaceText`, `accentBorder`, `selected`, `selectedText`, `info`, `infoText`, `error`, `errorText`, `success`, `successText`, `link`, `focusRing`, and `overlay`. Set foreground/background pairs together and check your brand's contrast in both modes. Overrides apply over either selected palette; omitted values use that palette's defaults. Invalid CSS color/font values fall back to defaults.
|
|
148
|
+
|
|
149
|
+
Styles are scoped to the modal's Shadow DOM and do not change the host app or its wallet picker. The ConnectKit sample includes light, dark, device, and custom Plum presets.
|
|
150
|
+
|
|
151
|
+
## Headless API
|
|
152
|
+
|
|
153
|
+
`new MarkeeClient(options)` provides `snapshot`, `prepare`, `send`, `verify`, `pending`, `recordView`, `quote`, `authorize`, `executeAuthorization`, `resumeAuthorization`, and `bridgeStatus`. Exported TypeScript types describe the complete request/response contract.
|
|
154
|
+
|
|
155
|
+
- `snapshot(placement, account?, offset?)`: chain state, metadata, moderation, views, rewards and wallet balances. The first page is ranked; subsequent pages browse the registry. Enforced winner and the wallet's current backing remain included.
|
|
156
|
+
- `prepare(placement, action)`: validates membership/ownership, simulates and estimates the exact transaction, and returns a five-minute review. All financial inputs are decimal **wei strings**; use `parseEth` for user input.
|
|
157
|
+
- `send(preparation)`: rechecks account, requests a chain switch when necessary, and sends through the host wallet. It never signs with a backend key.
|
|
158
|
+
- `verify(pending)`: binds the submitted hash to the prepared sender, recipient, calldata and value, waits for two block confirmations, and reports actual token transfers. A reverted transaction or deferred settlement is not a reward success.
|
|
159
|
+
- Pending transactions are stored per API URL, wallet and placement. Closing/reopening resumes verification. Unknown transactions remain pending and block duplicate submissions. A replacement hash is not automatically inferred; inspect it in the wallet/explorer and pass the matching replacement to `verify`.
|
|
160
|
+
- Admin signatures have a five-minute challenge window, one-time nonces, and a durable server-side operation record. Retrying the same signature recovers the saved operation instead of spending twice. In-flight signatures are stored locally for recovery and removed after a terminal result. A record interrupted before a hash was saved requires operator reconciliation; it is never automatically executed again.
|
|
161
|
+
|
|
162
|
+
## Payment semantics
|
|
163
|
+
|
|
164
|
+
For Sale supports create/fund/edit. New message ownership belongs to the caller. Funding an existing message does not transfer ownership; MARKEE rewards go to the payer when RevNet is enabled.
|
|
165
|
+
|
|
166
|
+
For Rent supports message creation, starting/updating/switching/stopping a stream, wrap/unwrap, pool connection/refunds, board-buffer recovery, ranking refresh and settlement. The server builds the complete Superfluid batch, including exact ETHx approval and pool connection. Wallet runway uses the combined CFA and GDA net flow across the wallet, not only the current board. Rental MARKEE comes from actual settled rent, never merely from wrapping or depositing ETH.
|
|
167
|
+
|
|
168
|
+
Community activation supports the current council Safe, a current Safe owner, or the configured authorized keeper. Revenue claims support the current Safe or its current owners and always pay the council treasury. Existing outbound Across, Squid and LI.FI routing lives on Markee's server.
|
|
169
|
+
|
|
170
|
+
## Integration boundaries
|
|
171
|
+
|
|
172
|
+
- Current board versions: `1.3.0` For Sale and `streaming-1.0.0` For Rent, on Base and configured Sepolia deployments. Additional factories must be enabled on Markee's server. Legacy strategy versions are rejected explicitly.
|
|
173
|
+
- Transaction sending currently expects an EIP-1193 wallet returning an on-chain transaction hash with the connected wallet as the transaction sender. UserOperation-only and Safe transaction-service hashes need a future adapter; they are not treated as successful direct transactions. Community authorization independently supports ERC-1271 Safe signatures.
|
|
174
|
+
- The native ETHx downgrade uses the deployed contract's native transfer path. Contract accounts whose receive function needs more than its transfer stipend may not support it; simulation catches the failure before prompting.
|
|
175
|
+
- The modal renders escaped text, uses isolated CSS, and supports keyboard focus, Escape, mobile sizing and reduced motion. A host CSP must permit the SDK's inline styles and connections to its configured Markee API. No external font or image is needed by the modal.
|
|
176
|
+
- API failures are explicit. Without moderation data, message text is withheld. No mock balances or fabricated rewards are returned by production handlers.
|
|
177
|
+
|
|
178
|
+
Backend configuration and API reference: [`docs/sdk/implementation.md`](https://github.com/1Hive/markee/blob/feature/markee-sdk/docs/sdk/implementation.md).
|
|
179
|
+
|
|
180
|
+
## API endpoint
|
|
181
|
+
|
|
182
|
+
No API URL or Markee API key is required. The SDK connects to the Markee-hosted API and centralizes on-chain reads, metadata, and transaction preparation. For local development or testing, pass an optional `apiUrl` override to `createMarkee`, `MarkeeClient`, or the React modal. The endpoint used by your installed release is exported as `DEFAULT_MARKEE_API_URL`.
|
|
183
|
+
|
|
184
|
+
## LLM implementation prompt
|
|
185
|
+
|
|
186
|
+
Copy this prompt into your coding assistant. It gathers missing requirements before implementing the integration.
|
|
187
|
+
|
|
188
|
+
```text
|
|
189
|
+
Integrate @markee_team/sdk@latest into this app. Inspect the codebase first and
|
|
190
|
+
follow its existing framework, styling, and wallet patterns. Read the installed
|
|
191
|
+
package README and types for current capabilities.
|
|
192
|
+
|
|
193
|
+
Before implementing, ask me to create my leaderboard on Markee at
|
|
194
|
+
https://www.markee.xyz/create-a-markee, then provide its resulting Markee page link.
|
|
195
|
+
If I already have a leaderboard, ask for that link instead; do not create a duplicate.
|
|
196
|
+
Example link format:
|
|
197
|
+
https://www.markee.xyz/markee/0x6ceBC87DE40519Fa52fc40a1d49f16FF968bb439
|
|
198
|
+
Never silently substitute a demo board. Wait for my link before wiring the placement.
|
|
199
|
+
|
|
200
|
+
Extract the board address from the /markee/<address> path. Validate the Markee URL
|
|
201
|
+
and the address (0x followed by 40 hexadecimal characters). Markee website boards
|
|
202
|
+
currently use Base, chain ID 8453. Verify the board through the SDK snapshot API;
|
|
203
|
+
if verification fails, explain the error and ask for a corrected link.
|
|
204
|
+
|
|
205
|
+
Do not ask me to choose For Sale or For Rent in the host app. That choice is made
|
|
206
|
+
when creating the leaderboard on Markee. The API returns strategy and the SDK
|
|
207
|
+
adapts the modal automatically. Do not add a strategy prop, toggle, or hardcoded mode.
|
|
208
|
+
|
|
209
|
+
Ask only the remaining unanswered requirements in one concise group:
|
|
210
|
+
- Where should Markee appear, what opens the modal, and what should the button say?
|
|
211
|
+
- Should it reuse the app's existing wallet, use SDK wallet discovery, or use
|
|
212
|
+
Markee-hosted card checkout without an app wallet (For Sale on Base only)? Inspect
|
|
213
|
+
existing connectors first; do not add a second wallet context or install a new
|
|
214
|
+
connector without agreement.
|
|
215
|
+
- Should the modal match the app theme or use specific colors, font, radius, and
|
|
216
|
+
light/dark/system mode?
|
|
217
|
+
- What public domain/page will host this integration? Use it as siteUrl for
|
|
218
|
+
automatic verification. For Vite/client rendering, add the board marker to the
|
|
219
|
+
static HTML as documented; do not claim localhost is verified.
|
|
220
|
+
- What should happen after a confirmed transaction: notification, refresh,
|
|
221
|
+
navigation, or callback? Are there additional mobile/accessibility requirements?
|
|
222
|
+
|
|
223
|
+
Then implement the agreed scope:
|
|
224
|
+
1. Install @markee_team/sdk@latest. No API URL or Markee API key is required.
|
|
225
|
+
Do not create an API proxy or add RPC/database credentials.
|
|
226
|
+
2. Use placement = { kind: 'board', chainId: 8453, address: extractedAddress }.
|
|
227
|
+
Use new MarkeeClient().snapshot(placement) to verify the board and read strategy,
|
|
228
|
+
name, minimum, and other metadata. The modal performs its own snapshot loading;
|
|
229
|
+
do not recreate that loading or strategy logic in the host app.
|
|
230
|
+
3. For React, use MarkeeModal from @markee_team/sdk/react in a client component
|
|
231
|
+
with open, onClose, and placement. Otherwise use createMarkee() from
|
|
232
|
+
@markee_team/sdk, then open({ placement }); close it on teardown.
|
|
233
|
+
4. If a host wallet exists, pass its selected EIP-1193 provider through the wallet
|
|
234
|
+
adapter. For ConnectKit/wagmi use the active connector. Resolve connect after
|
|
235
|
+
selection, reject cancellation, and do not silently switch wallet providers.
|
|
236
|
+
Otherwise omit wallet. Without a connected app account, the modal shows only
|
|
237
|
+
Pay, opening Markee-hosted checkout for supported boards. Do not install
|
|
238
|
+
Privy or collect card details in the host app.
|
|
239
|
+
5. Apply theme options while preserving the built-in modal layout. Handle onEvent
|
|
240
|
+
if needed; show success only for a confirmed event. Let the SDK manage review,
|
|
241
|
+
network switching, submission, and verification.
|
|
242
|
+
6. Verify build/types, loading of the supplied board, automatic strategy selection,
|
|
243
|
+
open/close behavior, theme, and wallet reuse. Do not sign or send transactions
|
|
244
|
+
during automated verification. Report changed files, checks, and limitations.
|
|
245
|
+
|
|
246
|
+
Check the installed release's supported features before promising functionality.
|
|
247
|
+
Wallet-funded flows are supported. Hosted card checkout requires Markee's backend
|
|
248
|
+
capability to be enabled; do not promise availability when it is disabled. Incoming
|
|
249
|
+
bridging is not available. Transactions and card funding use real funds.
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Pay by card without an app wallet
|
|
253
|
+
|
|
254
|
+
Without a connected app wallet, the modal shows **Pay** as its only payment action
|
|
255
|
+
and hides wallet balances and wallet-management sections. For Sale boards on Base
|
|
256
|
+
with MARKEE rewards support this flow
|
|
257
|
+
when the Markee backend enables hosted checkout. No Privy provider, payment keys or
|
|
258
|
+
API configuration is needed in the integrating app. Omit the `wallet` adapter.
|
|
259
|
+
|
|
260
|
+
The SDK opens Markee, where the user signs in, receives a Privy embedded wallet,
|
|
261
|
+
funds it through Stripe (Base USDC converted to ETH) or MoonPay (Base ETH), and confirms
|
|
262
|
+
the Markee payment. The contract sends MARKEE directly to that user's paying
|
|
263
|
+
wallet. The host receives `onEvent({ type: 'confirmed', hash })` only after
|
|
264
|
+
server-side receipt verification. Card funding alone is not a successful payment.
|
|
265
|
+
|
|
266
|
+
The checkout can resume after closing or refreshing. If a wallet submission has an
|
|
267
|
+
unknown result, it asks the user to check the existing transaction instead of
|
|
268
|
+
sending again. On browsers that block popups, it navigates to Markee in the same
|
|
269
|
+
tab. Reopen Pay after returning to recover the confirmed result.
|
|
270
|
+
|
|
271
|
+
Card availability, fees, minimum purchase amounts and identity checks depend on
|
|
272
|
+
the funding provider and user eligibility. Any unused USDC or ETH remains in the
|
|
273
|
+
user's wallet. Conversion uses a capped approval and maximum 1% slippage, with
|
|
274
|
+
wallet confirmation and Markee-sponsored conversion gas. For Rent, incoming
|
|
275
|
+
bridging and automatic rewards forwarding to a different wallet are outside this
|
|
276
|
+
checkout flow. If hosted checkout is unavailable, Pay is disabled with an
|
|
277
|
+
availability message; the modal does not fall back to asking for a wallet.
|
|
278
|
+
|
|
279
|
+
### Reuse a Markee login
|
|
280
|
+
|
|
281
|
+
Pay opens a temporary browser tab on Markee, where the existing Privy session is
|
|
282
|
+
restored before showing sign-in. The SDK does not copy login tokens into the host
|
|
283
|
+
app. The tab closes after the host verifies the payment. If tabs are blocked,
|
|
284
|
+
checkout falls back to a same-tab redirect. To always redirect, pass
|
|
285
|
+
`checkoutWindow: 'redirect'` (`checkoutWindow="redirect"` in React).
|
|
286
|
+
|
|
287
|
+
Session reuse requires the same exact Markee origin and Privy app ID. A login on
|
|
288
|
+
`www.markee.xyz` is not a login on a Vercel preview domain. Markee can set
|
|
289
|
+
`MARKEE_CHECKOUT_ORIGIN=https://www.markee.xyz` on its API deployment **after** the
|
|
290
|
+
checkout route is deployed there. Both deployments must use the same checkout KV,
|
|
291
|
+
signing secret, supported configuration and Privy app. Omit this setting to keep
|
|
292
|
+
checkout on the API origin. Integrators do not configure an API or checkout URL.
|
|
293
|
+
Existing pending checkout sessions retain their original destination.
|
package/dist/amount.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** No floating point conversion when preparing financial amounts. */
|
|
2
|
+
export declare function parseEth(input: string, allowZero?: boolean): string;
|
|
3
|
+
export declare function formatEth(raw: string, decimals?: number): string;
|
|
4
|
+
export declare function shortAddress(value: string): string;
|
|
5
|
+
export declare function escapeHtml(value: unknown): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type MarkeeClient } from './client.js';
|
|
2
|
+
import type { Action, CheckoutSession, CheckoutStatus, Placement, TransactionResult } from './types.js';
|
|
3
|
+
export declare function savedCheckout(client: MarkeeClient, placement: Placement): CheckoutSession | null;
|
|
4
|
+
export declare function checkoutStatus(client: MarkeeClient, session: CheckoutSession): Promise<CheckoutStatus>;
|
|
5
|
+
export declare function forgetCheckout(client: MarkeeClient, placement: Placement): void;
|
|
6
|
+
/** Call directly from a click handler to preserve popup permission. */
|
|
7
|
+
export declare function openHostedCheckout(client: MarkeeClient, placement: Placement, action: Action): Promise<TransactionResult>;
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Action, Address, AdminOperation, AdminResult, Authorization, BridgeStatus, ClaimQuote, EIP1193Provider, Hex, Placement, PreparedAction, SDKOptions, Snapshot, SiteVerification, TransactionResult } from './types.js';
|
|
2
|
+
/** Markee-hosted API used by integrations unless overridden for local development. */
|
|
3
|
+
export declare const DEFAULT_MARKEE_API_URL = "https://2staging.markee.xyz/api/sdk/v1";
|
|
4
|
+
export declare class MarkeeError extends Error {
|
|
5
|
+
code: string;
|
|
6
|
+
status?: number | undefined;
|
|
7
|
+
constructor(message: string, code?: string, status?: number | undefined);
|
|
8
|
+
}
|
|
9
|
+
export interface DiscoveredWallet {
|
|
10
|
+
name: string;
|
|
11
|
+
uuid: string;
|
|
12
|
+
provider: EIP1193Provider;
|
|
13
|
+
}
|
|
14
|
+
export declare function discoverWallets(): Promise<DiscoveredWallet[]>;
|
|
15
|
+
export interface PendingTransaction {
|
|
16
|
+
preparation: PreparedAction;
|
|
17
|
+
hash: Hex;
|
|
18
|
+
}
|
|
19
|
+
export interface PendingAuthorization {
|
|
20
|
+
kind: 'activate' | 'claim';
|
|
21
|
+
nonce: string;
|
|
22
|
+
signature: Hex;
|
|
23
|
+
account: Address;
|
|
24
|
+
community: Address;
|
|
25
|
+
chainId: number;
|
|
26
|
+
}
|
|
27
|
+
export declare class MarkeeClient {
|
|
28
|
+
readonly options: SDKOptions;
|
|
29
|
+
readonly apiUrl: string;
|
|
30
|
+
private readonly fetcher;
|
|
31
|
+
private injected;
|
|
32
|
+
private sending;
|
|
33
|
+
private inMemoryPending;
|
|
34
|
+
private adminMemory;
|
|
35
|
+
private communityReceipts;
|
|
36
|
+
constructor(options?: SDKOptions);
|
|
37
|
+
request<T>(path: string, body?: unknown, signal?: AbortSignal): Promise<T>;
|
|
38
|
+
provider(): Promise<EIP1193Provider | null>;
|
|
39
|
+
account(): Promise<Address | null>;
|
|
40
|
+
connect(selected?: EIP1193Provider): Promise<Address>;
|
|
41
|
+
verifySite(placement: Placement, siteUrl: string): Promise<SiteVerification>;
|
|
42
|
+
private siteRequests;
|
|
43
|
+
registerSite(placement: Placement): void;
|
|
44
|
+
snapshot(placement: Placement, account?: Address | null, offset?: number, signal?: AbortSignal): Promise<Snapshot>;
|
|
45
|
+
prepare(placement: Placement, action: Action): Promise<PreparedAction>;
|
|
46
|
+
private ensureWallet;
|
|
47
|
+
send(preparation: PreparedAction): Promise<Hex>;
|
|
48
|
+
verify(pending: PendingTransaction): Promise<TransactionResult>;
|
|
49
|
+
/** Verify a speed-up replacement against the original prepared calldata before
|
|
50
|
+
* retiring the old hash. Unknown/replaced transactions never authorize a retry. */
|
|
51
|
+
reconcile(pending: PendingTransaction, replacementHash: Hex): Promise<TransactionResult>;
|
|
52
|
+
private storageKey;
|
|
53
|
+
private records;
|
|
54
|
+
private persist;
|
|
55
|
+
pending(placement: Placement, account: Address): PendingTransaction | undefined;
|
|
56
|
+
quote(placement: Extract<Placement, {
|
|
57
|
+
kind: 'gardens-community';
|
|
58
|
+
}>): Promise<ClaimQuote>;
|
|
59
|
+
authorize(placement: Extract<Placement, {
|
|
60
|
+
kind: 'gardens-community';
|
|
61
|
+
}>, kind: 'activate' | 'claim'): Promise<Authorization>;
|
|
62
|
+
executeAuthorization(kind: 'activate' | 'claim', authorization: Authorization, account: Address): Promise<AdminOperation>;
|
|
63
|
+
pendingAuthorization(): PendingAuthorization | null;
|
|
64
|
+
private saveAuthorization;
|
|
65
|
+
resumeAuthorization(): Promise<AdminOperation>;
|
|
66
|
+
communityReceipt(placement: Extract<Placement, {
|
|
67
|
+
kind: 'gardens-community';
|
|
68
|
+
}>): AdminResult | null;
|
|
69
|
+
bridgeStatus(protocol: ClaimQuote['bridgeProtocol'], hash: Hex, fromChainId: number, toChainId: number): Promise<BridgeStatus>;
|
|
70
|
+
recordView(address: Address, message: string, url?: string): Promise<{
|
|
71
|
+
counted: boolean;
|
|
72
|
+
totalViews: number;
|
|
73
|
+
}>;
|
|
74
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export { MarkeeClient, MarkeeError, discoverWallets, DEFAULT_MARKEE_API_URL } from './client.js';
|
|
3
|
+
export type { PendingTransaction, DiscoveredWallet } from './client.js';
|
|
4
|
+
export { createMarkee, MarkeeModal } from './modal.js';
|
|
5
|
+
export type { ModalOptions } from './modal.js';
|
|
6
|
+
export { parseEth, formatEth } from './amount.js';
|
|
7
|
+
export { openHostedCheckout, checkoutStatus, savedCheckout } from './checkout.js';
|
|
8
|
+
export { createMarkeeSign, signContent } from './sign.js';
|
|
9
|
+
export type { MarkeeSignOptions } from './sign.js';
|