@aromedia/contracts-sdk 0.2.0 → 1.0.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/dist/chains.d.cts +10 -0
- package/dist/chains.d.ts +10 -0
- package/dist/{chunk-7I5N3BGV.js → chunk-BENMJNYO.js} +3 -3
- package/dist/chunk-BENMJNYO.js.map +1 -0
- package/dist/{chunk-TZQHQLNY.js → chunk-EGUPIYHR.js} +2242 -199
- package/dist/chunk-EGUPIYHR.js.map +1 -0
- package/dist/{chunk-BYPGUFYV.js → chunk-VUYKYCOD.js} +1 -1
- package/dist/chunk-VUYKYCOD.js.map +1 -0
- package/dist/{chunk-FWZ7XKFC.js → chunk-WUHQC3GY.js} +22 -12
- package/dist/chunk-WUHQC3GY.js.map +1 -0
- package/dist/generated/abis.cjs +2245 -200
- package/dist/generated/abis.cjs.map +1 -1
- package/dist/generated/abis.d.cts +6046 -2916
- package/dist/generated/abis.d.ts +6046 -2916
- package/dist/generated/abis.js +7 -3
- package/dist/generated/addresses.cjs +21 -11
- package/dist/generated/addresses.cjs.map +1 -1
- package/dist/generated/addresses.js +1 -1
- package/dist/hooks/index.cjs +307 -27
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +46 -5
- package/dist/hooks/index.d.ts +46 -5
- package/dist/hooks/index.js +7 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +2421 -313
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +132 -14
- package/dist/index.d.ts +132 -14
- package/dist/index.js +60 -7
- package/dist/index.js.map +1 -1
- package/dist/{onboarding-DxL_LpM3.d.ts → onboarding-BD_g7Len.d.ts} +64 -9
- package/dist/{onboarding-BHpAJaNW.d.cts → onboarding-DDKwXy8O.d.cts} +64 -9
- package/dist/workflows/index.cjs +282 -17
- package/dist/workflows/index.cjs.map +1 -1
- package/dist/workflows/index.d.cts +1 -1
- package/dist/workflows/index.d.ts +1 -1
- package/dist/workflows/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-7I5N3BGV.js.map +0 -1
- package/dist/chunk-BYPGUFYV.js.map +0 -1
- package/dist/chunk-FWZ7XKFC.js.map +0 -1
- package/dist/chunk-TZQHQLNY.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
export { AroContractName, AroMediaAccessManager_ABI, AroMediaAssetsRegistry_ABI, AroMediaIncMultiSig_ABI, AroMediaRWA_ABI, AroNomination_ABI, AroSBT_ABI, ForcedTransferManager_ABI, abis } from './generated/abis.cjs';
|
|
1
|
+
export { AroContractName, AroLiquidityCommitment_ABI, AroMediaAccessManager_ABI, AroMediaAssetsRegistry_ABI, AroMediaIncMultiSig_ABI, AroMediaRWA_ABI, AroNomination_ABI, AroSBT_ABI, ForcedTransferManager_ABI, abis, cAROUSD_ABI } from './generated/abis.cjs';
|
|
2
2
|
export { AroChainId, SUPPORTED_CHAIN_IDS, ZERO_ADDRESS, addresses, chainLabels, getAddress } from './generated/addresses.cjs';
|
|
3
|
-
import { k as AroTier } from './onboarding-
|
|
4
|
-
export { A as AccessManagerClientOpts, a as AroAccessManagerContract, b as AroAddressOverrides, c as AroAssetsRegistryContract, d as AroMultiSigContract, e as AroNominationContract, f as AroRWAContract, g as AroRoleName, h as AroRoles, i as AroSBTContract, j as AroSdk, l as AroTierLabels, m as AssetsRegistryClientOpts, C as CreateAroSdkOpts, F as ForcedTransferClientOpts, n as ForcedTransferManagerContract, o as ForcedTransferStatus, p as ForcedTransferStatusLabels, M as MembershipStatus, q as MintSBTOpts, r as MultiSigClientOpts, N as NominationClientOpts, s as NominationSnapshot, t as NominationStatus, u as NominationStatusLabels, O as OnboardingState, v as OnboardingStep, R as RwaClientOpts, S as SbtClientOpts, w as addressesFor, x as checkMembershipStatus, y as clearNomination, z as createAccessManagerClient, B as createAroSdk, D as createAssetsRegistryClient, E as createForcedTransferClient, G as createMultiSigClient, H as createNominationClient, I as createRwaClient, J as createSbtClient, K as describeOnboardingState, L as getNominationSnapshot, P as mintSBTForApproved, Q as nominateCandidate, T as vouchForCandidate } from './onboarding-
|
|
3
|
+
import { k as AroTier } from './onboarding-DDKwXy8O.cjs';
|
|
4
|
+
export { A as AccessManagerClientOpts, a as AroAccessManagerContract, b as AroAddressOverrides, c as AroAssetsRegistryContract, d as AroMultiSigContract, e as AroNominationContract, f as AroRWAContract, g as AroRoleName, h as AroRoles, i as AroSBTContract, j as AroSdk, l as AroTierLabels, m as AssetsRegistryClientOpts, C as CreateAroSdkOpts, F as ForcedTransferClientOpts, n as ForcedTransferManagerContract, o as ForcedTransferStatus, p as ForcedTransferStatusLabels, M as MembershipStatus, q as MintSBTOpts, r as MultiSigClientOpts, N as NominationClientOpts, s as NominationSnapshot, t as NominationStatus, u as NominationStatusLabels, O as OnboardingState, v as OnboardingStep, R as RwaClientOpts, S as SbtClientOpts, w as addressesFor, x as checkMembershipStatus, y as clearNomination, z as createAccessManagerClient, B as createAroSdk, D as createAssetsRegistryClient, E as createForcedTransferClient, G as createMultiSigClient, H as createNominationClient, I as createRwaClient, J as createSbtClient, K as describeOnboardingState, L as getNominationSnapshot, P as mintSBTForApproved, Q as nominateCandidate, T as vouchForCandidate } from './onboarding-DDKwXy8O.cjs';
|
|
5
5
|
export { AroChainLabel, DEFAULT_CHAIN, aroChains, chainById, getChain } from './chains.cjs';
|
|
6
6
|
export { KycPayload, NormalizedKycResult, computeKycHash, hashKycResult } from './workflows/index.cjs';
|
|
7
|
+
import { Hex, TypedDataDomain, Account, LocalAccount } from 'viem';
|
|
7
8
|
export { base, baseSepolia, hardhat, mainnet, sepolia } from 'viem/chains';
|
|
8
|
-
import 'viem';
|
|
9
9
|
import 'abitype';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* Conventional KYC verification depth per default tier id.
|
|
13
|
+
*
|
|
14
|
+
* On-chain, the SBT's tier is an opaque `uint256`; no contract logic
|
|
15
|
+
* branches on it. These conventional labels and policy descriptions are
|
|
16
|
+
* the defaults the dapp displays when the admin backend hasn't supplied
|
|
17
|
+
* an override. New tier ids can be defined server-side without a
|
|
18
|
+
* contract upgrade or SDK release.
|
|
18
19
|
*/
|
|
19
20
|
declare const tierRequirements: Record<AroTier, string>;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a tier id to a human-readable label. Falls back to a generic
|
|
23
|
+
* `Tier <n>` for unknown ids (the admin backend can introduce new tiers
|
|
24
|
+
* without an SDK release).
|
|
25
|
+
*/
|
|
26
|
+
declare function tierLabel(tier: bigint | number): string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a member at `held` tier meets the `required` minimum tier, by
|
|
29
|
+
* numeric ordering. Convention: higher ids are stricter. Non-linear
|
|
30
|
+
* tier orderings should be implemented off-chain in the admin backend.
|
|
31
|
+
*/
|
|
32
|
+
declare function tierAtLeast(held: bigint | number, required: bigint | number): boolean;
|
|
23
33
|
|
|
24
34
|
/**
|
|
25
35
|
* Friendly error class wrapping a decoded custom error from one of the Aro
|
|
@@ -39,4 +49,112 @@ declare class AroContractError extends Error {
|
|
|
39
49
|
}
|
|
40
50
|
declare function decodeAroError(err: unknown): AroContractError | null;
|
|
41
51
|
|
|
42
|
-
|
|
52
|
+
/**
|
|
53
|
+
* EIP-712 domain for AroSBT.mintWithApproval. Mirrors the contract's
|
|
54
|
+
* `EIP712("AroSBT", "1")` constructor.
|
|
55
|
+
*/
|
|
56
|
+
declare function mintApprovalDomain(chainId: number | bigint, sbtAddress: `0x${string}`): TypedDataDomain;
|
|
57
|
+
/**
|
|
58
|
+
* Typed-data types for the MintApproval voucher. The field order is
|
|
59
|
+
* load-bearing (it must match the order in the contract's
|
|
60
|
+
* MINT_APPROVAL_TYPEHASH string).
|
|
61
|
+
*/
|
|
62
|
+
declare const MINT_APPROVAL_TYPES: {
|
|
63
|
+
readonly MintApproval: readonly [{
|
|
64
|
+
readonly name: "candidate";
|
|
65
|
+
readonly type: "address";
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "tier";
|
|
68
|
+
readonly type: "uint256";
|
|
69
|
+
}, {
|
|
70
|
+
readonly name: "kycHash";
|
|
71
|
+
readonly type: "bytes32";
|
|
72
|
+
}, {
|
|
73
|
+
readonly name: "nominationId";
|
|
74
|
+
readonly type: "bytes32";
|
|
75
|
+
}, {
|
|
76
|
+
readonly name: "metadataURI";
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
}, {
|
|
79
|
+
readonly name: "deadline";
|
|
80
|
+
readonly type: "uint64";
|
|
81
|
+
}, {
|
|
82
|
+
readonly name: "nonce";
|
|
83
|
+
readonly type: "bytes32";
|
|
84
|
+
}];
|
|
85
|
+
};
|
|
86
|
+
/** Fields the approver signs. Matches the on-chain MintApproval struct. */
|
|
87
|
+
interface MintApprovalPayload {
|
|
88
|
+
candidate: `0x${string}`;
|
|
89
|
+
/** Opaque tier id (semantics live off-chain in the admin backend). */
|
|
90
|
+
tier: bigint;
|
|
91
|
+
kycHash: `0x${string}`;
|
|
92
|
+
/** Admin-backend nomination record id, encoded as bytes32. */
|
|
93
|
+
nominationId: `0x${string}`;
|
|
94
|
+
/** IPFS / HTTP URI for the candidate's profile metadata. */
|
|
95
|
+
metadataURI: string;
|
|
96
|
+
/** Unix seconds; voucher is rejected after this. */
|
|
97
|
+
deadline: bigint;
|
|
98
|
+
/** 32-byte unique value; the digest is the on-chain nullifier key. */
|
|
99
|
+
nonce: `0x${string}`;
|
|
100
|
+
}
|
|
101
|
+
/** A signed voucher, ready for the candidate to submit. */
|
|
102
|
+
interface SignedMintApproval {
|
|
103
|
+
payload: MintApprovalPayload;
|
|
104
|
+
signature: Hex;
|
|
105
|
+
domain: TypedDataDomain;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Sign a MintApproval voucher with the approver's key.
|
|
109
|
+
*
|
|
110
|
+
* The account must hold ROLE_MINTER on the AccessManager (mintWithApproval
|
|
111
|
+
* checks this on-chain). Typical use: the admin backend builds the payload
|
|
112
|
+
* once the candidate's review is complete, signs it with a server-held
|
|
113
|
+
* signer (viem `privateKeyToAccount` / `mnemonicToAccount`), and stores
|
|
114
|
+
* (or directly returns) the signed voucher for the candidate's mint call.
|
|
115
|
+
*
|
|
116
|
+
* @param account Any viem account with `signTypedData` support
|
|
117
|
+
* (LocalAccount, JsonRpcAccount, etc.).
|
|
118
|
+
* @param sbtAddress Deployed AroSBT contract address.
|
|
119
|
+
* @param chainId EVM chain id the voucher is bound to.
|
|
120
|
+
* @param payload The MintApproval fields.
|
|
121
|
+
*/
|
|
122
|
+
declare function signMintApproval(account: Account & {
|
|
123
|
+
signTypedData: LocalAccount["signTypedData"];
|
|
124
|
+
}, sbtAddress: `0x${string}`, chainId: number | bigint, payload: MintApprovalPayload): Promise<SignedMintApproval>;
|
|
125
|
+
/**
|
|
126
|
+
* Reconstruct the typed-data argument the candidate (or any signer)
|
|
127
|
+
* passes to `signTypedData` / `verifyTypedData`. Useful when the signing
|
|
128
|
+
* step happens in code outside the SDK (e.g. browser wallet flow).
|
|
129
|
+
*/
|
|
130
|
+
declare function mintApprovalTypedData(sbtAddress: `0x${string}`, chainId: number | bigint, payload: MintApprovalPayload): {
|
|
131
|
+
domain: TypedDataDomain;
|
|
132
|
+
types: {
|
|
133
|
+
readonly MintApproval: readonly [{
|
|
134
|
+
readonly name: "candidate";
|
|
135
|
+
readonly type: "address";
|
|
136
|
+
}, {
|
|
137
|
+
readonly name: "tier";
|
|
138
|
+
readonly type: "uint256";
|
|
139
|
+
}, {
|
|
140
|
+
readonly name: "kycHash";
|
|
141
|
+
readonly type: "bytes32";
|
|
142
|
+
}, {
|
|
143
|
+
readonly name: "nominationId";
|
|
144
|
+
readonly type: "bytes32";
|
|
145
|
+
}, {
|
|
146
|
+
readonly name: "metadataURI";
|
|
147
|
+
readonly type: "string";
|
|
148
|
+
}, {
|
|
149
|
+
readonly name: "deadline";
|
|
150
|
+
readonly type: "uint64";
|
|
151
|
+
}, {
|
|
152
|
+
readonly name: "nonce";
|
|
153
|
+
readonly type: "bytes32";
|
|
154
|
+
}];
|
|
155
|
+
};
|
|
156
|
+
primaryType: "MintApproval";
|
|
157
|
+
message: MintApprovalPayload;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export { AroContractError, AroTier, MINT_APPROVAL_TYPES, type MintApprovalPayload, type SignedMintApproval, decodeAroError, mintApprovalDomain, mintApprovalTypedData, signMintApproval, tierAtLeast, tierLabel, tierRequirements };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
export { AroContractName, AroMediaAccessManager_ABI, AroMediaAssetsRegistry_ABI, AroMediaIncMultiSig_ABI, AroMediaRWA_ABI, AroNomination_ABI, AroSBT_ABI, ForcedTransferManager_ABI, abis } from './generated/abis.js';
|
|
1
|
+
export { AroContractName, AroLiquidityCommitment_ABI, AroMediaAccessManager_ABI, AroMediaAssetsRegistry_ABI, AroMediaIncMultiSig_ABI, AroMediaRWA_ABI, AroNomination_ABI, AroSBT_ABI, ForcedTransferManager_ABI, abis, cAROUSD_ABI } from './generated/abis.js';
|
|
2
2
|
export { AroChainId, SUPPORTED_CHAIN_IDS, ZERO_ADDRESS, addresses, chainLabels, getAddress } from './generated/addresses.js';
|
|
3
|
-
import { k as AroTier } from './onboarding-
|
|
4
|
-
export { A as AccessManagerClientOpts, a as AroAccessManagerContract, b as AroAddressOverrides, c as AroAssetsRegistryContract, d as AroMultiSigContract, e as AroNominationContract, f as AroRWAContract, g as AroRoleName, h as AroRoles, i as AroSBTContract, j as AroSdk, l as AroTierLabels, m as AssetsRegistryClientOpts, C as CreateAroSdkOpts, F as ForcedTransferClientOpts, n as ForcedTransferManagerContract, o as ForcedTransferStatus, p as ForcedTransferStatusLabels, M as MembershipStatus, q as MintSBTOpts, r as MultiSigClientOpts, N as NominationClientOpts, s as NominationSnapshot, t as NominationStatus, u as NominationStatusLabels, O as OnboardingState, v as OnboardingStep, R as RwaClientOpts, S as SbtClientOpts, w as addressesFor, x as checkMembershipStatus, y as clearNomination, z as createAccessManagerClient, B as createAroSdk, D as createAssetsRegistryClient, E as createForcedTransferClient, G as createMultiSigClient, H as createNominationClient, I as createRwaClient, J as createSbtClient, K as describeOnboardingState, L as getNominationSnapshot, P as mintSBTForApproved, Q as nominateCandidate, T as vouchForCandidate } from './onboarding-
|
|
3
|
+
import { k as AroTier } from './onboarding-BD_g7Len.js';
|
|
4
|
+
export { A as AccessManagerClientOpts, a as AroAccessManagerContract, b as AroAddressOverrides, c as AroAssetsRegistryContract, d as AroMultiSigContract, e as AroNominationContract, f as AroRWAContract, g as AroRoleName, h as AroRoles, i as AroSBTContract, j as AroSdk, l as AroTierLabels, m as AssetsRegistryClientOpts, C as CreateAroSdkOpts, F as ForcedTransferClientOpts, n as ForcedTransferManagerContract, o as ForcedTransferStatus, p as ForcedTransferStatusLabels, M as MembershipStatus, q as MintSBTOpts, r as MultiSigClientOpts, N as NominationClientOpts, s as NominationSnapshot, t as NominationStatus, u as NominationStatusLabels, O as OnboardingState, v as OnboardingStep, R as RwaClientOpts, S as SbtClientOpts, w as addressesFor, x as checkMembershipStatus, y as clearNomination, z as createAccessManagerClient, B as createAroSdk, D as createAssetsRegistryClient, E as createForcedTransferClient, G as createMultiSigClient, H as createNominationClient, I as createRwaClient, J as createSbtClient, K as describeOnboardingState, L as getNominationSnapshot, P as mintSBTForApproved, Q as nominateCandidate, T as vouchForCandidate } from './onboarding-BD_g7Len.js';
|
|
5
5
|
export { AroChainLabel, DEFAULT_CHAIN, aroChains, chainById, getChain } from './chains.js';
|
|
6
6
|
export { KycPayload, NormalizedKycResult, computeKycHash, hashKycResult } from './workflows/index.js';
|
|
7
|
+
import { Hex, TypedDataDomain, Account, LocalAccount } from 'viem';
|
|
7
8
|
export { base, baseSepolia, hardhat, mainnet, sepolia } from 'viem/chains';
|
|
8
|
-
import 'viem';
|
|
9
9
|
import 'abitype';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* Conventional KYC verification depth per default tier id.
|
|
13
|
+
*
|
|
14
|
+
* On-chain, the SBT's tier is an opaque `uint256`; no contract logic
|
|
15
|
+
* branches on it. These conventional labels and policy descriptions are
|
|
16
|
+
* the defaults the dapp displays when the admin backend hasn't supplied
|
|
17
|
+
* an override. New tier ids can be defined server-side without a
|
|
18
|
+
* contract upgrade or SDK release.
|
|
18
19
|
*/
|
|
19
20
|
declare const tierRequirements: Record<AroTier, string>;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a tier id to a human-readable label. Falls back to a generic
|
|
23
|
+
* `Tier <n>` for unknown ids (the admin backend can introduce new tiers
|
|
24
|
+
* without an SDK release).
|
|
25
|
+
*/
|
|
26
|
+
declare function tierLabel(tier: bigint | number): string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a member at `held` tier meets the `required` minimum tier, by
|
|
29
|
+
* numeric ordering. Convention: higher ids are stricter. Non-linear
|
|
30
|
+
* tier orderings should be implemented off-chain in the admin backend.
|
|
31
|
+
*/
|
|
32
|
+
declare function tierAtLeast(held: bigint | number, required: bigint | number): boolean;
|
|
23
33
|
|
|
24
34
|
/**
|
|
25
35
|
* Friendly error class wrapping a decoded custom error from one of the Aro
|
|
@@ -39,4 +49,112 @@ declare class AroContractError extends Error {
|
|
|
39
49
|
}
|
|
40
50
|
declare function decodeAroError(err: unknown): AroContractError | null;
|
|
41
51
|
|
|
42
|
-
|
|
52
|
+
/**
|
|
53
|
+
* EIP-712 domain for AroSBT.mintWithApproval. Mirrors the contract's
|
|
54
|
+
* `EIP712("AroSBT", "1")` constructor.
|
|
55
|
+
*/
|
|
56
|
+
declare function mintApprovalDomain(chainId: number | bigint, sbtAddress: `0x${string}`): TypedDataDomain;
|
|
57
|
+
/**
|
|
58
|
+
* Typed-data types for the MintApproval voucher. The field order is
|
|
59
|
+
* load-bearing (it must match the order in the contract's
|
|
60
|
+
* MINT_APPROVAL_TYPEHASH string).
|
|
61
|
+
*/
|
|
62
|
+
declare const MINT_APPROVAL_TYPES: {
|
|
63
|
+
readonly MintApproval: readonly [{
|
|
64
|
+
readonly name: "candidate";
|
|
65
|
+
readonly type: "address";
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "tier";
|
|
68
|
+
readonly type: "uint256";
|
|
69
|
+
}, {
|
|
70
|
+
readonly name: "kycHash";
|
|
71
|
+
readonly type: "bytes32";
|
|
72
|
+
}, {
|
|
73
|
+
readonly name: "nominationId";
|
|
74
|
+
readonly type: "bytes32";
|
|
75
|
+
}, {
|
|
76
|
+
readonly name: "metadataURI";
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
}, {
|
|
79
|
+
readonly name: "deadline";
|
|
80
|
+
readonly type: "uint64";
|
|
81
|
+
}, {
|
|
82
|
+
readonly name: "nonce";
|
|
83
|
+
readonly type: "bytes32";
|
|
84
|
+
}];
|
|
85
|
+
};
|
|
86
|
+
/** Fields the approver signs. Matches the on-chain MintApproval struct. */
|
|
87
|
+
interface MintApprovalPayload {
|
|
88
|
+
candidate: `0x${string}`;
|
|
89
|
+
/** Opaque tier id (semantics live off-chain in the admin backend). */
|
|
90
|
+
tier: bigint;
|
|
91
|
+
kycHash: `0x${string}`;
|
|
92
|
+
/** Admin-backend nomination record id, encoded as bytes32. */
|
|
93
|
+
nominationId: `0x${string}`;
|
|
94
|
+
/** IPFS / HTTP URI for the candidate's profile metadata. */
|
|
95
|
+
metadataURI: string;
|
|
96
|
+
/** Unix seconds; voucher is rejected after this. */
|
|
97
|
+
deadline: bigint;
|
|
98
|
+
/** 32-byte unique value; the digest is the on-chain nullifier key. */
|
|
99
|
+
nonce: `0x${string}`;
|
|
100
|
+
}
|
|
101
|
+
/** A signed voucher, ready for the candidate to submit. */
|
|
102
|
+
interface SignedMintApproval {
|
|
103
|
+
payload: MintApprovalPayload;
|
|
104
|
+
signature: Hex;
|
|
105
|
+
domain: TypedDataDomain;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Sign a MintApproval voucher with the approver's key.
|
|
109
|
+
*
|
|
110
|
+
* The account must hold ROLE_MINTER on the AccessManager (mintWithApproval
|
|
111
|
+
* checks this on-chain). Typical use: the admin backend builds the payload
|
|
112
|
+
* once the candidate's review is complete, signs it with a server-held
|
|
113
|
+
* signer (viem `privateKeyToAccount` / `mnemonicToAccount`), and stores
|
|
114
|
+
* (or directly returns) the signed voucher for the candidate's mint call.
|
|
115
|
+
*
|
|
116
|
+
* @param account Any viem account with `signTypedData` support
|
|
117
|
+
* (LocalAccount, JsonRpcAccount, etc.).
|
|
118
|
+
* @param sbtAddress Deployed AroSBT contract address.
|
|
119
|
+
* @param chainId EVM chain id the voucher is bound to.
|
|
120
|
+
* @param payload The MintApproval fields.
|
|
121
|
+
*/
|
|
122
|
+
declare function signMintApproval(account: Account & {
|
|
123
|
+
signTypedData: LocalAccount["signTypedData"];
|
|
124
|
+
}, sbtAddress: `0x${string}`, chainId: number | bigint, payload: MintApprovalPayload): Promise<SignedMintApproval>;
|
|
125
|
+
/**
|
|
126
|
+
* Reconstruct the typed-data argument the candidate (or any signer)
|
|
127
|
+
* passes to `signTypedData` / `verifyTypedData`. Useful when the signing
|
|
128
|
+
* step happens in code outside the SDK (e.g. browser wallet flow).
|
|
129
|
+
*/
|
|
130
|
+
declare function mintApprovalTypedData(sbtAddress: `0x${string}`, chainId: number | bigint, payload: MintApprovalPayload): {
|
|
131
|
+
domain: TypedDataDomain;
|
|
132
|
+
types: {
|
|
133
|
+
readonly MintApproval: readonly [{
|
|
134
|
+
readonly name: "candidate";
|
|
135
|
+
readonly type: "address";
|
|
136
|
+
}, {
|
|
137
|
+
readonly name: "tier";
|
|
138
|
+
readonly type: "uint256";
|
|
139
|
+
}, {
|
|
140
|
+
readonly name: "kycHash";
|
|
141
|
+
readonly type: "bytes32";
|
|
142
|
+
}, {
|
|
143
|
+
readonly name: "nominationId";
|
|
144
|
+
readonly type: "bytes32";
|
|
145
|
+
}, {
|
|
146
|
+
readonly name: "metadataURI";
|
|
147
|
+
readonly type: "string";
|
|
148
|
+
}, {
|
|
149
|
+
readonly name: "deadline";
|
|
150
|
+
readonly type: "uint64";
|
|
151
|
+
}, {
|
|
152
|
+
readonly name: "nonce";
|
|
153
|
+
readonly type: "bytes32";
|
|
154
|
+
}];
|
|
155
|
+
};
|
|
156
|
+
primaryType: "MintApproval";
|
|
157
|
+
message: MintApprovalPayload;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export { AroContractError, AroTier, MINT_APPROVAL_TYPES, type MintApprovalPayload, type SignedMintApproval, decodeAroError, mintApprovalDomain, mintApprovalTypedData, signMintApproval, tierAtLeast, tierLabel, tierRequirements };
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
addresses,
|
|
16
16
|
chainLabels,
|
|
17
17
|
getAddress
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WUHQC3GY.js";
|
|
19
19
|
import {
|
|
20
20
|
AroContractError,
|
|
21
21
|
checkMembershipStatus,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
mintSBTForApproved,
|
|
29
29
|
nominateCandidate,
|
|
30
30
|
vouchForCandidate
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-BENMJNYO.js";
|
|
32
32
|
import {
|
|
33
33
|
AroTier,
|
|
34
34
|
AroTierLabels,
|
|
@@ -36,8 +36,9 @@ import {
|
|
|
36
36
|
ForcedTransferStatusLabels,
|
|
37
37
|
NominationStatus,
|
|
38
38
|
NominationStatusLabels
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-VUYKYCOD.js";
|
|
40
40
|
import {
|
|
41
|
+
AroLiquidityCommitment_ABI,
|
|
41
42
|
AroMediaAccessManager_ABI,
|
|
42
43
|
AroMediaAssetsRegistry_ABI,
|
|
43
44
|
AroMediaIncMultiSig_ABI,
|
|
@@ -45,8 +46,9 @@ import {
|
|
|
45
46
|
AroNomination_ABI,
|
|
46
47
|
AroSBT_ABI,
|
|
47
48
|
ForcedTransferManager_ABI,
|
|
48
|
-
abis
|
|
49
|
-
|
|
49
|
+
abis,
|
|
50
|
+
cAROUSD_ABI
|
|
51
|
+
} from "./chunk-EGUPIYHR.js";
|
|
50
52
|
|
|
51
53
|
// src/clients/createAroSdk.ts
|
|
52
54
|
import {
|
|
@@ -196,13 +198,59 @@ var tierRequirements = {
|
|
|
196
198
|
[3 /* FOUNDING */]: "Founding member; highest verification and vetting."
|
|
197
199
|
};
|
|
198
200
|
function tierLabel(tier) {
|
|
199
|
-
|
|
201
|
+
const asNumber = typeof tier === "bigint" ? Number(tier) : tier;
|
|
202
|
+
if (Number.isInteger(asNumber) && asNumber in AroTierLabels) {
|
|
203
|
+
return AroTierLabels[asNumber];
|
|
204
|
+
}
|
|
205
|
+
return `Tier ${asNumber}`;
|
|
200
206
|
}
|
|
201
207
|
function tierAtLeast(held, required) {
|
|
202
|
-
|
|
208
|
+
const heldNum = typeof held === "bigint" ? held : BigInt(held);
|
|
209
|
+
const requiredNum = typeof required === "bigint" ? required : BigInt(required);
|
|
210
|
+
return heldNum >= requiredNum;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// src/utils/mintApproval.ts
|
|
214
|
+
function mintApprovalDomain(chainId, sbtAddress) {
|
|
215
|
+
return {
|
|
216
|
+
name: "AroSBT",
|
|
217
|
+
version: "1",
|
|
218
|
+
chainId: typeof chainId === "bigint" ? Number(chainId) : chainId,
|
|
219
|
+
verifyingContract: sbtAddress
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
var MINT_APPROVAL_TYPES = {
|
|
223
|
+
MintApproval: [
|
|
224
|
+
{ name: "candidate", type: "address" },
|
|
225
|
+
{ name: "tier", type: "uint256" },
|
|
226
|
+
{ name: "kycHash", type: "bytes32" },
|
|
227
|
+
{ name: "nominationId", type: "bytes32" },
|
|
228
|
+
{ name: "metadataURI", type: "string" },
|
|
229
|
+
{ name: "deadline", type: "uint64" },
|
|
230
|
+
{ name: "nonce", type: "bytes32" }
|
|
231
|
+
]
|
|
232
|
+
};
|
|
233
|
+
async function signMintApproval(account, sbtAddress, chainId, payload) {
|
|
234
|
+
const domain = mintApprovalDomain(chainId, sbtAddress);
|
|
235
|
+
const signature = await account.signTypedData({
|
|
236
|
+
domain,
|
|
237
|
+
types: MINT_APPROVAL_TYPES,
|
|
238
|
+
primaryType: "MintApproval",
|
|
239
|
+
message: payload
|
|
240
|
+
});
|
|
241
|
+
return { payload, signature, domain };
|
|
242
|
+
}
|
|
243
|
+
function mintApprovalTypedData(sbtAddress, chainId, payload) {
|
|
244
|
+
return {
|
|
245
|
+
domain: mintApprovalDomain(chainId, sbtAddress),
|
|
246
|
+
types: MINT_APPROVAL_TYPES,
|
|
247
|
+
primaryType: "MintApproval",
|
|
248
|
+
message: payload
|
|
249
|
+
};
|
|
203
250
|
}
|
|
204
251
|
export {
|
|
205
252
|
AroContractError,
|
|
253
|
+
AroLiquidityCommitment_ABI,
|
|
206
254
|
AroMediaAccessManager_ABI,
|
|
207
255
|
AroMediaAssetsRegistry_ABI,
|
|
208
256
|
AroMediaIncMultiSig_ABI,
|
|
@@ -216,6 +264,7 @@ export {
|
|
|
216
264
|
ForcedTransferManager_ABI,
|
|
217
265
|
ForcedTransferStatus,
|
|
218
266
|
ForcedTransferStatusLabels,
|
|
267
|
+
MINT_APPROVAL_TYPES,
|
|
219
268
|
NominationStatus,
|
|
220
269
|
NominationStatusLabels,
|
|
221
270
|
SUPPORTED_CHAIN_IDS,
|
|
@@ -226,6 +275,7 @@ export {
|
|
|
226
275
|
aroChains,
|
|
227
276
|
base,
|
|
228
277
|
baseSepolia,
|
|
278
|
+
cAROUSD_ABI,
|
|
229
279
|
chainById,
|
|
230
280
|
chainLabels,
|
|
231
281
|
checkMembershipStatus,
|
|
@@ -247,9 +297,12 @@ export {
|
|
|
247
297
|
hardhat,
|
|
248
298
|
hashKycResult,
|
|
249
299
|
mainnet,
|
|
300
|
+
mintApprovalDomain,
|
|
301
|
+
mintApprovalTypedData,
|
|
250
302
|
mintSBTForApproved,
|
|
251
303
|
nominateCandidate,
|
|
252
304
|
sepolia,
|
|
305
|
+
signMintApproval,
|
|
253
306
|
tierAtLeast,
|
|
254
307
|
tierLabel,
|
|
255
308
|
tierRequirements,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/clients/createAroSdk.ts","../src/clients/accessManager.ts","../src/clients/assetsRegistry.ts","../src/clients/forcedTransfer.ts","../src/clients/multisig.ts","../src/clients/nomination.ts","../src/clients/rwa.ts","../src/clients/sbt.ts","../src/utils/tiers.ts"],"sourcesContent":["import {\n createPublicClient,\n http,\n type Chain,\n type PublicClient,\n type Transport,\n type WalletClient,\n} from \"viem\";\n\nimport { addresses, getAddress, type AroChainId } from \"../generated/addresses.js\";\nimport { createAccessManagerClient, type AroAccessManagerContract } from \"./accessManager.js\";\nimport { createAssetsRegistryClient, type AroAssetsRegistryContract } from \"./assetsRegistry.js\";\nimport { createForcedTransferClient, type ForcedTransferManagerContract } from \"./forcedTransfer.js\";\nimport { createMultiSigClient, type AroMultiSigContract } from \"./multisig.js\";\nimport { createNominationClient, type AroNominationContract } from \"./nomination.js\";\nimport { createRwaClient, type AroRWAContract } from \"./rwa.js\";\nimport { createSbtClient, type AroSBTContract } from \"./sbt.js\";\n\n/**\n * Per-contract address overrides. Useful for:\n * • local Hardhat where ignition deployments aren't picked up at build time\n * • staging deployments living outside of `ignition/deployments`\n * • forked-network testing where contracts are at non-canonical addresses\n */\nexport type AroAddressOverrides = Partial<Record<\n | \"AroSBT\"\n | \"AroNomination\"\n | \"AroMediaRWA\"\n | \"AroMediaAssetsRegistry\"\n | \"AroMediaAccessManager\"\n | \"AroMediaIncMultiSig\"\n | \"ForcedTransferManager\",\n `0x${string}`\n>>;\n\nexport interface CreateAroSdkOpts {\n /** Target chain. Must be a chainId the SDK knows about. */\n chain: Chain & { id: AroChainId };\n /** viem transport — defaults to `http()` against the chain's default RPC. */\n transport?: Transport;\n /** Optional wallet client for state-changing calls. */\n walletClient?: WalletClient;\n /** Override one or more contract addresses (local dev, staging, etc.). */\n overrides?: AroAddressOverrides;\n}\n\nexport interface AroSdk {\n chainId: AroChainId;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n /** Soulbound identity token. */\n sbt: AroSBTContract;\n /** Nomination + vouching workflow. */\n nomination: AroNominationContract;\n /** RWA security token (ARO). */\n rwa: AroRWAContract;\n /** ERC-721 assets registry. */\n assetsRegistry: AroAssetsRegistryContract;\n /** Centralized AccessManager (role grants/revokes). */\n accessManager: AroAccessManagerContract;\n /** ERC-7913 multi-sig smart-contract wallet. */\n multiSig: AroMultiSigContract;\n /** Regulator-driven forced transfer workflow. */\n forcedTransfer: ForcedTransferManagerContract;\n /** Resolve a contract address from the registry (with overrides applied). */\n addressOf: (name: keyof AroAddressOverrides) => `0x${string}`;\n}\n\n/**\n * The single entry point most consumers reach for. Returns a bundle of\n * typed contract handles bound to a viem PublicClient (and optionally a\n * WalletClient for writes).\n *\n * @example\n * const sdk = createAroSdk({\n * chain: sepolia as Chain & { id: 11155111 },\n * walletClient,\n * });\n * const isMember = await sdk.sbt.read.hasSBT([userAddress]);\n * if (!isMember) await sdk.nomination.write.nominate([userAddress]);\n */\nexport function createAroSdk(opts: CreateAroSdkOpts): AroSdk {\n const chainId = opts.chain.id;\n const overrides = opts.overrides ?? {};\n\n // Build a default PublicClient if the caller didn't pass a transport. We\n // intentionally do NOT bind a walletClient here — wallet state is the\n // dapp's concern, the SDK just consumes whatever it's given.\n // Cast through `unknown` because viem ≥2.50 narrows the PublicClient\n // produced here to `{ account: { address: undefined, type: \"json-rpc\" } }`,\n // while the per-contract client factories expect the looser `PublicClient`\n // shape with `account: undefined`. The runtime value is the same — viem\n // never reads `account` on a public client — so this cast is sound.\n const publicClient = createPublicClient({\n chain: opts.chain,\n transport: opts.transport ?? http(),\n }) as unknown as PublicClient;\n\n const resolve = (name: keyof AroAddressOverrides): `0x${string}` => {\n return overrides[name] ?? getAddress(chainId, name);\n };\n\n return {\n chainId,\n publicClient,\n walletClient: opts.walletClient,\n sbt: createSbtClient({\n address: resolve(\"AroSBT\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n nomination: createNominationClient({\n address: resolve(\"AroNomination\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n rwa: createRwaClient({\n address: resolve(\"AroMediaRWA\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n assetsRegistry: createAssetsRegistryClient({\n address: resolve(\"AroMediaAssetsRegistry\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n accessManager: createAccessManagerClient({\n address: resolve(\"AroMediaAccessManager\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n multiSig: createMultiSigClient({\n address: resolve(\"AroMediaIncMultiSig\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n forcedTransfer: createForcedTransferClient({\n address: resolve(\"ForcedTransferManager\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n addressOf: resolve,\n };\n}\n\n/** Helper: peek at the address registry without instantiating an SDK. */\nexport function addressesFor(chainId: AroChainId): Record<keyof AroAddressOverrides, `0x${string}`> {\n return addresses[chainId];\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroMediaAccessManager_ABI } from \"../generated/abis.js\";\n\nexport type AroAccessManagerContract = GetContractReturnType<\n typeof AroMediaAccessManager_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface AccessManagerClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createAccessManagerClient(\n opts: AccessManagerClientOpts,\n): AroAccessManagerContract {\n return getContract({\n address: opts.address,\n abi: AroMediaAccessManager_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroAccessManagerContract;\n}\n\n/**\n * Role IDs as defined in AroMediaAccessManager.sol. Mirroring them here\n * lets the dapp grant/revoke without re-reading the contract just to know\n * which uint64 corresponds to which role.\n */\nexport const AroRoles = {\n ORG_ADMIN: 0n,\n PROTOCOL_ADMIN: 1n,\n TREASURY_CONTROLLER: 2n,\n MARKET_MAKER: 3n,\n MINTER: 4n,\n} as const;\n\nexport type AroRoleName = keyof typeof AroRoles;\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroMediaAssetsRegistry_ABI } from \"../generated/abis.js\";\n\nexport type AroAssetsRegistryContract = GetContractReturnType<\n typeof AroMediaAssetsRegistry_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface AssetsRegistryClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createAssetsRegistryClient(\n opts: AssetsRegistryClientOpts,\n): AroAssetsRegistryContract {\n return getContract({\n address: opts.address,\n abi: AroMediaAssetsRegistry_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroAssetsRegistryContract;\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { ForcedTransferManager_ABI } from \"../generated/abis.js\";\n\nexport type ForcedTransferManagerContract = GetContractReturnType<\n typeof ForcedTransferManager_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface ForcedTransferClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createForcedTransferClient(\n opts: ForcedTransferClientOpts,\n): ForcedTransferManagerContract {\n return getContract({\n address: opts.address,\n abi: ForcedTransferManager_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as ForcedTransferManagerContract;\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroMediaIncMultiSig_ABI } from \"../generated/abis.js\";\n\nexport type AroMultiSigContract = GetContractReturnType<\n typeof AroMediaIncMultiSig_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface MultiSigClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createMultiSigClient(opts: MultiSigClientOpts): AroMultiSigContract {\n return getContract({\n address: opts.address,\n abi: AroMediaIncMultiSig_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroMultiSigContract;\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroNomination_ABI } from \"../generated/abis.js\";\n\nexport type AroNominationContract = GetContractReturnType<\n typeof AroNomination_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface NominationClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createNominationClient(opts: NominationClientOpts): AroNominationContract {\n return getContract({\n address: opts.address,\n abi: AroNomination_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroNominationContract;\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroMediaRWA_ABI } from \"../generated/abis.js\";\n\nexport type AroRWAContract = GetContractReturnType<\n typeof AroMediaRWA_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface RwaClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createRwaClient(opts: RwaClientOpts): AroRWAContract {\n return getContract({\n address: opts.address,\n abi: AroMediaRWA_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroRWAContract;\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroSBT_ABI } from \"../generated/abis.js\";\n\n/**\n * Typed viem contract handle for AroSBT.\n *\n * Use `read.hasSBT(address)`, `read.getMemberData(address)`, etc. for views;\n * `write.mint(...)`, `write.revoke(...)`, etc. for state-changing calls when\n * a wallet client is bound.\n */\nexport type AroSBTContract = GetContractReturnType<\n typeof AroSBT_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface SbtClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\n/**\n * Bind the AroSBT ABI to its deployed address and the caller's viem\n * clients. The returned object is a thin proxy — calling `client.read.x`\n * preserves full type inference from the ABI.\n */\nexport function createSbtClient(opts: SbtClientOpts): AroSBTContract {\n return getContract({\n address: opts.address,\n abi: AroSBT_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroSBTContract;\n}\n","import { AroTier, AroTierLabels } from \"../generated/types.js\";\n\nexport { AroTier, AroTierLabels };\n\n/**\n * Map the SBT Tier enum value to the KYC verification depth required by\n * the policy (§6.1):\n * STANDARD → basic KYC\n * VERIFIED → enhanced ID verification\n * TRUSTED → full EDD including source of wealth\n * FOUNDING → founding members, highest vetting\n */\nexport const tierRequirements: Record<AroTier, string> = {\n [AroTier.STANDARD]: \"Basic KYC completed.\",\n [AroTier.VERIFIED]: \"Enhanced identity verification with additional documentation.\",\n [AroTier.TRUSTED]: \"Full Enhanced Due Diligence (EDD), including source of wealth verification.\",\n [AroTier.FOUNDING]: \"Founding member; highest verification and vetting.\",\n};\n\nexport function tierLabel(tier: AroTier): string {\n return AroTierLabels[tier];\n}\n\n/** Whether a member at `held` tier meets the `required` minimum tier. */\nexport function tierAtLeast(held: AroTier, required: AroTier): boolean {\n return held >= required;\n}\n"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,MAChC;AAAA,MACA,cAAc,KAAK;AAAA,IACrB,CAAC;AAAA,IACD,KAAK,gBAAgB;AAAA,MACnB,SAAS,QAAQ,aAAa;AAAA,MAC9B;AAAA,MACA,cAAc,KAAK;AAAA,IACrB,CAAC;AAAA,IACD,gBAAgB,2BAA2B;AAAA,MACzC,SAAS,QAAQ,wBAAwB;AAAA,MACzC;AAAA,MACA,cAAc,KAAK;AAAA,IACrB,CAAC;AAAA,IACD,eAAe,0BAA0B;AAAA,MACvC,SAAS,QAAQ,uBAAuB;AAAA,MACxC;AAAA,MACA,cAAc,KAAK;AAAA,IACrB,CAAC;AAAA,IACD,UAAU,qBAAqB;AAAA,MAC7B,SAAS,QAAQ,qBAAqB;AAAA,MACtC;AAAA,MACA,cAAc,KAAK;AAAA,IACrB,CAAC;AAAA,IACD,gBAAgB,2BAA2B;AAAA,MACzC,SAAS,QAAQ,uBAAuB;AAAA,MACxC;AAAA,MACA,cAAc,KAAK;AAAA,IACrB,CAAC;AAAA,IACD,WAAW;AAAA,EACb;AACF;AAGO,SAAS,aAAa,SAAuE;AAClG,SAAO,UAAU,OAAO;AAC1B;;;AQxIO,IAAM,mBAA4C;AAAA,EACvD,iBAAiB,GAAG;AAAA,EACpB,iBAAiB,GAAG;AAAA,EACpB,gBAAgB,GAAG;AAAA,EACnB,iBAAiB,GAAG;AACtB;AAEO,SAAS,UAAU,MAAuB;AAC/C,SAAO,cAAc,IAAI;AAC3B;AAGO,SAAS,YAAY,MAAe,UAA4B;AACrE,SAAO,QAAQ;AACjB;","names":["getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract"]}
|
|
1
|
+
{"version":3,"sources":["../src/clients/createAroSdk.ts","../src/clients/accessManager.ts","../src/clients/assetsRegistry.ts","../src/clients/forcedTransfer.ts","../src/clients/multisig.ts","../src/clients/nomination.ts","../src/clients/rwa.ts","../src/clients/sbt.ts","../src/utils/tiers.ts","../src/utils/mintApproval.ts"],"sourcesContent":["import {\n createPublicClient,\n http,\n type Chain,\n type PublicClient,\n type Transport,\n type WalletClient,\n} from \"viem\";\n\nimport { addresses, getAddress, type AroChainId } from \"../generated/addresses.js\";\nimport { createAccessManagerClient, type AroAccessManagerContract } from \"./accessManager.js\";\nimport { createAssetsRegistryClient, type AroAssetsRegistryContract } from \"./assetsRegistry.js\";\nimport { createForcedTransferClient, type ForcedTransferManagerContract } from \"./forcedTransfer.js\";\nimport { createMultiSigClient, type AroMultiSigContract } from \"./multisig.js\";\nimport { createNominationClient, type AroNominationContract } from \"./nomination.js\";\nimport { createRwaClient, type AroRWAContract } from \"./rwa.js\";\nimport { createSbtClient, type AroSBTContract } from \"./sbt.js\";\n\n/**\n * Per-contract address overrides. Useful for:\n * • local Hardhat where ignition deployments aren't picked up at build time\n * • staging deployments living outside of `ignition/deployments`\n * • forked-network testing where contracts are at non-canonical addresses\n */\nexport type AroAddressOverrides = Partial<Record<\n | \"AroSBT\"\n | \"AroNomination\"\n | \"AroMediaRWA\"\n | \"AroMediaAssetsRegistry\"\n | \"AroMediaAccessManager\"\n | \"AroMediaIncMultiSig\"\n | \"ForcedTransferManager\",\n `0x${string}`\n>>;\n\nexport interface CreateAroSdkOpts {\n /** Target chain. Must be a chainId the SDK knows about. */\n chain: Chain & { id: AroChainId };\n /** viem transport — defaults to `http()` against the chain's default RPC. */\n transport?: Transport;\n /** Optional wallet client for state-changing calls. */\n walletClient?: WalletClient;\n /** Override one or more contract addresses (local dev, staging, etc.). */\n overrides?: AroAddressOverrides;\n}\n\nexport interface AroSdk {\n chainId: AroChainId;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n /** Soulbound identity token. */\n sbt: AroSBTContract;\n /** Nomination + vouching workflow. */\n nomination: AroNominationContract;\n /** RWA security token (ARO). */\n rwa: AroRWAContract;\n /** ERC-721 assets registry. */\n assetsRegistry: AroAssetsRegistryContract;\n /** Centralized AccessManager (role grants/revokes). */\n accessManager: AroAccessManagerContract;\n /** ERC-7913 multi-sig smart-contract wallet. */\n multiSig: AroMultiSigContract;\n /** Regulator-driven forced transfer workflow. */\n forcedTransfer: ForcedTransferManagerContract;\n /** Resolve a contract address from the registry (with overrides applied). */\n addressOf: (name: keyof AroAddressOverrides) => `0x${string}`;\n}\n\n/**\n * The single entry point most consumers reach for. Returns a bundle of\n * typed contract handles bound to a viem PublicClient (and optionally a\n * WalletClient for writes).\n *\n * @example\n * const sdk = createAroSdk({\n * chain: sepolia as Chain & { id: 11155111 },\n * walletClient,\n * });\n * const isMember = await sdk.sbt.read.hasSBT([userAddress]);\n * if (!isMember) await sdk.nomination.write.nominate([userAddress]);\n */\nexport function createAroSdk(opts: CreateAroSdkOpts): AroSdk {\n const chainId = opts.chain.id;\n const overrides = opts.overrides ?? {};\n\n // Build a default PublicClient if the caller didn't pass a transport. We\n // intentionally do NOT bind a walletClient here — wallet state is the\n // dapp's concern, the SDK just consumes whatever it's given.\n // Cast through `unknown` because viem ≥2.50 narrows the PublicClient\n // produced here to `{ account: { address: undefined, type: \"json-rpc\" } }`,\n // while the per-contract client factories expect the looser `PublicClient`\n // shape with `account: undefined`. The runtime value is the same — viem\n // never reads `account` on a public client — so this cast is sound.\n const publicClient = createPublicClient({\n chain: opts.chain,\n transport: opts.transport ?? http(),\n }) as unknown as PublicClient;\n\n const resolve = (name: keyof AroAddressOverrides): `0x${string}` => {\n return overrides[name] ?? getAddress(chainId, name);\n };\n\n return {\n chainId,\n publicClient,\n walletClient: opts.walletClient,\n sbt: createSbtClient({\n address: resolve(\"AroSBT\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n nomination: createNominationClient({\n address: resolve(\"AroNomination\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n rwa: createRwaClient({\n address: resolve(\"AroMediaRWA\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n assetsRegistry: createAssetsRegistryClient({\n address: resolve(\"AroMediaAssetsRegistry\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n accessManager: createAccessManagerClient({\n address: resolve(\"AroMediaAccessManager\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n multiSig: createMultiSigClient({\n address: resolve(\"AroMediaIncMultiSig\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n forcedTransfer: createForcedTransferClient({\n address: resolve(\"ForcedTransferManager\"),\n publicClient,\n walletClient: opts.walletClient,\n }),\n addressOf: resolve,\n };\n}\n\n/** Helper: peek at the address registry without instantiating an SDK. */\nexport function addressesFor(chainId: AroChainId): Record<keyof AroAddressOverrides, `0x${string}`> {\n return addresses[chainId];\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroMediaAccessManager_ABI } from \"../generated/abis.js\";\n\nexport type AroAccessManagerContract = GetContractReturnType<\n typeof AroMediaAccessManager_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface AccessManagerClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createAccessManagerClient(\n opts: AccessManagerClientOpts,\n): AroAccessManagerContract {\n return getContract({\n address: opts.address,\n abi: AroMediaAccessManager_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroAccessManagerContract;\n}\n\n/**\n * Role IDs as defined in AroMediaAccessManager.sol. Mirroring them here\n * lets the dapp grant/revoke without re-reading the contract just to know\n * which uint64 corresponds to which role.\n */\nexport const AroRoles = {\n ORG_ADMIN: 0n,\n PROTOCOL_ADMIN: 1n,\n TREASURY_CONTROLLER: 2n,\n MARKET_MAKER: 3n,\n MINTER: 4n,\n} as const;\n\nexport type AroRoleName = keyof typeof AroRoles;\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroMediaAssetsRegistry_ABI } from \"../generated/abis.js\";\n\nexport type AroAssetsRegistryContract = GetContractReturnType<\n typeof AroMediaAssetsRegistry_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface AssetsRegistryClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createAssetsRegistryClient(\n opts: AssetsRegistryClientOpts,\n): AroAssetsRegistryContract {\n return getContract({\n address: opts.address,\n abi: AroMediaAssetsRegistry_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroAssetsRegistryContract;\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { ForcedTransferManager_ABI } from \"../generated/abis.js\";\n\nexport type ForcedTransferManagerContract = GetContractReturnType<\n typeof ForcedTransferManager_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface ForcedTransferClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createForcedTransferClient(\n opts: ForcedTransferClientOpts,\n): ForcedTransferManagerContract {\n return getContract({\n address: opts.address,\n abi: ForcedTransferManager_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as ForcedTransferManagerContract;\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroMediaIncMultiSig_ABI } from \"../generated/abis.js\";\n\nexport type AroMultiSigContract = GetContractReturnType<\n typeof AroMediaIncMultiSig_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface MultiSigClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createMultiSigClient(opts: MultiSigClientOpts): AroMultiSigContract {\n return getContract({\n address: opts.address,\n abi: AroMediaIncMultiSig_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroMultiSigContract;\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroNomination_ABI } from \"../generated/abis.js\";\n\nexport type AroNominationContract = GetContractReturnType<\n typeof AroNomination_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface NominationClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createNominationClient(opts: NominationClientOpts): AroNominationContract {\n return getContract({\n address: opts.address,\n abi: AroNomination_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroNominationContract;\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroMediaRWA_ABI } from \"../generated/abis.js\";\n\nexport type AroRWAContract = GetContractReturnType<\n typeof AroMediaRWA_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface RwaClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\nexport function createRwaClient(opts: RwaClientOpts): AroRWAContract {\n return getContract({\n address: opts.address,\n abi: AroMediaRWA_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroRWAContract;\n}\n","import { getContract, type GetContractReturnType, type PublicClient, type WalletClient } from \"viem\";\n\nimport { AroSBT_ABI } from \"../generated/abis.js\";\n\n/**\n * Typed viem contract handle for AroSBT.\n *\n * Use `read.hasSBT(address)`, `read.getMemberData(address)`, etc. for views;\n * `write.mint(...)`, `write.revoke(...)`, etc. for state-changing calls when\n * a wallet client is bound.\n */\nexport type AroSBTContract = GetContractReturnType<\n typeof AroSBT_ABI,\n { public: PublicClient; wallet?: WalletClient }\n>;\n\nexport interface SbtClientOpts {\n address: `0x${string}`;\n publicClient: PublicClient;\n walletClient?: WalletClient;\n}\n\n/**\n * Bind the AroSBT ABI to its deployed address and the caller's viem\n * clients. The returned object is a thin proxy — calling `client.read.x`\n * preserves full type inference from the ABI.\n */\nexport function createSbtClient(opts: SbtClientOpts): AroSBTContract {\n return getContract({\n address: opts.address,\n abi: AroSBT_ABI,\n client: opts.walletClient\n ? { public: opts.publicClient, wallet: opts.walletClient }\n : { public: opts.publicClient },\n }) as AroSBTContract;\n}\n","import { AroTier, AroTierLabels } from \"../generated/types.js\";\n\nexport { AroTier, AroTierLabels };\n\n/**\n * Conventional KYC verification depth per default tier id.\n *\n * On-chain, the SBT's tier is an opaque `uint256`; no contract logic\n * branches on it. These conventional labels and policy descriptions are\n * the defaults the dapp displays when the admin backend hasn't supplied\n * an override. New tier ids can be defined server-side without a\n * contract upgrade or SDK release.\n */\nexport const tierRequirements: Record<AroTier, string> = {\n [AroTier.STANDARD]: \"Basic KYC completed.\",\n [AroTier.VERIFIED]: \"Enhanced identity verification with additional documentation.\",\n [AroTier.TRUSTED]: \"Full Enhanced Due Diligence (EDD), including source of wealth verification.\",\n [AroTier.FOUNDING]: \"Founding member; highest verification and vetting.\",\n};\n\n/**\n * Resolve a tier id to a human-readable label. Falls back to a generic\n * `Tier <n>` for unknown ids (the admin backend can introduce new tiers\n * without an SDK release).\n */\nexport function tierLabel(tier: bigint | number): string {\n const asNumber = typeof tier === \"bigint\" ? Number(tier) : tier;\n if (Number.isInteger(asNumber) && asNumber in AroTierLabels) {\n return AroTierLabels[asNumber as AroTier];\n }\n return `Tier ${asNumber}`;\n}\n\n/**\n * Whether a member at `held` tier meets the `required` minimum tier, by\n * numeric ordering. Convention: higher ids are stricter. Non-linear\n * tier orderings should be implemented off-chain in the admin backend.\n */\nexport function tierAtLeast(held: bigint | number, required: bigint | number): boolean {\n const heldNum = typeof held === \"bigint\" ? held : BigInt(held);\n const requiredNum = typeof required === \"bigint\" ? required : BigInt(required);\n return heldNum >= requiredNum;\n}\n","// =============================================================================\n// AroSBT.mintWithApproval VOUCHER HELPER\n// =============================================================================\n// EIP-712 typed-data builder + signer for the candidate-triggered SBT mint\n// flow. The admin backend signs a MintApproval voucher with the approver key\n// (which holds ROLE_MINTER == APPROVER_ROLE on AroSBT); the candidate\n// submits the voucher and signature to AroSBT.mintWithApproval, which\n// recovers the signer, checks the AccessManager role, marks the voucher\n// nullified, and mints to msg.sender.\n\nimport type { Account, Hex, LocalAccount, TypedDataDomain } from \"viem\";\n\n// -----------------------------------------------------------------------------\n// Domain and types\n// -----------------------------------------------------------------------------\n\n/**\n * EIP-712 domain for AroSBT.mintWithApproval. Mirrors the contract's\n * `EIP712(\"AroSBT\", \"1\")` constructor.\n */\nexport function mintApprovalDomain(\n chainId: number | bigint,\n sbtAddress: `0x${string}`,\n): TypedDataDomain {\n return {\n name: \"AroSBT\",\n version: \"1\",\n chainId: typeof chainId === \"bigint\" ? Number(chainId) : chainId,\n verifyingContract: sbtAddress,\n };\n}\n\n/**\n * Typed-data types for the MintApproval voucher. The field order is\n * load-bearing (it must match the order in the contract's\n * MINT_APPROVAL_TYPEHASH string).\n */\nexport const MINT_APPROVAL_TYPES = {\n MintApproval: [\n { name: \"candidate\", type: \"address\" },\n { name: \"tier\", type: \"uint256\" },\n { name: \"kycHash\", type: \"bytes32\" },\n { name: \"nominationId\", type: \"bytes32\" },\n { name: \"metadataURI\", type: \"string\" },\n { name: \"deadline\", type: \"uint64\" },\n { name: \"nonce\", type: \"bytes32\" },\n ],\n} as const;\n\n// -----------------------------------------------------------------------------\n// Payload types\n// -----------------------------------------------------------------------------\n\n/** Fields the approver signs. Matches the on-chain MintApproval struct. */\nexport interface MintApprovalPayload {\n candidate: `0x${string}`;\n /** Opaque tier id (semantics live off-chain in the admin backend). */\n tier: bigint;\n kycHash: `0x${string}`;\n /** Admin-backend nomination record id, encoded as bytes32. */\n nominationId: `0x${string}`;\n /** IPFS / HTTP URI for the candidate's profile metadata. */\n metadataURI: string;\n /** Unix seconds; voucher is rejected after this. */\n deadline: bigint;\n /** 32-byte unique value; the digest is the on-chain nullifier key. */\n nonce: `0x${string}`;\n}\n\n/** A signed voucher, ready for the candidate to submit. */\nexport interface SignedMintApproval {\n payload: MintApprovalPayload;\n signature: Hex;\n domain: TypedDataDomain;\n}\n\n// -----------------------------------------------------------------------------\n// Sign + verify\n// -----------------------------------------------------------------------------\n\n/**\n * Sign a MintApproval voucher with the approver's key.\n *\n * The account must hold ROLE_MINTER on the AccessManager (mintWithApproval\n * checks this on-chain). Typical use: the admin backend builds the payload\n * once the candidate's review is complete, signs it with a server-held\n * signer (viem `privateKeyToAccount` / `mnemonicToAccount`), and stores\n * (or directly returns) the signed voucher for the candidate's mint call.\n *\n * @param account Any viem account with `signTypedData` support\n * (LocalAccount, JsonRpcAccount, etc.).\n * @param sbtAddress Deployed AroSBT contract address.\n * @param chainId EVM chain id the voucher is bound to.\n * @param payload The MintApproval fields.\n */\nexport async function signMintApproval(\n account: Account & { signTypedData: LocalAccount[\"signTypedData\"] },\n sbtAddress: `0x${string}`,\n chainId: number | bigint,\n payload: MintApprovalPayload,\n): Promise<SignedMintApproval> {\n const domain = mintApprovalDomain(chainId, sbtAddress);\n const signature = await account.signTypedData({\n domain,\n types: MINT_APPROVAL_TYPES,\n primaryType: \"MintApproval\",\n message: payload,\n });\n return { payload, signature, domain };\n}\n\n/**\n * Reconstruct the typed-data argument the candidate (or any signer)\n * passes to `signTypedData` / `verifyTypedData`. Useful when the signing\n * step happens in code outside the SDK (e.g. browser wallet flow).\n */\nexport function mintApprovalTypedData(\n sbtAddress: `0x${string}`,\n chainId: number | bigint,\n payload: MintApprovalPayload,\n) {\n return {\n domain: mintApprovalDomain(chainId, sbtAddress),\n types: MINT_APPROVAL_TYPES,\n primaryType: \"MintApproval\" as const,\n message: payload,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAKK;;;ACPP,SAAS,mBAAqF;AAevF,SAAS,0BACd,MAC0B;AAC1B,SAAO,YAAY;AAAA,IACjB,SAAS,KAAK;AAAA,IACd,KAAK;AAAA,IACL,QAAQ,KAAK,eACT,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAa,IACvD,EAAE,QAA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AU;AAAA,IACnC,EAAE,MAAM,gBAAgB,MAAM,UAAU;AAAA,IACxC,EAAE,MAAM,eAAe,MAAM,SAAS;AAAA,IACtC,EAAE,MAAM,YAAY,MAAM,SAAS;AAAA,IACnC,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,EACnC;AACF;AAgDA,eAAsB,iBACpB,SACA,YACA,SACA,SAC6B;AAC7B,QAAM,SAAS,mBAAmB,SAAS,UAAU;AACrD,QAAM,YAAY,MAAM,QAAQ,cAAc;AAAA,IAC5C;AAAA,IACA,OAAO;AAAA,IACP,aAAa;AAAA,IACb,SAAS;AAAA,EACX,CAAC;AACD,SAAO,EAAE,SAAS,WAAW,OAAO;AACtC;AAOO,SAAS,sBACd,YACA,SACA,SACA;AACA,SAAO;AAAA,IACL,QAAQ,mBAAmB,SAAS,UAAU;AAAA,IAC9C,OAAO;AAAA,IACP,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AACF;","names":["getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract"]}
|