@aromedia/contracts-sdk 0.2.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/LICENSE +21 -0
- package/README.md +121 -0
- package/dist/chains.cjs +67 -0
- package/dist/chains.cjs.map +1 -0
- package/dist/chains.d.cts +826 -0
- package/dist/chains.d.ts +826 -0
- package/dist/chains.js +23 -0
- package/dist/chains.js.map +1 -0
- package/dist/chunk-7I5N3BGV.js +271 -0
- package/dist/chunk-7I5N3BGV.js.map +1 -0
- package/dist/chunk-BYPGUFYV.js +50 -0
- package/dist/chunk-BYPGUFYV.js.map +1 -0
- package/dist/chunk-FWZ7XKFC.js +91 -0
- package/dist/chunk-FWZ7XKFC.js.map +1 -0
- package/dist/chunk-J6YVU3VA.js +35 -0
- package/dist/chunk-J6YVU3VA.js.map +1 -0
- package/dist/chunk-TZQHQLNY.js +7213 -0
- package/dist/chunk-TZQHQLNY.js.map +1 -0
- package/dist/generated/abis.cjs +7244 -0
- package/dist/generated/abis.cjs.map +1 -0
- package/dist/generated/abis.d.cts +11005 -0
- package/dist/generated/abis.d.ts +11005 -0
- package/dist/generated/abis.js +21 -0
- package/dist/generated/abis.js.map +1 -0
- package/dist/generated/addresses.cjs +119 -0
- package/dist/generated/addresses.cjs.map +1 -0
- package/dist/generated/addresses.d.cts +18 -0
- package/dist/generated/addresses.d.ts +18 -0
- package/dist/generated/addresses.js +15 -0
- package/dist/generated/addresses.js.map +1 -0
- package/dist/hooks/index.cjs +2005 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +63 -0
- package/dist/hooks/index.d.ts +63 -0
- package/dist/hooks/index.js +218 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +7884 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +42 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +258 -0
- package/dist/index.js.map +1 -0
- package/dist/onboarding-BHpAJaNW.d.cts +302 -0
- package/dist/onboarding-DxL_LpM3.d.ts +302 -0
- package/dist/workflows/index.cjs +1988 -0
- package/dist/workflows/index.cjs.map +1 -0
- package/dist/workflows/index.d.cts +72 -0
- package/dist/workflows/index.d.ts +72 -0
- package/dist/workflows/index.js +25 -0
- package/dist/workflows/index.js.map +1 -0
- package/package.json +120 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export { AroContractName, AroMediaAccessManager_ABI, AroMediaAssetsRegistry_ABI, AroMediaIncMultiSig_ABI, AroMediaRWA_ABI, AroNomination_ABI, AroSBT_ABI, ForcedTransferManager_ABI, abis } from './generated/abis.cjs';
|
|
2
|
+
export { AroChainId, SUPPORTED_CHAIN_IDS, ZERO_ADDRESS, addresses, chainLabels, getAddress } from './generated/addresses.cjs';
|
|
3
|
+
import { k as AroTier } from './onboarding-BHpAJaNW.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-BHpAJaNW.cjs';
|
|
5
|
+
export { AroChainLabel, DEFAULT_CHAIN, aroChains, chainById, getChain } from './chains.cjs';
|
|
6
|
+
export { KycPayload, NormalizedKycResult, computeKycHash, hashKycResult } from './workflows/index.cjs';
|
|
7
|
+
export { base, baseSepolia, hardhat, mainnet, sepolia } from 'viem/chains';
|
|
8
|
+
import 'viem';
|
|
9
|
+
import 'abitype';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Map the SBT Tier enum value to the KYC verification depth required by
|
|
13
|
+
* the policy (§6.1):
|
|
14
|
+
* STANDARD → basic KYC
|
|
15
|
+
* VERIFIED → enhanced ID verification
|
|
16
|
+
* TRUSTED → full EDD including source of wealth
|
|
17
|
+
* FOUNDING → founding members, highest vetting
|
|
18
|
+
*/
|
|
19
|
+
declare const tierRequirements: Record<AroTier, string>;
|
|
20
|
+
declare function tierLabel(tier: AroTier): string;
|
|
21
|
+
/** Whether a member at `held` tier meets the `required` minimum tier. */
|
|
22
|
+
declare function tierAtLeast(held: AroTier, required: AroTier): boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Friendly error class wrapping a decoded custom error from one of the Aro
|
|
26
|
+
* contracts. We keep both the raw cause (for retry/logging) and a friendly
|
|
27
|
+
* message that maps cleanly to user-facing copy in the dapp.
|
|
28
|
+
*/
|
|
29
|
+
declare class AroContractError extends Error {
|
|
30
|
+
readonly errorName: string;
|
|
31
|
+
readonly args: readonly unknown[];
|
|
32
|
+
readonly cause?: unknown;
|
|
33
|
+
constructor(opts: {
|
|
34
|
+
errorName: string;
|
|
35
|
+
args: readonly unknown[];
|
|
36
|
+
message: string;
|
|
37
|
+
cause?: unknown;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
declare function decodeAroError(err: unknown): AroContractError | null;
|
|
41
|
+
|
|
42
|
+
export { AroContractError, AroTier, decodeAroError, tierAtLeast, tierLabel, tierRequirements };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export { AroContractName, AroMediaAccessManager_ABI, AroMediaAssetsRegistry_ABI, AroMediaIncMultiSig_ABI, AroMediaRWA_ABI, AroNomination_ABI, AroSBT_ABI, ForcedTransferManager_ABI, abis } from './generated/abis.js';
|
|
2
|
+
export { AroChainId, SUPPORTED_CHAIN_IDS, ZERO_ADDRESS, addresses, chainLabels, getAddress } from './generated/addresses.js';
|
|
3
|
+
import { k as AroTier } from './onboarding-DxL_LpM3.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-DxL_LpM3.js';
|
|
5
|
+
export { AroChainLabel, DEFAULT_CHAIN, aroChains, chainById, getChain } from './chains.js';
|
|
6
|
+
export { KycPayload, NormalizedKycResult, computeKycHash, hashKycResult } from './workflows/index.js';
|
|
7
|
+
export { base, baseSepolia, hardhat, mainnet, sepolia } from 'viem/chains';
|
|
8
|
+
import 'viem';
|
|
9
|
+
import 'abitype';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Map the SBT Tier enum value to the KYC verification depth required by
|
|
13
|
+
* the policy (§6.1):
|
|
14
|
+
* STANDARD → basic KYC
|
|
15
|
+
* VERIFIED → enhanced ID verification
|
|
16
|
+
* TRUSTED → full EDD including source of wealth
|
|
17
|
+
* FOUNDING → founding members, highest vetting
|
|
18
|
+
*/
|
|
19
|
+
declare const tierRequirements: Record<AroTier, string>;
|
|
20
|
+
declare function tierLabel(tier: AroTier): string;
|
|
21
|
+
/** Whether a member at `held` tier meets the `required` minimum tier. */
|
|
22
|
+
declare function tierAtLeast(held: AroTier, required: AroTier): boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Friendly error class wrapping a decoded custom error from one of the Aro
|
|
26
|
+
* contracts. We keep both the raw cause (for retry/logging) and a friendly
|
|
27
|
+
* message that maps cleanly to user-facing copy in the dapp.
|
|
28
|
+
*/
|
|
29
|
+
declare class AroContractError extends Error {
|
|
30
|
+
readonly errorName: string;
|
|
31
|
+
readonly args: readonly unknown[];
|
|
32
|
+
readonly cause?: unknown;
|
|
33
|
+
constructor(opts: {
|
|
34
|
+
errorName: string;
|
|
35
|
+
args: readonly unknown[];
|
|
36
|
+
message: string;
|
|
37
|
+
cause?: unknown;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
declare function decodeAroError(err: unknown): AroContractError | null;
|
|
41
|
+
|
|
42
|
+
export { AroContractError, AroTier, decodeAroError, tierAtLeast, tierLabel, tierRequirements };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_CHAIN,
|
|
3
|
+
aroChains,
|
|
4
|
+
base,
|
|
5
|
+
baseSepolia,
|
|
6
|
+
chainById,
|
|
7
|
+
getChain,
|
|
8
|
+
hardhat,
|
|
9
|
+
mainnet,
|
|
10
|
+
sepolia
|
|
11
|
+
} from "./chunk-J6YVU3VA.js";
|
|
12
|
+
import {
|
|
13
|
+
SUPPORTED_CHAIN_IDS,
|
|
14
|
+
ZERO_ADDRESS,
|
|
15
|
+
addresses,
|
|
16
|
+
chainLabels,
|
|
17
|
+
getAddress
|
|
18
|
+
} from "./chunk-FWZ7XKFC.js";
|
|
19
|
+
import {
|
|
20
|
+
AroContractError,
|
|
21
|
+
checkMembershipStatus,
|
|
22
|
+
clearNomination,
|
|
23
|
+
computeKycHash,
|
|
24
|
+
decodeAroError,
|
|
25
|
+
describeOnboardingState,
|
|
26
|
+
getNominationSnapshot,
|
|
27
|
+
hashKycResult,
|
|
28
|
+
mintSBTForApproved,
|
|
29
|
+
nominateCandidate,
|
|
30
|
+
vouchForCandidate
|
|
31
|
+
} from "./chunk-7I5N3BGV.js";
|
|
32
|
+
import {
|
|
33
|
+
AroTier,
|
|
34
|
+
AroTierLabels,
|
|
35
|
+
ForcedTransferStatus,
|
|
36
|
+
ForcedTransferStatusLabels,
|
|
37
|
+
NominationStatus,
|
|
38
|
+
NominationStatusLabels
|
|
39
|
+
} from "./chunk-BYPGUFYV.js";
|
|
40
|
+
import {
|
|
41
|
+
AroMediaAccessManager_ABI,
|
|
42
|
+
AroMediaAssetsRegistry_ABI,
|
|
43
|
+
AroMediaIncMultiSig_ABI,
|
|
44
|
+
AroMediaRWA_ABI,
|
|
45
|
+
AroNomination_ABI,
|
|
46
|
+
AroSBT_ABI,
|
|
47
|
+
ForcedTransferManager_ABI,
|
|
48
|
+
abis
|
|
49
|
+
} from "./chunk-TZQHQLNY.js";
|
|
50
|
+
|
|
51
|
+
// src/clients/createAroSdk.ts
|
|
52
|
+
import {
|
|
53
|
+
createPublicClient,
|
|
54
|
+
http
|
|
55
|
+
} from "viem";
|
|
56
|
+
|
|
57
|
+
// src/clients/accessManager.ts
|
|
58
|
+
import { getContract } from "viem";
|
|
59
|
+
function createAccessManagerClient(opts) {
|
|
60
|
+
return getContract({
|
|
61
|
+
address: opts.address,
|
|
62
|
+
abi: AroMediaAccessManager_ABI,
|
|
63
|
+
client: opts.walletClient ? { public: opts.publicClient, wallet: opts.walletClient } : { public: opts.publicClient }
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
var AroRoles = {
|
|
67
|
+
ORG_ADMIN: 0n,
|
|
68
|
+
PROTOCOL_ADMIN: 1n,
|
|
69
|
+
TREASURY_CONTROLLER: 2n,
|
|
70
|
+
MARKET_MAKER: 3n,
|
|
71
|
+
MINTER: 4n
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// src/clients/assetsRegistry.ts
|
|
75
|
+
import { getContract as getContract2 } from "viem";
|
|
76
|
+
function createAssetsRegistryClient(opts) {
|
|
77
|
+
return getContract2({
|
|
78
|
+
address: opts.address,
|
|
79
|
+
abi: AroMediaAssetsRegistry_ABI,
|
|
80
|
+
client: opts.walletClient ? { public: opts.publicClient, wallet: opts.walletClient } : { public: opts.publicClient }
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// src/clients/forcedTransfer.ts
|
|
85
|
+
import { getContract as getContract3 } from "viem";
|
|
86
|
+
function createForcedTransferClient(opts) {
|
|
87
|
+
return getContract3({
|
|
88
|
+
address: opts.address,
|
|
89
|
+
abi: ForcedTransferManager_ABI,
|
|
90
|
+
client: opts.walletClient ? { public: opts.publicClient, wallet: opts.walletClient } : { public: opts.publicClient }
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/clients/multisig.ts
|
|
95
|
+
import { getContract as getContract4 } from "viem";
|
|
96
|
+
function createMultiSigClient(opts) {
|
|
97
|
+
return getContract4({
|
|
98
|
+
address: opts.address,
|
|
99
|
+
abi: AroMediaIncMultiSig_ABI,
|
|
100
|
+
client: opts.walletClient ? { public: opts.publicClient, wallet: opts.walletClient } : { public: opts.publicClient }
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// src/clients/nomination.ts
|
|
105
|
+
import { getContract as getContract5 } from "viem";
|
|
106
|
+
function createNominationClient(opts) {
|
|
107
|
+
return getContract5({
|
|
108
|
+
address: opts.address,
|
|
109
|
+
abi: AroNomination_ABI,
|
|
110
|
+
client: opts.walletClient ? { public: opts.publicClient, wallet: opts.walletClient } : { public: opts.publicClient }
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// src/clients/rwa.ts
|
|
115
|
+
import { getContract as getContract6 } from "viem";
|
|
116
|
+
function createRwaClient(opts) {
|
|
117
|
+
return getContract6({
|
|
118
|
+
address: opts.address,
|
|
119
|
+
abi: AroMediaRWA_ABI,
|
|
120
|
+
client: opts.walletClient ? { public: opts.publicClient, wallet: opts.walletClient } : { public: opts.publicClient }
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// src/clients/sbt.ts
|
|
125
|
+
import { getContract as getContract7 } from "viem";
|
|
126
|
+
function createSbtClient(opts) {
|
|
127
|
+
return getContract7({
|
|
128
|
+
address: opts.address,
|
|
129
|
+
abi: AroSBT_ABI,
|
|
130
|
+
client: opts.walletClient ? { public: opts.publicClient, wallet: opts.walletClient } : { public: opts.publicClient }
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/clients/createAroSdk.ts
|
|
135
|
+
function createAroSdk(opts) {
|
|
136
|
+
const chainId = opts.chain.id;
|
|
137
|
+
const overrides = opts.overrides ?? {};
|
|
138
|
+
const publicClient = createPublicClient({
|
|
139
|
+
chain: opts.chain,
|
|
140
|
+
transport: opts.transport ?? http()
|
|
141
|
+
});
|
|
142
|
+
const resolve = (name) => {
|
|
143
|
+
return overrides[name] ?? getAddress(chainId, name);
|
|
144
|
+
};
|
|
145
|
+
return {
|
|
146
|
+
chainId,
|
|
147
|
+
publicClient,
|
|
148
|
+
walletClient: opts.walletClient,
|
|
149
|
+
sbt: createSbtClient({
|
|
150
|
+
address: resolve("AroSBT"),
|
|
151
|
+
publicClient,
|
|
152
|
+
walletClient: opts.walletClient
|
|
153
|
+
}),
|
|
154
|
+
nomination: createNominationClient({
|
|
155
|
+
address: resolve("AroNomination"),
|
|
156
|
+
publicClient,
|
|
157
|
+
walletClient: opts.walletClient
|
|
158
|
+
}),
|
|
159
|
+
rwa: createRwaClient({
|
|
160
|
+
address: resolve("AroMediaRWA"),
|
|
161
|
+
publicClient,
|
|
162
|
+
walletClient: opts.walletClient
|
|
163
|
+
}),
|
|
164
|
+
assetsRegistry: createAssetsRegistryClient({
|
|
165
|
+
address: resolve("AroMediaAssetsRegistry"),
|
|
166
|
+
publicClient,
|
|
167
|
+
walletClient: opts.walletClient
|
|
168
|
+
}),
|
|
169
|
+
accessManager: createAccessManagerClient({
|
|
170
|
+
address: resolve("AroMediaAccessManager"),
|
|
171
|
+
publicClient,
|
|
172
|
+
walletClient: opts.walletClient
|
|
173
|
+
}),
|
|
174
|
+
multiSig: createMultiSigClient({
|
|
175
|
+
address: resolve("AroMediaIncMultiSig"),
|
|
176
|
+
publicClient,
|
|
177
|
+
walletClient: opts.walletClient
|
|
178
|
+
}),
|
|
179
|
+
forcedTransfer: createForcedTransferClient({
|
|
180
|
+
address: resolve("ForcedTransferManager"),
|
|
181
|
+
publicClient,
|
|
182
|
+
walletClient: opts.walletClient
|
|
183
|
+
}),
|
|
184
|
+
addressOf: resolve
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function addressesFor(chainId) {
|
|
188
|
+
return addresses[chainId];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// src/utils/tiers.ts
|
|
192
|
+
var tierRequirements = {
|
|
193
|
+
[0 /* STANDARD */]: "Basic KYC completed.",
|
|
194
|
+
[1 /* VERIFIED */]: "Enhanced identity verification with additional documentation.",
|
|
195
|
+
[2 /* TRUSTED */]: "Full Enhanced Due Diligence (EDD), including source of wealth verification.",
|
|
196
|
+
[3 /* FOUNDING */]: "Founding member; highest verification and vetting."
|
|
197
|
+
};
|
|
198
|
+
function tierLabel(tier) {
|
|
199
|
+
return AroTierLabels[tier];
|
|
200
|
+
}
|
|
201
|
+
function tierAtLeast(held, required) {
|
|
202
|
+
return held >= required;
|
|
203
|
+
}
|
|
204
|
+
export {
|
|
205
|
+
AroContractError,
|
|
206
|
+
AroMediaAccessManager_ABI,
|
|
207
|
+
AroMediaAssetsRegistry_ABI,
|
|
208
|
+
AroMediaIncMultiSig_ABI,
|
|
209
|
+
AroMediaRWA_ABI,
|
|
210
|
+
AroNomination_ABI,
|
|
211
|
+
AroRoles,
|
|
212
|
+
AroSBT_ABI,
|
|
213
|
+
AroTier,
|
|
214
|
+
AroTierLabels,
|
|
215
|
+
DEFAULT_CHAIN,
|
|
216
|
+
ForcedTransferManager_ABI,
|
|
217
|
+
ForcedTransferStatus,
|
|
218
|
+
ForcedTransferStatusLabels,
|
|
219
|
+
NominationStatus,
|
|
220
|
+
NominationStatusLabels,
|
|
221
|
+
SUPPORTED_CHAIN_IDS,
|
|
222
|
+
ZERO_ADDRESS,
|
|
223
|
+
abis,
|
|
224
|
+
addresses,
|
|
225
|
+
addressesFor,
|
|
226
|
+
aroChains,
|
|
227
|
+
base,
|
|
228
|
+
baseSepolia,
|
|
229
|
+
chainById,
|
|
230
|
+
chainLabels,
|
|
231
|
+
checkMembershipStatus,
|
|
232
|
+
clearNomination,
|
|
233
|
+
computeKycHash,
|
|
234
|
+
createAccessManagerClient,
|
|
235
|
+
createAroSdk,
|
|
236
|
+
createAssetsRegistryClient,
|
|
237
|
+
createForcedTransferClient,
|
|
238
|
+
createMultiSigClient,
|
|
239
|
+
createNominationClient,
|
|
240
|
+
createRwaClient,
|
|
241
|
+
createSbtClient,
|
|
242
|
+
decodeAroError,
|
|
243
|
+
describeOnboardingState,
|
|
244
|
+
getAddress,
|
|
245
|
+
getChain,
|
|
246
|
+
getNominationSnapshot,
|
|
247
|
+
hardhat,
|
|
248
|
+
hashKycResult,
|
|
249
|
+
mainnet,
|
|
250
|
+
mintSBTForApproved,
|
|
251
|
+
nominateCandidate,
|
|
252
|
+
sepolia,
|
|
253
|
+
tierAtLeast,
|
|
254
|
+
tierLabel,
|
|
255
|
+
tierRequirements,
|
|
256
|
+
vouchForCandidate
|
|
257
|
+
};
|
|
258
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"],"mappings":"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","names":["getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract","getContract"]}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { PublicClient, WalletClient, GetContractReturnType, Chain, Transport, Account, Hex } from 'viem';
|
|
2
|
+
import { AroChainId } from './generated/addresses.cjs';
|
|
3
|
+
import { AroMediaAccessManager_ABI, AroMediaAssetsRegistry_ABI, ForcedTransferManager_ABI, AroMediaIncMultiSig_ABI, AroNomination_ABI, AroMediaRWA_ABI, AroSBT_ABI } from './generated/abis.cjs';
|
|
4
|
+
|
|
5
|
+
/** Mirrors AroSBT.Tier. */
|
|
6
|
+
declare enum AroTier {
|
|
7
|
+
STANDARD = 0,
|
|
8
|
+
VERIFIED = 1,
|
|
9
|
+
TRUSTED = 2,
|
|
10
|
+
FOUNDING = 3
|
|
11
|
+
}
|
|
12
|
+
declare const AroTierLabels: Record<AroTier, string>;
|
|
13
|
+
/** Mirrors AroNomination.NominationStatus. */
|
|
14
|
+
declare enum NominationStatus {
|
|
15
|
+
NONE = 0,
|
|
16
|
+
PENDING = 1,
|
|
17
|
+
APPROVED = 2,
|
|
18
|
+
CLEARED = 3
|
|
19
|
+
}
|
|
20
|
+
declare const NominationStatusLabels: Record<NominationStatus, string>;
|
|
21
|
+
/** Mirrors ForcedTransferManager.ForcedTransferStatus. */
|
|
22
|
+
declare enum ForcedTransferStatus {
|
|
23
|
+
PENDING = 0,
|
|
24
|
+
APPROVED = 1,
|
|
25
|
+
EXECUTED = 2,
|
|
26
|
+
CANCELLED = 3
|
|
27
|
+
}
|
|
28
|
+
declare const ForcedTransferStatusLabels: Record<ForcedTransferStatus, string>;
|
|
29
|
+
|
|
30
|
+
type AroAccessManagerContract = GetContractReturnType<typeof AroMediaAccessManager_ABI, {
|
|
31
|
+
public: PublicClient;
|
|
32
|
+
wallet?: WalletClient;
|
|
33
|
+
}>;
|
|
34
|
+
interface AccessManagerClientOpts {
|
|
35
|
+
address: `0x${string}`;
|
|
36
|
+
publicClient: PublicClient;
|
|
37
|
+
walletClient?: WalletClient;
|
|
38
|
+
}
|
|
39
|
+
declare function createAccessManagerClient(opts: AccessManagerClientOpts): AroAccessManagerContract;
|
|
40
|
+
/**
|
|
41
|
+
* Role IDs as defined in AroMediaAccessManager.sol. Mirroring them here
|
|
42
|
+
* lets the dapp grant/revoke without re-reading the contract just to know
|
|
43
|
+
* which uint64 corresponds to which role.
|
|
44
|
+
*/
|
|
45
|
+
declare const AroRoles: {
|
|
46
|
+
readonly ORG_ADMIN: 0n;
|
|
47
|
+
readonly PROTOCOL_ADMIN: 1n;
|
|
48
|
+
readonly TREASURY_CONTROLLER: 2n;
|
|
49
|
+
readonly MARKET_MAKER: 3n;
|
|
50
|
+
readonly MINTER: 4n;
|
|
51
|
+
};
|
|
52
|
+
type AroRoleName = keyof typeof AroRoles;
|
|
53
|
+
|
|
54
|
+
type AroAssetsRegistryContract = GetContractReturnType<typeof AroMediaAssetsRegistry_ABI, {
|
|
55
|
+
public: PublicClient;
|
|
56
|
+
wallet?: WalletClient;
|
|
57
|
+
}>;
|
|
58
|
+
interface AssetsRegistryClientOpts {
|
|
59
|
+
address: `0x${string}`;
|
|
60
|
+
publicClient: PublicClient;
|
|
61
|
+
walletClient?: WalletClient;
|
|
62
|
+
}
|
|
63
|
+
declare function createAssetsRegistryClient(opts: AssetsRegistryClientOpts): AroAssetsRegistryContract;
|
|
64
|
+
|
|
65
|
+
type ForcedTransferManagerContract = GetContractReturnType<typeof ForcedTransferManager_ABI, {
|
|
66
|
+
public: PublicClient;
|
|
67
|
+
wallet?: WalletClient;
|
|
68
|
+
}>;
|
|
69
|
+
interface ForcedTransferClientOpts {
|
|
70
|
+
address: `0x${string}`;
|
|
71
|
+
publicClient: PublicClient;
|
|
72
|
+
walletClient?: WalletClient;
|
|
73
|
+
}
|
|
74
|
+
declare function createForcedTransferClient(opts: ForcedTransferClientOpts): ForcedTransferManagerContract;
|
|
75
|
+
|
|
76
|
+
type AroMultiSigContract = GetContractReturnType<typeof AroMediaIncMultiSig_ABI, {
|
|
77
|
+
public: PublicClient;
|
|
78
|
+
wallet?: WalletClient;
|
|
79
|
+
}>;
|
|
80
|
+
interface MultiSigClientOpts {
|
|
81
|
+
address: `0x${string}`;
|
|
82
|
+
publicClient: PublicClient;
|
|
83
|
+
walletClient?: WalletClient;
|
|
84
|
+
}
|
|
85
|
+
declare function createMultiSigClient(opts: MultiSigClientOpts): AroMultiSigContract;
|
|
86
|
+
|
|
87
|
+
type AroNominationContract = GetContractReturnType<typeof AroNomination_ABI, {
|
|
88
|
+
public: PublicClient;
|
|
89
|
+
wallet?: WalletClient;
|
|
90
|
+
}>;
|
|
91
|
+
interface NominationClientOpts {
|
|
92
|
+
address: `0x${string}`;
|
|
93
|
+
publicClient: PublicClient;
|
|
94
|
+
walletClient?: WalletClient;
|
|
95
|
+
}
|
|
96
|
+
declare function createNominationClient(opts: NominationClientOpts): AroNominationContract;
|
|
97
|
+
|
|
98
|
+
type AroRWAContract = GetContractReturnType<typeof AroMediaRWA_ABI, {
|
|
99
|
+
public: PublicClient;
|
|
100
|
+
wallet?: WalletClient;
|
|
101
|
+
}>;
|
|
102
|
+
interface RwaClientOpts {
|
|
103
|
+
address: `0x${string}`;
|
|
104
|
+
publicClient: PublicClient;
|
|
105
|
+
walletClient?: WalletClient;
|
|
106
|
+
}
|
|
107
|
+
declare function createRwaClient(opts: RwaClientOpts): AroRWAContract;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Typed viem contract handle for AroSBT.
|
|
111
|
+
*
|
|
112
|
+
* Use `read.hasSBT(address)`, `read.getMemberData(address)`, etc. for views;
|
|
113
|
+
* `write.mint(...)`, `write.revoke(...)`, etc. for state-changing calls when
|
|
114
|
+
* a wallet client is bound.
|
|
115
|
+
*/
|
|
116
|
+
type AroSBTContract = GetContractReturnType<typeof AroSBT_ABI, {
|
|
117
|
+
public: PublicClient;
|
|
118
|
+
wallet?: WalletClient;
|
|
119
|
+
}>;
|
|
120
|
+
interface SbtClientOpts {
|
|
121
|
+
address: `0x${string}`;
|
|
122
|
+
publicClient: PublicClient;
|
|
123
|
+
walletClient?: WalletClient;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Bind the AroSBT ABI to its deployed address and the caller's viem
|
|
127
|
+
* clients. The returned object is a thin proxy — calling `client.read.x`
|
|
128
|
+
* preserves full type inference from the ABI.
|
|
129
|
+
*/
|
|
130
|
+
declare function createSbtClient(opts: SbtClientOpts): AroSBTContract;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Per-contract address overrides. Useful for:
|
|
134
|
+
* • local Hardhat where ignition deployments aren't picked up at build time
|
|
135
|
+
* • staging deployments living outside of `ignition/deployments`
|
|
136
|
+
* • forked-network testing where contracts are at non-canonical addresses
|
|
137
|
+
*/
|
|
138
|
+
type AroAddressOverrides = Partial<Record<"AroSBT" | "AroNomination" | "AroMediaRWA" | "AroMediaAssetsRegistry" | "AroMediaAccessManager" | "AroMediaIncMultiSig" | "ForcedTransferManager", `0x${string}`>>;
|
|
139
|
+
interface CreateAroSdkOpts {
|
|
140
|
+
/** Target chain. Must be a chainId the SDK knows about. */
|
|
141
|
+
chain: Chain & {
|
|
142
|
+
id: AroChainId;
|
|
143
|
+
};
|
|
144
|
+
/** viem transport — defaults to `http()` against the chain's default RPC. */
|
|
145
|
+
transport?: Transport;
|
|
146
|
+
/** Optional wallet client for state-changing calls. */
|
|
147
|
+
walletClient?: WalletClient;
|
|
148
|
+
/** Override one or more contract addresses (local dev, staging, etc.). */
|
|
149
|
+
overrides?: AroAddressOverrides;
|
|
150
|
+
}
|
|
151
|
+
interface AroSdk {
|
|
152
|
+
chainId: AroChainId;
|
|
153
|
+
publicClient: PublicClient;
|
|
154
|
+
walletClient?: WalletClient;
|
|
155
|
+
/** Soulbound identity token. */
|
|
156
|
+
sbt: AroSBTContract;
|
|
157
|
+
/** Nomination + vouching workflow. */
|
|
158
|
+
nomination: AroNominationContract;
|
|
159
|
+
/** RWA security token (ARO). */
|
|
160
|
+
rwa: AroRWAContract;
|
|
161
|
+
/** ERC-721 assets registry. */
|
|
162
|
+
assetsRegistry: AroAssetsRegistryContract;
|
|
163
|
+
/** Centralized AccessManager (role grants/revokes). */
|
|
164
|
+
accessManager: AroAccessManagerContract;
|
|
165
|
+
/** ERC-7913 multi-sig smart-contract wallet. */
|
|
166
|
+
multiSig: AroMultiSigContract;
|
|
167
|
+
/** Regulator-driven forced transfer workflow. */
|
|
168
|
+
forcedTransfer: ForcedTransferManagerContract;
|
|
169
|
+
/** Resolve a contract address from the registry (with overrides applied). */
|
|
170
|
+
addressOf: (name: keyof AroAddressOverrides) => `0x${string}`;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The single entry point most consumers reach for. Returns a bundle of
|
|
174
|
+
* typed contract handles bound to a viem PublicClient (and optionally a
|
|
175
|
+
* WalletClient for writes).
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* const sdk = createAroSdk({
|
|
179
|
+
* chain: sepolia as Chain & { id: 11155111 },
|
|
180
|
+
* walletClient,
|
|
181
|
+
* });
|
|
182
|
+
* const isMember = await sdk.sbt.read.hasSBT([userAddress]);
|
|
183
|
+
* if (!isMember) await sdk.nomination.write.nominate([userAddress]);
|
|
184
|
+
*/
|
|
185
|
+
declare function createAroSdk(opts: CreateAroSdkOpts): AroSdk;
|
|
186
|
+
/** Helper: peek at the address registry without instantiating an SDK. */
|
|
187
|
+
declare function addressesFor(chainId: AroChainId): Record<keyof AroAddressOverrides, `0x${string}`>;
|
|
188
|
+
|
|
189
|
+
/**
|
|
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.
|
|
193
|
+
*
|
|
194
|
+
* Mental model (per Policy §6.3):
|
|
195
|
+
*
|
|
196
|
+
* 1. Existing member calls `nominateCandidate(candidate)`.
|
|
197
|
+
* The nominator's vouch counts as the first vouch automatically.
|
|
198
|
+
*
|
|
199
|
+
* 2. Other existing members call `vouchForCandidate(candidate)`. Each
|
|
200
|
+
* vouch increments the count; once `threshold` is reached (3 per
|
|
201
|
+
* policy), the nomination moves to APPROVED.
|
|
202
|
+
*
|
|
203
|
+
* 3. Off-chain: candidate completes Didit KYC (per MEMO-KYC-PROVIDER).
|
|
204
|
+
* Webhook posts back the verification result.
|
|
205
|
+
*
|
|
206
|
+
* 4. Compliance Officer reviews and either rejects (`clearNomination`)
|
|
207
|
+
* or mints the SBT (`mintSBTForApproved`) with the KYC hash.
|
|
208
|
+
*
|
|
209
|
+
* 5. SBT minted → AccessManager grants member roles → access unlocked.
|
|
210
|
+
*
|
|
211
|
+
* The write paths use `walletClient.writeContract` directly rather than
|
|
212
|
+
* the typed contract `.write` namespace. This is intentional: viem
|
|
213
|
+
* narrows the contract handle's write surface away when the SDK is
|
|
214
|
+
* instantiated without a walletClient, but workflows are run on demand
|
|
215
|
+
* after the dapp's wallet connects.
|
|
216
|
+
*/
|
|
217
|
+
interface MembershipStatus {
|
|
218
|
+
hasSBT: boolean;
|
|
219
|
+
tier?: AroTier;
|
|
220
|
+
tokenId?: bigint;
|
|
221
|
+
memberId?: bigint;
|
|
222
|
+
issuanceDate?: bigint;
|
|
223
|
+
kycHash?: `0x${string}`;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* One-call read for the dapp's access-gate page. Returns whether the
|
|
227
|
+
* connected wallet holds an SBT and, if so, decoded member data.
|
|
228
|
+
*
|
|
229
|
+
* Implementation note: reads are issued via `publicClient.readContract`
|
|
230
|
+
* with the ABI rather than the typed contract instance's `.read`
|
|
231
|
+
* namespace. viem ≥2.50 narrows `contract.read.*` based on whether a
|
|
232
|
+
* walletClient was bound at construction time; bypassing that gives us a
|
|
233
|
+
* stable, version-independent signature.
|
|
234
|
+
*/
|
|
235
|
+
declare function checkMembershipStatus(sdk: AroSdk, account: `0x${string}`): Promise<MembershipStatus>;
|
|
236
|
+
interface NominationSnapshot {
|
|
237
|
+
status: NominationStatus;
|
|
238
|
+
nominator: `0x${string}`;
|
|
239
|
+
vouchers: readonly `0x${string}`[];
|
|
240
|
+
nominatedAt: bigint;
|
|
241
|
+
voucherCount: number;
|
|
242
|
+
threshold: number;
|
|
243
|
+
remaining: number;
|
|
244
|
+
ready: boolean;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Snapshot of the candidate's progress through the vouch flow. The dapp
|
|
248
|
+
* shows this as "you need N more vouches" in the onboarding UI.
|
|
249
|
+
*/
|
|
250
|
+
declare function getNominationSnapshot(sdk: AroSdk, candidate: `0x${string}`): Promise<NominationSnapshot>;
|
|
251
|
+
/**
|
|
252
|
+
* Send `nominate(candidate)` from the connected wallet. The contract
|
|
253
|
+
* gates this behind "caller must already be an SBT holder"; we surface
|
|
254
|
+
* the right user-facing message via `AroContractError`.
|
|
255
|
+
*/
|
|
256
|
+
declare function nominateCandidate(sdk: AroSdk, candidate: `0x${string}`, opts?: {
|
|
257
|
+
account?: Account | `0x${string}`;
|
|
258
|
+
}): Promise<Hex>;
|
|
259
|
+
declare function vouchForCandidate(sdk: AroSdk, candidate: `0x${string}`, opts?: {
|
|
260
|
+
account?: Account | `0x${string}`;
|
|
261
|
+
}): Promise<Hex>;
|
|
262
|
+
/**
|
|
263
|
+
* Admin path: clear (reject) a nomination. Restricted to authorized roles
|
|
264
|
+
* via AccessManager; will revert with AccessManagedUnauthorized if the
|
|
265
|
+
* caller lacks the role.
|
|
266
|
+
*/
|
|
267
|
+
declare function clearNomination(sdk: AroSdk, candidate: `0x${string}`, opts?: {
|
|
268
|
+
account?: Account | `0x${string}`;
|
|
269
|
+
}): Promise<Hex>;
|
|
270
|
+
interface MintSBTOpts {
|
|
271
|
+
to: `0x${string}`;
|
|
272
|
+
/** keccak256 of the verified KYC payload — see utils/kycHash.ts. */
|
|
273
|
+
kycHash: `0x${string}`;
|
|
274
|
+
/** Off-chain profile metadata URI (ipfs://... or https://...). */
|
|
275
|
+
metadataURI: string;
|
|
276
|
+
/** Initial tier (defaults to STANDARD per Policy §6.1). */
|
|
277
|
+
tier?: AroTier;
|
|
278
|
+
account?: Account | `0x${string}`;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Admin-only: mint the SBT for an approved candidate. The contract gates
|
|
282
|
+
* this behind ROLE_MINTER via AccessManager (per AroMediaAccessManager).
|
|
283
|
+
*
|
|
284
|
+
* Calls the 4-arg mint overload explicitly so the tier is always
|
|
285
|
+
* specified — the 3-arg overload silently defaults to STANDARD, which
|
|
286
|
+
* we don't want callers to rely on implicitly.
|
|
287
|
+
*/
|
|
288
|
+
declare function mintSBTForApproved(sdk: AroSdk, opts: MintSBTOpts): Promise<Hex>;
|
|
289
|
+
/**
|
|
290
|
+
* Convenience: enumerate the policy-derived next action for a wallet so
|
|
291
|
+
* the onboarding UI can render the correct step (Connect → Nominate →
|
|
292
|
+
* Vouch → KYC → Mint).
|
|
293
|
+
*/
|
|
294
|
+
type OnboardingStep = "needs-wallet" | "needs-nomination" | "needs-vouches" | "needs-kyc" | "needs-admin-mint" | "member";
|
|
295
|
+
interface OnboardingState {
|
|
296
|
+
step: OnboardingStep;
|
|
297
|
+
membership: MembershipStatus;
|
|
298
|
+
nomination?: NominationSnapshot;
|
|
299
|
+
}
|
|
300
|
+
declare function describeOnboardingState(sdk: AroSdk, wallet: `0x${string}` | undefined): Promise<OnboardingState>;
|
|
301
|
+
|
|
302
|
+
export { type AccessManagerClientOpts as A, createAroSdk as B, type CreateAroSdkOpts as C, createAssetsRegistryClient as D, createForcedTransferClient as E, type ForcedTransferClientOpts as F, createMultiSigClient as G, createNominationClient as H, createRwaClient as I, createSbtClient as J, describeOnboardingState as K, getNominationSnapshot as L, type MembershipStatus as M, type NominationClientOpts as N, type OnboardingState as O, mintSBTForApproved as P, nominateCandidate as Q, type RwaClientOpts as R, type SbtClientOpts as S, vouchForCandidate as T, type AroAccessManagerContract as a, type AroAddressOverrides as b, type AroAssetsRegistryContract as c, type AroMultiSigContract as d, type AroNominationContract as e, type AroRWAContract as f, type AroRoleName as g, AroRoles as h, type AroSBTContract as i, type AroSdk as j, AroTier as k, AroTierLabels as l, type AssetsRegistryClientOpts as m, type ForcedTransferManagerContract as n, ForcedTransferStatus as o, ForcedTransferStatusLabels as p, type MintSBTOpts as q, type MultiSigClientOpts as r, type NominationSnapshot as s, NominationStatus as t, NominationStatusLabels as u, type OnboardingStep as v, addressesFor as w, checkMembershipStatus as x, clearNomination as y, createAccessManagerClient as z };
|