@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aro Media Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# @aromedia/contracts-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the [Aro Media](https://aro.media) on-chain ecosystem. Wraps every contract in [`aromedia-blockchain-contracts`](https://github.com/aromediainc/aromedia-blockchain-contracts) (SBT identity, nomination workflow, RWA security token, assets registry, access manager, multisig, forced-transfer manager) behind a single typed API.
|
|
4
|
+
|
|
5
|
+
Designed for both server-side use (deploy helpers, indexers, jobs) and the Next.js dapp. React-specific code is gated behind a sub-path so consumers that don't need wagmi don't pull React in.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @aromedia/contracts-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
### Core (server, scripts, anything non-React)
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createAroSdk, sepolia } from "@aromedia/contracts-sdk";
|
|
17
|
+
|
|
18
|
+
const sdk = createAroSdk({ chain: sepolia });
|
|
19
|
+
const isMember = await sdk.sbt.read.hasSBT([userAddress]);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### React / wagmi
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { useMembership } from "@aromedia/contracts-sdk/hooks";
|
|
26
|
+
|
|
27
|
+
const { data, isLoading } = useMembership(account);
|
|
28
|
+
// data.step ∈ "needs-wallet" | "needs-nomination" | "needs-vouches"
|
|
29
|
+
// | "needs-kyc" | "needs-admin-mint" | "member"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Onboarding (aligned with the ARO KYC/AML/CFT Policy)
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import {
|
|
36
|
+
describeOnboardingState,
|
|
37
|
+
nominateCandidate,
|
|
38
|
+
vouchForCandidate,
|
|
39
|
+
mintSBTForApproved,
|
|
40
|
+
hashKycResult,
|
|
41
|
+
AroTier,
|
|
42
|
+
} from "@aromedia/contracts-sdk";
|
|
43
|
+
|
|
44
|
+
await nominateCandidate(sdk, candidateAddress);
|
|
45
|
+
await vouchForCandidate(sdk, candidateAddress);
|
|
46
|
+
|
|
47
|
+
const kycHash = hashKycResult({
|
|
48
|
+
provider: "didit",
|
|
49
|
+
sessionId,
|
|
50
|
+
status: "verified",
|
|
51
|
+
verifiedAt,
|
|
52
|
+
walletAddress: candidateAddress,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
await mintSBTForApproved(sdk, {
|
|
56
|
+
to: candidateAddress,
|
|
57
|
+
kycHash,
|
|
58
|
+
metadataURI: "ipfs://...",
|
|
59
|
+
tier: AroTier.STANDARD,
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Entry points
|
|
64
|
+
|
|
65
|
+
| Import path | What it gives you |
|
|
66
|
+
| :------------------------------------ | :------------------------------------------------ |
|
|
67
|
+
| `@aromedia/contracts-sdk` | Clients, workflows, utils, types — no React |
|
|
68
|
+
| `@aromedia/contracts-sdk/hooks` | wagmi React hooks (peer dep on wagmi + react) |
|
|
69
|
+
| `@aromedia/contracts-sdk/abis` | Raw ABIs only (tree-shake friendly, zero runtime) |
|
|
70
|
+
| `@aromedia/contracts-sdk/addresses` | Per-chain deployed-address registry |
|
|
71
|
+
| `@aromedia/contracts-sdk/chains` | Chain configs the SDK supports |
|
|
72
|
+
| `@aromedia/contracts-sdk/workflows` | High-level domain helpers |
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
### Repository layout
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
aromediainc/
|
|
80
|
+
├── sdks/contracts-sdk/ ← this repo
|
|
81
|
+
└── aromedia-blockchain-contracts/ ← sibling; source of ABIs + deployment addresses
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The SDK ships generated ABIs and addresses under `src/generated/`, so installing the published package does NOT require Hardhat. The generator is only needed when contracts change.
|
|
85
|
+
|
|
86
|
+
### Regenerating from the contracts repo
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# in aromedia-blockchain-contracts/
|
|
90
|
+
npm run compile # rebuild Hardhat artifacts
|
|
91
|
+
|
|
92
|
+
# in this repo
|
|
93
|
+
npm run generate # reads sibling contracts repo, writes src/generated/
|
|
94
|
+
npm run build # bundle dist/
|
|
95
|
+
npm run typecheck
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
You can override the contracts repo location with `CONTRACTS_REPO_PATH`:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
CONTRACTS_REPO_PATH=/path/to/aromedia-blockchain-contracts npm run generate
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Releasing
|
|
105
|
+
|
|
106
|
+
This repo uses [Changesets](https://github.com/changesets/changesets) for semver-driven releases.
|
|
107
|
+
|
|
108
|
+
1. After your change, run `npm run changeset` and describe the change (`patch` / `minor` / `major`).
|
|
109
|
+
2. Commit the resulting file under `.changeset/` alongside your code.
|
|
110
|
+
3. When the PR merges to `main`, the `release` workflow opens (or updates) a "Version Packages" PR that consumes pending changesets and bumps the version + CHANGELOG.
|
|
111
|
+
4. Merging the Version Packages PR triggers the publish step, which builds and runs `changeset publish` against npm.
|
|
112
|
+
|
|
113
|
+
### CI
|
|
114
|
+
|
|
115
|
+
- `ci.yml` — typecheck + build on every PR.
|
|
116
|
+
- `release.yml` — Version PR + npm publish on `main`.
|
|
117
|
+
- `sync-abis.yml` — nightly job that clones the contracts repo, regenerates ABIs/addresses, and opens a PR if anything changed.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
[MIT](./LICENSE) © Aro Media Inc.
|
package/dist/chains.cjs
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/chains.ts
|
|
21
|
+
var chains_exports = {};
|
|
22
|
+
__export(chains_exports, {
|
|
23
|
+
DEFAULT_CHAIN: () => DEFAULT_CHAIN,
|
|
24
|
+
aroChains: () => aroChains,
|
|
25
|
+
base: () => import_chains.base,
|
|
26
|
+
baseSepolia: () => import_chains.baseSepolia,
|
|
27
|
+
chainById: () => chainById,
|
|
28
|
+
getChain: () => getChain,
|
|
29
|
+
hardhat: () => import_chains.hardhat,
|
|
30
|
+
mainnet: () => import_chains.mainnet,
|
|
31
|
+
sepolia: () => import_chains.sepolia
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(chains_exports);
|
|
34
|
+
var import_chains = require("viem/chains");
|
|
35
|
+
var aroChains = {
|
|
36
|
+
mainnet: import_chains.mainnet,
|
|
37
|
+
sepolia: import_chains.sepolia,
|
|
38
|
+
base: import_chains.base,
|
|
39
|
+
baseSepolia: import_chains.baseSepolia,
|
|
40
|
+
hardhat: import_chains.hardhat
|
|
41
|
+
};
|
|
42
|
+
var chainById = {
|
|
43
|
+
1: import_chains.mainnet,
|
|
44
|
+
11155111: import_chains.sepolia,
|
|
45
|
+
8453: import_chains.base,
|
|
46
|
+
84532: import_chains.baseSepolia,
|
|
47
|
+
31337: import_chains.hardhat
|
|
48
|
+
};
|
|
49
|
+
var DEFAULT_CHAIN = import_chains.sepolia;
|
|
50
|
+
function getChain(chainId) {
|
|
51
|
+
const chain = chainById[chainId];
|
|
52
|
+
if (!chain) throw new Error(`Unsupported chainId ${chainId}`);
|
|
53
|
+
return chain;
|
|
54
|
+
}
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
DEFAULT_CHAIN,
|
|
58
|
+
aroChains,
|
|
59
|
+
base,
|
|
60
|
+
baseSepolia,
|
|
61
|
+
chainById,
|
|
62
|
+
getChain,
|
|
63
|
+
hardhat,
|
|
64
|
+
mainnet,
|
|
65
|
+
sepolia
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=chains.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/chains.ts"],"sourcesContent":["import { base, baseSepolia, hardhat, mainnet, sepolia } from \"viem/chains\";\nimport type { Chain } from \"viem\";\n\nimport type { AroChainId } from \"./generated/addresses.js\";\n\n/**\n * Chains the SDK has first-class support for. Re-exported from viem to keep\n * the consumer's chain instance identical to ours — this matters because\n * wagmi keys its provider registry by chain object identity.\n */\nexport const aroChains = {\n mainnet,\n sepolia,\n base,\n baseSepolia,\n hardhat,\n} as const;\n\nexport type AroChainLabel = keyof typeof aroChains;\n\n/** Map from chainId → viem chain. */\nexport const chainById: Record<AroChainId, Chain> = {\n 1: mainnet,\n 11155111: sepolia,\n 8453: base,\n 84532: baseSepolia,\n 31337: hardhat,\n};\n\n/**\n * The chain we treat as the production deployment target. Sepolia today;\n * flip to `base` or `mainnet` once the contracts are deployed there.\n */\nexport const DEFAULT_CHAIN: Chain = sepolia;\n\nexport function getChain(chainId: AroChainId): Chain {\n const chain = chainById[chainId];\n if (!chain) throw new Error(`Unsupported chainId ${chainId}`);\n return chain;\n}\n\nexport { mainnet, sepolia, base, baseSepolia, hardhat };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6D;AAUtD,IAAM,YAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,IAAM,YAAuC;AAAA,EAClD,GAAG;AAAA,EACH,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AACT;AAMO,IAAM,gBAAuB;AAE7B,SAAS,SAAS,SAA4B;AACnD,QAAM,QAAQ,UAAU,OAAO;AAC/B,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,uBAAuB,OAAO,EAAE;AAC5D,SAAO;AACT;","names":[]}
|