@aromedia/contracts-sdk 0.2.0 → 1.0.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.
Files changed (42) hide show
  1. package/dist/chains.d.cts +10 -0
  2. package/dist/chains.d.ts +10 -0
  3. package/dist/{chunk-TZQHQLNY.js → chunk-BVDE3GSN.js} +1800 -4
  4. package/dist/chunk-BVDE3GSN.js.map +1 -0
  5. package/dist/{chunk-FWZ7XKFC.js → chunk-RL7KGQGI.js} +16 -6
  6. package/dist/chunk-RL7KGQGI.js.map +1 -0
  7. package/dist/{chunk-BYPGUFYV.js → chunk-VUYKYCOD.js} +1 -1
  8. package/dist/chunk-VUYKYCOD.js.map +1 -0
  9. package/dist/{chunk-7I5N3BGV.js → chunk-XYOUNFJU.js} +3 -3
  10. package/dist/chunk-XYOUNFJU.js.map +1 -0
  11. package/dist/generated/abis.cjs +1803 -5
  12. package/dist/generated/abis.cjs.map +1 -1
  13. package/dist/generated/abis.d.cts +5630 -2878
  14. package/dist/generated/abis.d.ts +5630 -2878
  15. package/dist/generated/abis.js +7 -3
  16. package/dist/generated/addresses.cjs +15 -5
  17. package/dist/generated/addresses.cjs.map +1 -1
  18. package/dist/generated/addresses.js +1 -1
  19. package/dist/hooks/index.cjs +20 -5
  20. package/dist/hooks/index.cjs.map +1 -1
  21. package/dist/hooks/index.d.cts +46 -5
  22. package/dist/hooks/index.d.ts +46 -5
  23. package/dist/hooks/index.js +7 -3
  24. package/dist/hooks/index.js.map +1 -1
  25. package/dist/index.cjs +2057 -196
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +132 -14
  28. package/dist/index.d.ts +132 -14
  29. package/dist/index.js +60 -7
  30. package/dist/index.js.map +1 -1
  31. package/dist/{onboarding-BHpAJaNW.d.cts → onboarding-CC_y8QgN.d.cts} +64 -9
  32. package/dist/{onboarding-DxL_LpM3.d.ts → onboarding-KnUSrGNx.d.ts} +64 -9
  33. package/dist/workflows/index.cjs +1 -1
  34. package/dist/workflows/index.cjs.map +1 -1
  35. package/dist/workflows/index.d.cts +1 -1
  36. package/dist/workflows/index.d.ts +1 -1
  37. package/dist/workflows/index.js +3 -3
  38. package/package.json +7 -7
  39. package/dist/chunk-7I5N3BGV.js.map +0 -1
  40. package/dist/chunk-BYPGUFYV.js.map +0 -1
  41. package/dist/chunk-FWZ7XKFC.js.map +0 -1
  42. package/dist/chunk-TZQHQLNY.js.map +0 -1
@@ -2,7 +2,15 @@ import { PublicClient, WalletClient, GetContractReturnType, Chain, Transport, Ac
2
2
  import { AroChainId } from './generated/addresses.cjs';
3
3
  import { AroMediaAccessManager_ABI, AroMediaAssetsRegistry_ABI, ForcedTransferManager_ABI, AroMediaIncMultiSig_ABI, AroNomination_ABI, AroMediaRWA_ABI, AroSBT_ABI } from './generated/abis.cjs';
4
4
 
5
- /** Mirrors AroSBT.Tier. */
5
+ /**
6
+ * Conventional default tier labels for AroSBT membership.
7
+ *
8
+ * On-chain, the SBT's `tier` is now an opaque `uint256` whose semantics
9
+ * are defined off-chain by the admin backend (no on-chain logic branches
10
+ * on it). These enum values are the conventional defaults the dapp
11
+ * displays when no off-chain override is available; new tier ids can be
12
+ * introduced server-side without a contract upgrade or SDK release.
13
+ */
6
14
  declare enum AroTier {
7
15
  STANDARD = 0,
8
16
  VERIFIED = 1,
@@ -10,13 +18,19 @@ declare enum AroTier {
10
18
  FOUNDING = 3
11
19
  }
12
20
  declare const AroTierLabels: Record<AroTier, string>;
13
- /** Mirrors AroNomination.NominationStatus. */
21
+ /**
22
+ * @deprecated Mirrors AroNomination.NominationStatus. The on-chain
23
+ * nomination flow is being retired in favor of an admin-portal backend
24
+ * flow (see the AroNomination_ABI deprecation). New consumers should
25
+ * read status from the admin portal API instead.
26
+ */
14
27
  declare enum NominationStatus {
15
28
  NONE = 0,
16
29
  PENDING = 1,
17
30
  APPROVED = 2,
18
31
  CLEARED = 3
19
32
  }
33
+ /** @deprecated See NominationStatus. */
20
34
  declare const NominationStatusLabels: Record<NominationStatus, string>;
21
35
  /** Mirrors ForcedTransferManager.ForcedTransferStatus. */
22
36
  declare enum ForcedTransferStatus {
@@ -187,11 +201,22 @@ declare function createAroSdk(opts: CreateAroSdkOpts): AroSdk;
187
201
  declare function addressesFor(chainId: AroChainId): Record<keyof AroAddressOverrides, `0x${string}`>;
188
202
 
189
203
  /**
190
- * Onboarding workflow helpers. These wrap multi-call sequences from the
191
- * ARO KYC/AML/CFT Policy §6 so the dapp does not have to re-implement the
192
- * choreography in three different places.
204
+ * Onboarding workflow helpers.
205
+ *
206
+ * STATUS: The on-chain nomination + admin-mint helpers below are
207
+ * @deprecated and slated for removal in a future major release. The
208
+ * nomination flow has moved to the admin backend (see the admin portal's
209
+ * /access-control + onboarding API), and SBT minting is now
210
+ * candidate-triggered against an EIP-712 voucher
211
+ * (`AroSBT.mintWithApproval`; see `../utils/mintApproval.ts` and
212
+ * `../hooks/useAroSBT.ts::useMintWithApproval`). The on-chain
213
+ * `AroNomination` contract is retained on Sepolia for compatibility but
214
+ * is no longer deployed to new networks.
215
+ *
216
+ * Status-read helpers (`checkMembershipStatus`, `describeOnboardingState`)
217
+ * remain useful regardless of the underlying flow and are NOT deprecated.
193
218
  *
194
- * Mental model (per Policy §6.3):
219
+ * Original mental model (kept for reference; pre-migration):
195
220
  *
196
221
  * 1. Existing member calls `nominateCandidate(candidate)`.
197
222
  * The nominator's vouch counts as the first vouch automatically.
@@ -216,7 +241,12 @@ declare function addressesFor(chainId: AroChainId): Record<keyof AroAddressOverr
216
241
  */
217
242
  interface MembershipStatus {
218
243
  hasSBT: boolean;
219
- tier?: AroTier;
244
+ /**
245
+ * Tier id (AroSBT.Tier enum, uint8) as returned by AroSBT.getMemberData.
246
+ * Compare with `tierLabel`, `tierAtLeast`, or the AroTier enum values for
247
+ * the conventional defaults; semantics live off-chain in the admin backend.
248
+ */
249
+ tier?: number;
220
250
  tokenId?: bigint;
221
251
  memberId?: bigint;
222
252
  issuanceDate?: bigint;
@@ -246,9 +276,16 @@ interface NominationSnapshot {
246
276
  /**
247
277
  * Snapshot of the candidate's progress through the vouch flow. The dapp
248
278
  * shows this as "you need N more vouches" in the onboarding UI.
279
+ *
280
+ * @deprecated On-chain nomination is retired. Read this status from the
281
+ * admin portal's onboarding API instead. Removal planned in a future
282
+ * major release.
249
283
  */
250
284
  declare function getNominationSnapshot(sdk: AroSdk, candidate: `0x${string}`): Promise<NominationSnapshot>;
251
285
  /**
286
+ * @deprecated On-chain nomination is retired. Use the admin portal's
287
+ * onboarding API instead. Removal planned in a future major release.
288
+ *
252
289
  * Send `nominate(candidate)` from the connected wallet. The contract
253
290
  * gates this behind "caller must already be an SBT holder"; we surface
254
291
  * the right user-facing message via `AroContractError`.
@@ -256,10 +293,17 @@ declare function getNominationSnapshot(sdk: AroSdk, candidate: `0x${string}`): P
256
293
  declare function nominateCandidate(sdk: AroSdk, candidate: `0x${string}`, opts?: {
257
294
  account?: Account | `0x${string}`;
258
295
  }): Promise<Hex>;
296
+ /**
297
+ * @deprecated On-chain vouching is retired. Use the admin portal's
298
+ * onboarding API instead. Removal planned in a future major release.
299
+ */
259
300
  declare function vouchForCandidate(sdk: AroSdk, candidate: `0x${string}`, opts?: {
260
301
  account?: Account | `0x${string}`;
261
302
  }): Promise<Hex>;
262
303
  /**
304
+ * @deprecated On-chain nomination is retired. The admin portal handles
305
+ * rejections in its backend. Removal planned in a future major release.
306
+ *
263
307
  * Admin path: clear (reject) a nomination. Restricted to authorized roles
264
308
  * via AccessManager; will revert with AccessManagedUnauthorized if the
265
309
  * caller lacks the role.
@@ -273,11 +317,22 @@ interface MintSBTOpts {
273
317
  kycHash: `0x${string}`;
274
318
  /** Off-chain profile metadata URI (ipfs://... or https://...). */
275
319
  metadataURI: string;
276
- /** Initial tier (defaults to STANDARD per Policy §6.1). */
277
- tier?: AroTier;
320
+ /**
321
+ * Initial tier id (AroSBT.Tier enum, uint8; defaults to 0 / "Standard").
322
+ * Accepts AroTier enum values for the conventional defaults, or any tier
323
+ * id defined off-chain by the admin backend.
324
+ */
325
+ tier?: number | AroTier;
278
326
  account?: Account | `0x${string}`;
279
327
  }
280
328
  /**
329
+ * @deprecated SBT minting is now candidate-triggered against an EIP-712
330
+ * voucher (`AroSBT.mintWithApproval`). The admin backend issues vouchers
331
+ * via `signMintApproval` in `../utils/mintApproval`, and the candidate
332
+ * submits via the `useMintWithApproval` hook in `../hooks/useAroSBT`.
333
+ * The direct admin mint below remains gated by ROLE_MINTER but is the
334
+ * legacy path; removal planned in a future major release.
335
+ *
281
336
  * Admin-only: mint the SBT for an approved candidate. The contract gates
282
337
  * this behind ROLE_MINTER via AccessManager (per AroMediaAccessManager).
283
338
  *
@@ -2,7 +2,15 @@ import { PublicClient, WalletClient, GetContractReturnType, Chain, Transport, Ac
2
2
  import { AroChainId } from './generated/addresses.js';
3
3
  import { AroMediaAccessManager_ABI, AroMediaAssetsRegistry_ABI, ForcedTransferManager_ABI, AroMediaIncMultiSig_ABI, AroNomination_ABI, AroMediaRWA_ABI, AroSBT_ABI } from './generated/abis.js';
4
4
 
5
- /** Mirrors AroSBT.Tier. */
5
+ /**
6
+ * Conventional default tier labels for AroSBT membership.
7
+ *
8
+ * On-chain, the SBT's `tier` is now an opaque `uint256` whose semantics
9
+ * are defined off-chain by the admin backend (no on-chain logic branches
10
+ * on it). These enum values are the conventional defaults the dapp
11
+ * displays when no off-chain override is available; new tier ids can be
12
+ * introduced server-side without a contract upgrade or SDK release.
13
+ */
6
14
  declare enum AroTier {
7
15
  STANDARD = 0,
8
16
  VERIFIED = 1,
@@ -10,13 +18,19 @@ declare enum AroTier {
10
18
  FOUNDING = 3
11
19
  }
12
20
  declare const AroTierLabels: Record<AroTier, string>;
13
- /** Mirrors AroNomination.NominationStatus. */
21
+ /**
22
+ * @deprecated Mirrors AroNomination.NominationStatus. The on-chain
23
+ * nomination flow is being retired in favor of an admin-portal backend
24
+ * flow (see the AroNomination_ABI deprecation). New consumers should
25
+ * read status from the admin portal API instead.
26
+ */
14
27
  declare enum NominationStatus {
15
28
  NONE = 0,
16
29
  PENDING = 1,
17
30
  APPROVED = 2,
18
31
  CLEARED = 3
19
32
  }
33
+ /** @deprecated See NominationStatus. */
20
34
  declare const NominationStatusLabels: Record<NominationStatus, string>;
21
35
  /** Mirrors ForcedTransferManager.ForcedTransferStatus. */
22
36
  declare enum ForcedTransferStatus {
@@ -187,11 +201,22 @@ declare function createAroSdk(opts: CreateAroSdkOpts): AroSdk;
187
201
  declare function addressesFor(chainId: AroChainId): Record<keyof AroAddressOverrides, `0x${string}`>;
188
202
 
189
203
  /**
190
- * Onboarding workflow helpers. These wrap multi-call sequences from the
191
- * ARO KYC/AML/CFT Policy §6 so the dapp does not have to re-implement the
192
- * choreography in three different places.
204
+ * Onboarding workflow helpers.
205
+ *
206
+ * STATUS: The on-chain nomination + admin-mint helpers below are
207
+ * @deprecated and slated for removal in a future major release. The
208
+ * nomination flow has moved to the admin backend (see the admin portal's
209
+ * /access-control + onboarding API), and SBT minting is now
210
+ * candidate-triggered against an EIP-712 voucher
211
+ * (`AroSBT.mintWithApproval`; see `../utils/mintApproval.ts` and
212
+ * `../hooks/useAroSBT.ts::useMintWithApproval`). The on-chain
213
+ * `AroNomination` contract is retained on Sepolia for compatibility but
214
+ * is no longer deployed to new networks.
215
+ *
216
+ * Status-read helpers (`checkMembershipStatus`, `describeOnboardingState`)
217
+ * remain useful regardless of the underlying flow and are NOT deprecated.
193
218
  *
194
- * Mental model (per Policy §6.3):
219
+ * Original mental model (kept for reference; pre-migration):
195
220
  *
196
221
  * 1. Existing member calls `nominateCandidate(candidate)`.
197
222
  * The nominator's vouch counts as the first vouch automatically.
@@ -216,7 +241,12 @@ declare function addressesFor(chainId: AroChainId): Record<keyof AroAddressOverr
216
241
  */
217
242
  interface MembershipStatus {
218
243
  hasSBT: boolean;
219
- tier?: AroTier;
244
+ /**
245
+ * Tier id (AroSBT.Tier enum, uint8) as returned by AroSBT.getMemberData.
246
+ * Compare with `tierLabel`, `tierAtLeast`, or the AroTier enum values for
247
+ * the conventional defaults; semantics live off-chain in the admin backend.
248
+ */
249
+ tier?: number;
220
250
  tokenId?: bigint;
221
251
  memberId?: bigint;
222
252
  issuanceDate?: bigint;
@@ -246,9 +276,16 @@ interface NominationSnapshot {
246
276
  /**
247
277
  * Snapshot of the candidate's progress through the vouch flow. The dapp
248
278
  * shows this as "you need N more vouches" in the onboarding UI.
279
+ *
280
+ * @deprecated On-chain nomination is retired. Read this status from the
281
+ * admin portal's onboarding API instead. Removal planned in a future
282
+ * major release.
249
283
  */
250
284
  declare function getNominationSnapshot(sdk: AroSdk, candidate: `0x${string}`): Promise<NominationSnapshot>;
251
285
  /**
286
+ * @deprecated On-chain nomination is retired. Use the admin portal's
287
+ * onboarding API instead. Removal planned in a future major release.
288
+ *
252
289
  * Send `nominate(candidate)` from the connected wallet. The contract
253
290
  * gates this behind "caller must already be an SBT holder"; we surface
254
291
  * the right user-facing message via `AroContractError`.
@@ -256,10 +293,17 @@ declare function getNominationSnapshot(sdk: AroSdk, candidate: `0x${string}`): P
256
293
  declare function nominateCandidate(sdk: AroSdk, candidate: `0x${string}`, opts?: {
257
294
  account?: Account | `0x${string}`;
258
295
  }): Promise<Hex>;
296
+ /**
297
+ * @deprecated On-chain vouching is retired. Use the admin portal's
298
+ * onboarding API instead. Removal planned in a future major release.
299
+ */
259
300
  declare function vouchForCandidate(sdk: AroSdk, candidate: `0x${string}`, opts?: {
260
301
  account?: Account | `0x${string}`;
261
302
  }): Promise<Hex>;
262
303
  /**
304
+ * @deprecated On-chain nomination is retired. The admin portal handles
305
+ * rejections in its backend. Removal planned in a future major release.
306
+ *
263
307
  * Admin path: clear (reject) a nomination. Restricted to authorized roles
264
308
  * via AccessManager; will revert with AccessManagedUnauthorized if the
265
309
  * caller lacks the role.
@@ -273,11 +317,22 @@ interface MintSBTOpts {
273
317
  kycHash: `0x${string}`;
274
318
  /** Off-chain profile metadata URI (ipfs://... or https://...). */
275
319
  metadataURI: string;
276
- /** Initial tier (defaults to STANDARD per Policy §6.1). */
277
- tier?: AroTier;
320
+ /**
321
+ * Initial tier id (AroSBT.Tier enum, uint8; defaults to 0 / "Standard").
322
+ * Accepts AroTier enum values for the conventional defaults, or any tier
323
+ * id defined off-chain by the admin backend.
324
+ */
325
+ tier?: number | AroTier;
278
326
  account?: Account | `0x${string}`;
279
327
  }
280
328
  /**
329
+ * @deprecated SBT minting is now candidate-triggered against an EIP-712
330
+ * voucher (`AroSBT.mintWithApproval`). The admin backend issues vouchers
331
+ * via `signMintApproval` in `../utils/mintApproval`, and the candidate
332
+ * submits via the `useMintWithApproval` hook in `../hooks/useAroSBT`.
333
+ * The direct admin mint below remains gated by ROLE_MINTER but is the
334
+ * legacy path; removal planned in a future major release.
335
+ *
281
336
  * Admin-only: mint the SBT for an approved candidate. The contract gates
282
337
  * this behind ROLE_MINTER via AccessManager (per AroMediaAccessManager).
283
338
  *
@@ -1890,7 +1890,7 @@ async function mintSBTForApproved(sdk, opts) {
1890
1890
  throw new Error("mintSBTForApproved requires a walletClient on the SDK");
1891
1891
  }
1892
1892
  const wallet = sdk.walletClient;
1893
- const tier = opts.tier ?? 0 /* STANDARD */;
1893
+ const tier = opts.tier === void 0 ? 0 : typeof opts.tier === "bigint" ? Number(opts.tier) : opts.tier;
1894
1894
  try {
1895
1895
  return await wallet.writeContract({
1896
1896
  account: pickAccount(wallet, opts.account),