@nexus-cross/pop 1.4.0-beta.5 → 2.4.0-beta.1

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/AGENTS.md CHANGED
@@ -25,12 +25,19 @@ link's `#fragment` — the backend never sees it, so backend + link are each ins
25
25
  | Import | Contents | Requires |
26
26
  |---|---|---|
27
27
  | `@nexus-cross/pop` | domain types, use cases, pure utils, `createSafeDrop` | nothing |
28
- | `@nexus-cross/pop/adapters` | `createSafeDropClient`, viem/HTTP adapters, X OAuth, cross-auth | `viem`, `fetch` |
28
+ | `@nexus-cross/pop/api` | HTTP clients only — `HttpSafeDropApiAdapter`, `CrossAuthClient`, X OAuth PKCE, base-URL helpers | `fetch` |
29
+ | `@nexus-cross/pop/adapters` | everything in `/api` **plus** viem chain/signing adapters and `createSafeDropClient` | `viem`, `fetch` |
29
30
  | `@nexus-cross/pop/react` | `SafeDropProvider`, `useSafeDrop` | `react` |
30
31
 
31
32
  Default for an app: `createSafeDropClient` (adapters) + `SafeDropProvider` (react).
32
33
  `viem` and `react` are **optional peers** — install only what the chosen entry point needs.
33
34
 
35
+ **Read-only consumer? Use `/api`, not `/adapters`.** The `/adapters` barrel
36
+ statically imports the viem chain/signing adapters, so importing it just to call
37
+ `/drops` or `/histories` drags `viem` into your bundle. `/api` is the fetch-only
38
+ slice and needs no viem. Reach for `/adapters` when you actually sign or send
39
+ transactions (deposit / withdraw / refund).
40
+
34
41
  ```sh
35
42
  pnpm add @nexus-cross/pop viem # + react if using ./react
36
43
  ```
@@ -126,11 +133,11 @@ await safeDrop.withdraw({ recipient: myAddress, sponsor: sender!, claimAddress,
126
133
  ```ts
127
134
  await safeDrop.connectX({ oauth }); // required once before listDrops
128
135
  const conn = await safeDrop.getXConnection(); // null when not connected
129
- const inbox = await safeDrop.listDrops(); // { items, count, totalAmount, hasClaimedBefore }
136
+ const inbox = await safeDrop.listDrops({ token: ERC20_ADDRESS });
130
137
  await safeDrop.rejectDrops(inbox.items.slice(0, 1).map((drop) => drop.id));
131
- const rejected = await safeDrop.listRejectedDrops(); // hidden pending drops
138
+ const rejected = inbox.items.filter((drop) => drop.rejected); // flagged, excluded from totals
132
139
  const top = await safeDrop.getLeaderboard({ token: ERC20_ADDRESS, page: 1, pageSize: 10 });
133
- const page = await safeDrop.listHistories({ type: 'received', page: 1, pageSize: 20 });
140
+ const page = await safeDrop.listHistories({ type: 'received', status: 'pending', rejected: false });
134
141
  await safeDrop.disconnectX();
135
142
  ```
136
143
 
@@ -225,7 +232,6 @@ The SDK does not wrap it — use `EventSource` directly. Delivery is best-effort
225
232
  | `getDrop` | `activeDropOf(claimAddr)` + `drops(dropKey)` | — |
226
233
  | `listDrops` | `GET /drops` | JWT + active X connection |
227
234
  | `rejectDrops` | `POST /drops/reject` | JWT + active X connection |
228
- | `listRejectedDrops` | `GET /drops/rejected` | JWT + active X connection |
229
235
  | `listEnvelopes` | `GET /envelopes` | public |
230
236
  | `getLeaderboard` | `GET /leaderboards?token=` | public |
231
237
  | `listHistories` | `GET /histories` | JWT |
@@ -257,7 +263,7 @@ Everything rejects with `SafeDropError` — branch on `err.code`, never on the m
257
263
  ## 9. Common mistakes
258
264
 
259
265
  - Converting `amount` to `Number` for display math → silent precision loss above ~0.009 ETH in wei.
260
- - Calling `listDrops()` before `connectX()` → `X_CONNECTION_NOT_FOUND`.
266
+ - Calling `listDrops({ token })` before `connectX()` → `X_CONNECTION_NOT_FOUND`.
261
267
  - Passing the claim `secret` through a query parameter or logging it.
262
268
  - Building the claim link by hand instead of using the returned `withdrawLink` /
263
269
  `buildWithdrawLink` (the `#fragment` placement is load-bearing).
package/README.md CHANGED
@@ -17,11 +17,19 @@ npm i @nexus-cross/pop viem # react는 선택
17
17
  | import | 내용 | 의존 |
18
18
  |---|---|---|
19
19
  | `@nexus-cross/pop` | 도메인 타입, usecase, 순수 유틸, `createSafeDrop` facade | 없음 |
20
- | `@nexus-cross/pop/adapters` | viem/HTTP 어댑터, `createSafeDropClient`, X OAuth, cross-auth | viem, fetch |
20
+ | `@nexus-cross/pop/api` | HTTP 클라이언트만 `HttpSafeDropApiAdapter`, `CrossAuthClient`, X OAuth PKCE, base URL 헬퍼 | fetch |
21
+ | `@nexus-cross/pop/adapters` | 위 전부 + viem 체인/서명 어댑터, `createSafeDropClient` | viem, fetch |
21
22
  | `@nexus-cross/pop/react` | `SafeDropProvider`, `useSafeDrop` | react |
22
23
 
23
24
  대부분의 앱은 **`createSafeDropClient`(adapters) + `SafeDropProvider`(react)** 만 쓰면 된다.
24
25
 
26
+ **조회만 하는 소비자는 `/api` 를 쓴다.** `/adapters` 배럴은 viem 체인/서명
27
+ 어댑터를 static import 하므로, `/drops`·`/histories` 같은 읽기 전용 호출만
28
+ 필요한데 그 배럴을 쓰면 viem 이 딸려온다. `/api` 는 fetch 만 쓰는 부분을 떼어낸
29
+ 진입점이라 **viem 무의존**이다 (`@nexus-cross/connect-kit-react` 가 ONEpop
30
+ summary 를 조회할 때 쓰는 경로 — 그 패키지는 의존성 정책상 viem 을 직접 쓸 수
31
+ 없다). deposit/withdraw/refund 처럼 서명·체인 호출이 필요하면 `/adapters`.
32
+
25
33
  ## 개념
26
34
 
27
35
  - **claimAddress** — 드롭당 임시 지갑 주소. `activeDropOf`로 현재 drop key를 찾는 데 사용.
@@ -153,18 +161,23 @@ await safeDrop.disconnectX(); // idempotent
153
161
  // 내게 온 수령 대기 목록 (Bearer JWT + 활성 X 연결)
154
162
  const inbox = await safeDrop.listDrops({ token: '0x…ERC20' });
155
163
  // { items, count, totalAmount, hasClaimedBefore, mappedRecipient, pendingChangeTo }
156
- // PendingDrop { id, dropKey, claimAddress, token, amount, message, envelopeId, depositedAt, sender }
164
+ // PendingDrop { id, dropKey, claimAddress, token, amount, message, envelopeId, depositedAt, rejected, sender }
157
165
 
158
- // 선택한 pending 드롭을 인박스에서 숨기고, 숨긴 목록을 다시 조회
166
+ // 선택한 pending 드롭을 거절하면 items에는 rejected=true로 남고 count/totalAmount에서는 제외된다.
159
167
  const hiddenCount = await safeDrop.rejectDrops(inbox.items.slice(0, 2).map((drop) => drop.id));
160
- const hidden = await safeDrop.listRejectedDrops(); // { items, count }
161
168
 
162
169
  // 카드 디자인 · 리더보드 (공개 — JWT 불필요)
163
170
  const envelopes = await safeDrop.listEnvelopes({ locale: 'ko' });
164
171
  const top = await safeDrop.getLeaderboard({ token: '0x…ERC20', page: 1, pageSize: 10 });
165
172
 
166
173
  // 내 drop 히스토리
167
- const page = await safeDrop.listHistories({ type: 'received', page: 1, pageSize: 20 });
174
+ const page = await safeDrop.listHistories({
175
+ type: 'received',
176
+ status: 'pending',
177
+ rejected: false,
178
+ page: 1,
179
+ pageSize: 20,
180
+ });
168
181
  ```
169
182
 
170
183
  `inbox.hasClaimedBefore === false`면 **첫 수령은 개별 claim만** 가능하다 — 일괄 수령 CTA를 이 값으로 게이트한다.
@@ -304,7 +317,7 @@ base URL은 https(또는 `http://localhost`)만 허용한다. 프로토콜 수
304
317
  | `baseUrl` | `string` | 환경변수(`getOnePopApiBaseUrl`) | one-pop-api base URL |
305
318
  | `getJwt` | `() => string \| undefined \| Promise<…>` | — | **SIWE JWT.** deposit·`listDrops`·`listHistories`·`x-connections`·batch 서명에 필요. 미제공 시 요청 전에 `UNAUTHORIZED` |
306
319
  | `fetchImpl` | `typeof fetch` | `globalThis.fetch` | 테스트/SSR 주입 |
307
- | `paths` | `Partial<PopApiPaths>` | `DEFAULT_POP_API_PATHS` (`/wallets`, `/wallets/private-key`, `/drops`, `/drops/reject`, `/drops/rejected`, `/envelopes`, `/leaderboards`, `/histories`, `/x-connections`, `/batch-claim-signature`, `/events/subscribe`) | 엔드포인트 경로 override |
320
+ | `paths` | `Partial<PopApiPaths>` | `DEFAULT_POP_API_PATHS` (`/wallets`, `/wallets/private-key`, `/drops`, `/drops/reject`, `/envelopes`, `/leaderboards`, `/histories`, `/x-connections`, `/batch-claim-signature`, `/events/subscribe`) | 엔드포인트 경로 override |
308
321
 
309
322
  ### `ViemSafeDropChainAdapter.transactionFees` 기본값
310
323
 
@@ -157,6 +157,8 @@ interface PendingDrop {
157
157
  readonly envelopeId: string;
158
158
  /** RFC3339 문자열. */
159
159
  readonly depositedAt: string;
160
+ /** 인박스 합계에서는 제외되지만 items에는 남는 표시 전용 거절 상태. */
161
+ readonly rejected: boolean;
160
162
  readonly sender: DropSender;
161
163
  }
162
164
  /** GET /drops — 수령 대기 인박스 (Bearer JWT + 활성 X 연결 필요). */
@@ -170,11 +172,6 @@ interface DropInbox {
170
172
  readonly mappedRecipient: Address | null;
171
173
  readonly pendingChangeTo: Address | null;
172
174
  }
173
- /** GET /drops/rejected — 사용자가 숨긴 pending 드롭 목록. */
174
- interface RejectedDrops {
175
- readonly items: readonly PendingDrop[];
176
- readonly count: number;
177
- }
178
175
  /** GET /envelopes — 카드 디자인. 공개 엔드포인트. */
179
176
  interface Envelope {
180
177
  readonly id: string;
@@ -204,17 +201,22 @@ interface MyLeaderboardEntry extends Omit<LeaderboardEntry, 'rank'> {
204
201
  readonly rank: number | null;
205
202
  }
206
203
  type HistoryType = 'sent' | 'received';
204
+ type HistoryStatus = 'pending' | 'claimed' | 'refunded';
207
205
  interface HistoryParty {
208
206
  readonly address: Address;
209
207
  readonly handle: string;
210
208
  readonly displayName: string;
211
209
  readonly profileImageUrl: string;
212
210
  }
211
+ interface HistoryReceiverParty extends Omit<HistoryParty, 'address'> {
212
+ /** 미수령 상태에서는 아직 claiming wallet이 없다. */
213
+ readonly address: Address | null;
214
+ }
213
215
  /** GET /histories의 drop 중심 항목. */
214
216
  interface HistoryEntry {
215
217
  readonly id: number;
216
218
  readonly type: HistoryType;
217
- readonly status: string;
219
+ readonly status: HistoryStatus;
218
220
  readonly token: Address;
219
221
  readonly amount: bigint;
220
222
  readonly claimAddress: Address;
@@ -228,7 +230,7 @@ interface HistoryEntry {
228
230
  /** 수신자가 인박스에서 숨긴 드롭인지 여부. 온체인 status에는 영향이 없다. */
229
231
  readonly rejected: boolean;
230
232
  readonly sender: HistoryParty;
231
- readonly receiver: HistoryParty;
233
+ readonly receiver: HistoryReceiverParty;
232
234
  }
233
235
  interface HistoryPage {
234
236
  readonly items: readonly HistoryEntry[];
@@ -259,27 +261,6 @@ interface RecipientChangeSignature extends RecipientSignature {
259
261
  readonly newRecipient: Address;
260
262
  }
261
263
 
262
- /**
263
- * 순수 계산이 아니라 외부 구현(해시 라이브러리/CSPRNG)이 필요한 암호 연산.
264
- * core는 keccak/난수 구현을 갖지 않으므로 Port로 분리한다.
265
- * 어댑터가 viem `keccak256`/`crypto.getRandomValues` 등으로 구현.
266
- */
267
- interface CryptoPort {
268
- /** utf8(secret) → keccak256 → 0x-prefixed hex. 컨트랙트 secretHash와 일치해야 함. */
269
- keccak256(input: Secret): SecretHash;
270
- /** CSPRNG 기반 고엔트로피 secret 문구 생성. */
271
- randomSecret(): Secret;
272
- /**
273
- * digest + 서명 → 서명자 주소. 백엔드 validator 서명을 **가스 쓰기 전에** 검증하는
274
- * 용도(최종 관문은 여전히 컨트랙트다). optional — 미구현 어댑터에서는 사전 검증만
275
- * 생략되고 플로우는 그대로 동작한다.
276
- */
277
- recoverAddress?(params: {
278
- digest: Hex;
279
- signature: Hex;
280
- }): Promise<Address>;
281
- }
282
-
283
264
  /**
284
265
  * off-chain 백엔드(one-pop-api) 계약. 임시 claim 키 보관/전달, X 연결, 조회
285
266
  * 엔드포인트, validator 서명을 담당한다. 이 포트만으로는 자금을 옮길 수 없다
@@ -323,15 +304,14 @@ interface SafeDropApiPort {
323
304
  claimAddress: Address;
324
305
  }>;
325
306
  /** GET /drops — 내게 온 수령 대기 목록. Bearer JWT + 활성 X 연결 필요. */
326
- listDrops?(params?: {
327
- token?: Address;
307
+ listDrops?(params: {
308
+ token: Address;
309
+ dropKey?: Hex;
328
310
  }): Promise<DropInbox>;
329
311
  /** POST /drops/reject — 선택한 pending 드롭을 인박스에서 숨긴다. */
330
312
  rejectDrops?(params: {
331
313
  dropIds: readonly number[];
332
314
  }): Promise<number>;
333
- /** GET /drops/rejected — 사용자가 숨긴 pending 드롭 목록. */
334
- listRejectedDrops?(): Promise<RejectedDrops>;
335
315
  /** GET /envelopes — 카드 디자인 목록. 공개(인증 불필요). */
336
316
  listEnvelopes?(params?: {
337
317
  locale?: string;
@@ -350,6 +330,9 @@ interface SafeDropApiPort {
350
330
  listHistories?(params: {
351
331
  type: HistoryType;
352
332
  token?: Address;
333
+ status?: HistoryStatus;
334
+ /** received에서만 적용되며 sent에서는 서버가 무시한다. */
335
+ rejected?: boolean;
353
336
  /** 1-based (기본 1). */
354
337
  page?: number;
355
338
  /** 기본 20, 최대 100. */
@@ -397,291 +380,4 @@ interface SafeDropApiPort {
397
380
  }): Promise<BatchClaimSignature>;
398
381
  }
399
382
 
400
- /** Current ONEpop drop record, keyed by bytes32 rather than claim wallet. */
401
- interface OnePopDrop {
402
- dropKey: Hex;
403
- sponsor: Address;
404
- amount: bigint;
405
- claimAddress: Address;
406
- recipient: Address;
407
- secretHash: SecretHash;
408
- id: Id;
409
- }
410
- interface DropState extends OnePopDrop {
411
- /** ONEpop escrow is single-token; token() is contract-wide. */
412
- token: Address;
413
- }
414
- /**
415
- * SafeDrop 컨트랙트 상호작용. 어댑터는 자신의 컨트랙트 주소를 알고 있으므로
416
- * approve의 spender 등은 받지 않는다. 쓰기는 receipt 확인 후 tx hash 반환.
417
- * withdraw는 임시 지갑이 직접 전송(가스 대납) — claimKey 필요.
418
- * ABI: src/infrastructure/safedrop_abi.json.
419
- */
420
- interface SafeDropChainPort {
421
- getDropByKey(dropKey: Hex): Promise<OnePopDrop | null>;
422
- getDropKeyByClaimAddress(claimAddress: Address, sponsor: Address): Promise<Hex | null>;
423
- getClaimedRecipient(params: {
424
- id: Id;
425
- }): Promise<Address>;
426
- getPendingDropsById(params: {
427
- id: Id;
428
- }): Promise<readonly OnePopDrop[]>;
429
- getPendingDropsByRecipient(params: {
430
- recipient: Address;
431
- }): Promise<readonly OnePopDrop[]>;
432
- getPendingDropsBySponsor(params: {
433
- sponsor: Address;
434
- }): Promise<readonly OnePopDrop[]>;
435
- /** activeDropOf(claimAddr) → drops(dropKey). 없으면 null. */
436
- getDrop(claimAddress: Address, sponsor: Address): Promise<DropState | null>;
437
- /** claimDigest(recipient, id, dropKey) — 서명 대상 bytes32. */
438
- getClaimDigest(params: {
439
- recipient: Address;
440
- id: Id;
441
- dropKey: Hex;
442
- }): Promise<Hex>;
443
- /**
444
- * EIP-2612 permit 예치 — 현재 ONEpop deposit의 유일한 형태다.
445
- * 서명(typed data)·deadline·v/r/s는 전부 어댑터 내부 관심사다.
446
- */
447
- depositWithPermit(params: {
448
- claimAddress: Address;
449
- token: Address;
450
- amount: bigint;
451
- id: Id;
452
- secretHash: SecretHash;
453
- onSubmitted?: (txHash: Hex) => void | Promise<void>;
454
- }): Promise<{
455
- txHash: Hex;
456
- dropKey: Hex;
457
- }>;
458
- depositMapped(params: {
459
- token: Address;
460
- amount: bigint;
461
- id: Id;
462
- onSubmitted?: (txHash: Hex) => void | Promise<void>;
463
- }): Promise<{
464
- txHash: Hex;
465
- dropKey: Hex;
466
- }>;
467
- withdrawUnmapped(params: {
468
- claimKey: Hex;
469
- recipient: Address;
470
- id: Id;
471
- dropKey: Hex;
472
- secret: Secret;
473
- signature?: Hex;
474
- onSubmitted?: (txHash: Hex) => void | Promise<void>;
475
- }): Promise<Hex>;
476
- withdrawMapped(params: {
477
- dropKey: Hex;
478
- onSubmitted?: (txHash: Hex) => void | Promise<void>;
479
- }): Promise<Hex>;
480
- batchWithdrawMapped(params: {
481
- count: number;
482
- }): Promise<Hex>;
483
- batchWithdrawMappedByKeys(params: {
484
- dropKeys: readonly Hex[];
485
- }): Promise<Hex>;
486
- withdrawUnmappedBatchByKeys(params: {
487
- claimKey: Hex;
488
- recipient: Address;
489
- id: Id;
490
- anchorDropKey: Hex;
491
- secret: Secret;
492
- nonce: bigint;
493
- deadline: bigint;
494
- dropKeys: readonly Hex[];
495
- validatorSignature: Hex;
496
- }): Promise<Hex>;
497
- refundByKey(params: {
498
- dropKey: Hex;
499
- }): Promise<Hex>;
500
- getChangeNonce(params: {
501
- id: Id;
502
- }): Promise<bigint>;
503
- getPendingRecipientChange(params: {
504
- id: Id;
505
- }): Promise<Address>;
506
- requestRecipientChange(params: {
507
- id: Id;
508
- newRecipient: Address;
509
- }): Promise<Hex>;
510
- completeRecipientChange(params: {
511
- id: Id;
512
- nonce: bigint;
513
- deadline: bigint;
514
- signature: Hex;
515
- }): Promise<Hex>;
516
- cancelRecipientChange(params: {
517
- id: Id;
518
- }): Promise<Hex>;
519
- resetRecipient(params: {
520
- id: Id;
521
- nonce: bigint;
522
- deadline: bigint;
523
- signature: Hex;
524
- }): Promise<Hex>;
525
- /** validatorNonceById(keccak256(utf8(id))). id 해싱은 어댑터 책임. */
526
- getValidatorNonce?(params: {
527
- id: Id;
528
- }): Promise<bigint>;
529
- /**
530
- * validatorClaimDigest(recipient, id, nonce, deadline) — 온체인 EIP-712 다이제스트.
531
- * 로컬 재조립 대신 이 값을 읽어 백엔드 서명을 검증한다.
532
- */
533
- getValidatorClaimDigest?(params: {
534
- recipient: Address;
535
- id: Id;
536
- nonce: bigint;
537
- deadline: bigint;
538
- }): Promise<Hex>;
539
- /** validator() — 서명자여야 하는 주소. 백엔드 서명 검증의 기준값. */
540
- getValidator?(): Promise<Address>;
541
- }
542
-
543
- /**
544
- * 임시 claim 키로 claimDigest(온체인에서 읽은 bytes32)에 raw ECDSA 서명을 만든다.
545
- * 컨트랙트가 claimDigest를 계산해주므로 로컬 EIP-712 typed data 구성은 불필요 —
546
- * digest를 그대로 서명한다. 서명은 브라우저 로컬, 백엔드 미관여.
547
- */
548
- interface ClaimSignerPort {
549
- signDigest(params: {
550
- claimKey: Hex;
551
- digest: Hex;
552
- }): Promise<Hex>;
553
- }
554
-
555
- /**
556
- * 프레임워크 무관 진입점. 포트 구현(어댑터)을 주입하면 usecase를 조립해 반환한다.
557
- *
558
- * const safeDrop = createSafeDrop(
559
- * { claimBaseUrl },
560
- * { api, chain, signer, crypto },
561
- * );
562
- * const result = await safeDrop.deposit({ ... });
563
- * if (!result.isMapped) sendLink(result.withdrawLink);
564
- *
565
- * viem/HTTP 어댑터를 자동 조립하려면 `@nexus-cross/pop/adapters`의
566
- * createSafeDropClient를 사용한다. (도메인/컨트랙트 주소는 chain 어댑터가 안다.)
567
- */
568
-
569
- interface SafeDropConfig {
570
- /** 수령 링크 base URL. 예: https://one-pop.example/claim */
571
- claimBaseUrl: string;
572
- }
573
- interface SafeDropDeps {
574
- api: SafeDropApiPort;
575
- chain: SafeDropChainPort;
576
- signer: ClaimSignerPort;
577
- crypto: CryptoPort;
578
- }
579
- interface SafeDrop {
580
- readonly config: SafeDropConfig;
581
- deposit(params: DepositParams): Promise<DepositResult>;
582
- /** X OAuth 검증 후 (sender_address + 토큰 소유자)로 임시 claim 키/주소를 받는다 (point of return). */
583
- retrieveClaimKey(params: {
584
- claimAddress: Address;
585
- senderAddress: Address;
586
- oauth: OAuthProof;
587
- }): Promise<{
588
- isMapped: true;
589
- } | {
590
- isMapped: false;
591
- claimKey: Hex;
592
- claimAddress: Address;
593
- }>;
594
- withdraw(params: WithdrawParams): Promise<WithdrawResult>;
595
- refund(params: RefundParams): Promise<RefundResult>;
596
- /** activeDropOf(claimAddr)로 조회한 현재 온체인 드롭. */
597
- getDrop(claimAddress: Address, sponsor: Address): Promise<DropState | null>;
598
- getDropByKey(dropKey: Hex): Promise<OnePopDrop | null>;
599
- getDropKeyByClaimAddress(claimAddress: Address, sponsor: Address): Promise<Hex | null>;
600
- getClaimedRecipient(id: Id): Promise<Address>;
601
- getPendingDropsById(id: Id): Promise<readonly OnePopDrop[]>;
602
- getPendingDropsByRecipient(recipient: Address): Promise<readonly OnePopDrop[]>;
603
- getPendingDropsBySponsor(sponsor: Address): Promise<readonly OnePopDrop[]>;
604
- withdrawUnmapped(params: Parameters<SafeDropChainPort['withdrawUnmapped']>[0]): Promise<Hex>;
605
- withdrawMapped(params: Parameters<SafeDropChainPort['withdrawMapped']>[0]): Promise<Hex>;
606
- batchWithdrawMapped(count: number): Promise<Hex>;
607
- batchWithdrawMappedByKeys(dropKeys: readonly Hex[]): Promise<Hex>;
608
- refundByKey(dropKey: Hex): Promise<Hex>;
609
- getChangeNonce(id: Id): Promise<bigint>;
610
- getPendingRecipientChange(id: Id): Promise<Address>;
611
- requestRecipientChange(id: Id, newRecipient: Address): Promise<Hex>;
612
- completeRecipientChange(params: Parameters<SafeDropChainPort['completeRecipientChange']>[0]): Promise<Hex>;
613
- cancelRecipientChange(id: Id): Promise<Hex>;
614
- resetRecipient(params: Parameters<SafeDropChainPort['resetRecipient']>[0]): Promise<Hex>;
615
- /** 내게 온 수령 대기 목록. Bearer JWT + 활성 X 연결 필요. */
616
- listDrops(params?: {
617
- token?: Address;
618
- }): Promise<DropInbox>;
619
- /** 선택한 pending 드롭을 인박스에서 숨긴다. */
620
- rejectDrops(dropIds: readonly number[]): Promise<number>;
621
- /** 사용자가 숨긴 pending 드롭 목록. */
622
- listRejectedDrops(): Promise<RejectedDrops>;
623
- /** 카드 디자인 목록 (공개). deposit의 `envelopeId`에 쓴다. */
624
- listEnvelopes(params?: {
625
- locale?: string;
626
- }): Promise<readonly Envelope[]>;
627
- /** 토큰별 pending 잔액 상위 (공개). */
628
- getLeaderboard(params: {
629
- token: Address;
630
- page?: number;
631
- pageSize?: number;
632
- identifier?: string;
633
- }): Promise<LeaderboardPage>;
634
- getMyLeaderboardEntry(params: {
635
- token: Address;
636
- }): Promise<MyLeaderboardEntry>;
637
- /** sent/received 드롭 히스토리. Bearer JWT 필요. */
638
- listHistories(params: {
639
- type: HistoryType;
640
- token?: Address;
641
- page?: number;
642
- pageSize?: number;
643
- }): Promise<HistoryPage>;
644
- /** 활성 X 연결. 없으면 null. */
645
- getXConnection(): Promise<XConnection | null>;
646
- /** X 계정을 SIWE 지갑에 연결. `listDrops`의 선행 조건. */
647
- connectX(params: {
648
- oauth: OAuthProof;
649
- }): Promise<XConnection>;
650
- /** X 연결 해제 (idempotent). */
651
- disconnectX(): Promise<void>;
652
- submitFeedback(params: {
653
- dropId: number;
654
- message: string;
655
- }): Promise<string>;
656
- setRevealYou(revealYou: boolean): Promise<boolean>;
657
- requestRecipientChangeSignature(params: {
658
- id: Id;
659
- oauth: OAuthProof;
660
- nonce: bigint;
661
- deadline: bigint;
662
- }): Promise<RecipientChangeSignature>;
663
- requestRecipientResetSignature(params: {
664
- id: Id;
665
- oauth: OAuthProof;
666
- nonce: bigint;
667
- deadline: bigint;
668
- }): Promise<RecipientSignature>;
669
- /**
670
- * anchor drop의 secret/claim key와 validator 서명을 함께 사용해 현재 pending key를
671
- * 한 번에 수령한다.
672
- */
673
- batchClaim(params: BatchClaimParams): Promise<BatchClaimResult>;
674
- /**
675
- * 서명만 따로 받는 저수준 경로(직접 컨트랙트를 호출할 때). 대부분은 `batchClaim`을 쓴다.
676
- * nonce는 `validatorNonceById(keccak256(utf8(id)))`에서 읽은 값이어야 한다.
677
- */
678
- requestBatchClaimSignature(params: {
679
- id: Id;
680
- oauth: OAuthProof;
681
- nonce: bigint;
682
- deadline: bigint;
683
- }): Promise<BatchClaimSignature>;
684
- }
685
- declare function createSafeDrop(config: SafeDropConfig, deps: SafeDropDeps): SafeDrop;
686
-
687
- export { type Address as A, type BatchClaimParams as B, type CryptoPort as C, type DepositParams as D, type Envelope as E, type SecretHash as F, type SocialIdentifier as G, type Hex as H, type Id as I, type SocialProvider as J, createSafeDrop as K, type LeaderboardEntry as L, type MappedDepositResult as M, type OAuthProof as O, type PendingDrop as P, type RefundParams as R, type SafeDropChainPort as S, type UnmappedDepositResult as U, type WithdrawParams as W, type XConnection as X, type SafeDropApiPort as a, type DepositResult as b, type BatchClaimResult as c, type ClaimSignerPort as d, type WithdrawResult as e, type RefundResult as f, type Secret as g, type BatchClaimSignature as h, type DropInbox as i, type DropSender as j, type DropState as k, type HistoryEntry as l, type HistoryPage as m, type HistoryParty as n, type HistoryType as o, type LeaderboardPage as p, type MyLeaderboardEntry as q, type OnePopDrop as r, type RecipientChangeSignature as s, type RecipientSignature as t, type RejectedDrops as u, type SafeDrop as v, type SafeDropConfig as w, type SafeDropDeps as x, SafeDropError as y, type SafeDropErrorCode as z };
383
+ export { type Address as A, type BatchClaimParams as B, type DepositParams as D, type Envelope as E, type Hex as H, type Id as I, type LeaderboardPage as L, type MyLeaderboardEntry as M, type OAuthProof as O, type PendingDrop as P, type RefundParams as R, type Secret as S, type UnmappedDepositResult as U, type WithdrawParams as W, type XConnection as X, type SecretHash as a, type DepositResult as b, type WithdrawResult as c, type RefundResult as d, type DropInbox as e, type HistoryType as f, type HistoryStatus as g, type HistoryPage as h, type RecipientChangeSignature as i, type RecipientSignature as j, type BatchClaimResult as k, type BatchClaimSignature as l, type SafeDropApiPort as m, type DropSender as n, type HistoryEntry as o, type HistoryParty as p, type HistoryReceiverParty as q, type LeaderboardEntry as r, type MappedDepositResult as s, SafeDropError as t, type SafeDropErrorCode as u, type SocialIdentifier as v, type SocialProvider as w };