@andrewkimjoseph/celina-sdk 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -3
- package/build/abis/accounts.d.ts +13 -0
- package/build/abis/accounts.js +10 -0
- package/build/abis/accounts.js.map +1 -0
- package/build/abis/election.d.ts +124 -0
- package/build/abis/election.js +88 -0
- package/build/abis/election.js.map +1 -0
- package/build/abis/governance.d.ts +86 -0
- package/build/abis/governance.js +68 -0
- package/build/abis/governance.js.map +1 -0
- package/build/abis/locked-gold.d.ts +10 -0
- package/build/abis/locked-gold.js +10 -0
- package/build/abis/locked-gold.js.map +1 -0
- package/build/abis/nft.d.ts +107 -0
- package/build/abis/nft.js +75 -0
- package/build/abis/nft.js.map +1 -0
- package/build/abis/validators-minimal.d.ts +65 -0
- package/build/abis/validators-minimal.js +39 -0
- package/build/abis/validators-minimal.js.map +1 -0
- package/build/config/celo-core-contracts.d.ts +8 -0
- package/build/config/celo-core-contracts.js +9 -0
- package/build/config/celo-core-contracts.js.map +1 -0
- package/build/config/chains.js +4 -0
- package/build/config/chains.js.map +1 -1
- package/build/index.d.ts +28 -0
- package/build/index.js +18 -0
- package/build/index.js.map +1 -1
- package/build/services/aave.service.d.ts +8 -0
- package/build/services/aave.service.js +9 -0
- package/build/services/aave.service.js.map +1 -1
- package/build/services/blockchain.service.d.ts +14 -3
- package/build/services/blockchain.service.js +42 -14
- package/build/services/blockchain.service.js.map +1 -1
- package/build/services/contract.service.d.ts +52 -0
- package/build/services/contract.service.js +98 -0
- package/build/services/contract.service.js.map +1 -0
- package/build/services/ens.service.d.ts +2 -0
- package/build/services/ens.service.js +2 -0
- package/build/services/ens.service.js.map +1 -1
- package/build/services/gooddollar.service.d.ts +1 -0
- package/build/services/gooddollar.service.js +1 -0
- package/build/services/gooddollar.service.js.map +1 -1
- package/build/services/governance.service.d.ts +78 -0
- package/build/services/governance.service.js +241 -0
- package/build/services/governance.service.js.map +1 -0
- package/build/services/mento-fx.service.d.ts +6 -0
- package/build/services/mento-fx.service.js +10 -0
- package/build/services/mento-fx.service.js.map +1 -1
- package/build/services/nft.service.d.ts +42 -0
- package/build/services/nft.service.js +203 -0
- package/build/services/nft.service.js.map +1 -0
- package/build/services/staking.service.d.ts +109 -0
- package/build/services/staking.service.js +410 -0
- package/build/services/staking.service.js.map +1 -0
- package/build/services/token.service.d.ts +14 -0
- package/build/services/token.service.js +51 -0
- package/build/services/token.service.js.map +1 -1
- package/build/services/transaction.service.d.ts +37 -0
- package/build/services/transaction.service.js +78 -1
- package/build/services/transaction.service.js.map +1 -1
- package/build/types/prepared.d.ts +7 -1
- package/build/types/prepared.js +1 -0
- package/build/types/prepared.js.map +1 -1
- package/build/utils/celo-format.d.ts +3 -0
- package/build/utils/celo-format.js +14 -0
- package/build/utils/celo-format.js.map +1 -0
- package/build/utils/normalize-address.d.ts +2 -0
- package/build/utils/normalize-address.js +11 -0
- package/build/utils/normalize-address.js.map +1 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Celina SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Celina-linked mainnet library for frontend apps: **reads** and **unsigned transaction preparation** (no private keys).
|
|
4
4
|
|
|
5
5
|
Pair with [wagmi](https://wagmi.sh) / viem in the browser — users sign prepared transactions in their wallet.
|
|
6
6
|
|
|
@@ -42,15 +42,68 @@ const flow = await celina.transaction.prepareSend(
|
|
|
42
42
|
|---------|-------|---------------------|
|
|
43
43
|
| `blockchain` | network status, blocks, transactions | — |
|
|
44
44
|
| `account` | CELO balance, nonce | — |
|
|
45
|
-
| `token` | balances, token info, stablecoins | — |
|
|
45
|
+
| `token` | balances, token info, stablecoins, `getTokenBalance` | — |
|
|
46
46
|
| `ens` | resolve ENS names | — |
|
|
47
47
|
| `gooddollar` | whitelist status | — |
|
|
48
|
-
| `transaction` | `estimateSend(from, …)` | `prepareSend(from, …)` |
|
|
48
|
+
| `transaction` | `getGasFeeData`, `estimateTransaction`, `estimateSend(from, …)` | `prepareSend(from, …)` |
|
|
49
49
|
| `mentoFx` | `getFxQuote`, `estimateFx(from, …)` | `prepareFx(from, …)` |
|
|
50
50
|
| `aave` | — | `prepareSupply(from, …)`, `prepareWithdraw(from, …)` |
|
|
51
|
+
| `governance` | proposals list, proposal details | — |
|
|
52
|
+
| `staking` | balances, activatable stakes, validator groups | — |
|
|
53
|
+
| `nft` | NFT info, NFT balance | — |
|
|
54
|
+
| `contract` | `callFunction`, `estimateGas` (caller-supplied ABI) | — |
|
|
51
55
|
|
|
52
56
|
Prepared flows return `{ preparedFlow: true, steps, summary, from, network }` with JSON-safe `value` strings.
|
|
53
57
|
|
|
58
|
+
## For developers
|
|
59
|
+
|
|
60
|
+
### Architecture
|
|
61
|
+
|
|
62
|
+
`createCelinaClient()` wires `CeloClientFactory` and `EnsClientFactory` into domain services. The SDK never holds or uses private keys — it only performs public RPC reads and builds unsigned transaction payloads for a caller-supplied `from` address.
|
|
63
|
+
|
|
64
|
+
Consumers (e.g. [celina-agent](../celina-agent)) pass prepared `steps` to wagmi/viem for wallet signing.
|
|
65
|
+
|
|
66
|
+
### Directory map
|
|
67
|
+
|
|
68
|
+
| Path | Purpose |
|
|
69
|
+
|------|---------|
|
|
70
|
+
| `src/index.ts` | Public entry — `createCelinaClient()` and type exports |
|
|
71
|
+
| `src/clients/` | viem public clients (Celo + Ethereum for ENS) |
|
|
72
|
+
| `src/config/` | Token registry (`chains.ts`), Aave/GoodDollar constants |
|
|
73
|
+
| `src/services/` | Domain logic — reads and `prepare*` methods |
|
|
74
|
+
| `src/types/prepared.ts` | `SerializedPreparedFlow` contract for chat/API consumers |
|
|
75
|
+
| `src/utils/` | Shared helpers (allowance simulation, formatting) |
|
|
76
|
+
|
|
77
|
+
### Prepared flow contract
|
|
78
|
+
|
|
79
|
+
`prepareSend`, `prepareFx`, `prepareSupply`, and `prepareWithdraw` return:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
{
|
|
83
|
+
preparedFlow: true,
|
|
84
|
+
steps: PreparedTx[], // ordered txs for wagmi sendTransaction
|
|
85
|
+
summary: string, // human-readable label for UI
|
|
86
|
+
from: `0x${string}`,
|
|
87
|
+
network: "mainnet",
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Each `PreparedTx` has `kind`, `to`, optional `data`, optional `value` (wei as decimal string for JSON), and `description`. Multi-step flows (e.g. ERC-20 approve + swap) appear as multiple steps in order.
|
|
92
|
+
|
|
93
|
+
### Adding a service
|
|
94
|
+
|
|
95
|
+
1. Create `src/services/my-feature.service.ts` accepting `CeloClientFactory` in the constructor.
|
|
96
|
+
2. Register the instance in `src/index.ts` on `CelinaClient`.
|
|
97
|
+
3. Export public types from `src/index.ts` if needed by consumers.
|
|
98
|
+
4. Run `npm run build` and bump the package version before publishing.
|
|
99
|
+
|
|
100
|
+
### Publishing
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm version patch # or minor/major — cannot republish an existing version
|
|
104
|
+
npm publish --access public
|
|
105
|
+
```
|
|
106
|
+
|
|
54
107
|
## Related packages
|
|
55
108
|
|
|
56
109
|
- [`@andrewkimjoseph/celina-mcp`](https://www.npmjs.com/package/@andrewkimjoseph/celina-mcp) — MCP server for IDE/CLI agents (server-key writes + Self Agent ID)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const accountsAbi: readonly [{
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "getName";
|
|
4
|
+
readonly inputs: readonly [{
|
|
5
|
+
readonly name: "account";
|
|
6
|
+
readonly type: "address";
|
|
7
|
+
}];
|
|
8
|
+
readonly outputs: readonly [{
|
|
9
|
+
readonly name: "";
|
|
10
|
+
readonly type: "string";
|
|
11
|
+
}];
|
|
12
|
+
readonly stateMutability: "view";
|
|
13
|
+
}];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../src/abis/accounts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACvC,eAAe,EAAE,MAAM;KACxB;CACO,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export declare const electionAbi: readonly [{
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "getGroupsVotedForByAccount";
|
|
4
|
+
readonly inputs: readonly [{
|
|
5
|
+
readonly name: "account";
|
|
6
|
+
readonly type: "address";
|
|
7
|
+
}];
|
|
8
|
+
readonly outputs: readonly [{
|
|
9
|
+
readonly name: "";
|
|
10
|
+
readonly type: "address[]";
|
|
11
|
+
}];
|
|
12
|
+
readonly stateMutability: "view";
|
|
13
|
+
}, {
|
|
14
|
+
readonly type: "function";
|
|
15
|
+
readonly name: "getPendingVotesForGroupByAccount";
|
|
16
|
+
readonly inputs: readonly [{
|
|
17
|
+
readonly name: "group";
|
|
18
|
+
readonly type: "address";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "account";
|
|
21
|
+
readonly type: "address";
|
|
22
|
+
}];
|
|
23
|
+
readonly outputs: readonly [{
|
|
24
|
+
readonly name: "";
|
|
25
|
+
readonly type: "uint256";
|
|
26
|
+
}];
|
|
27
|
+
readonly stateMutability: "view";
|
|
28
|
+
}, {
|
|
29
|
+
readonly type: "function";
|
|
30
|
+
readonly name: "getActiveVotesForGroupByAccount";
|
|
31
|
+
readonly inputs: readonly [{
|
|
32
|
+
readonly name: "group";
|
|
33
|
+
readonly type: "address";
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "account";
|
|
36
|
+
readonly type: "address";
|
|
37
|
+
}];
|
|
38
|
+
readonly outputs: readonly [{
|
|
39
|
+
readonly name: "";
|
|
40
|
+
readonly type: "uint256";
|
|
41
|
+
}];
|
|
42
|
+
readonly stateMutability: "view";
|
|
43
|
+
}, {
|
|
44
|
+
readonly type: "function";
|
|
45
|
+
readonly name: "hasActivatablePendingVotes";
|
|
46
|
+
readonly inputs: readonly [{
|
|
47
|
+
readonly name: "account";
|
|
48
|
+
readonly type: "address";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "group";
|
|
51
|
+
readonly type: "address";
|
|
52
|
+
}];
|
|
53
|
+
readonly outputs: readonly [{
|
|
54
|
+
readonly name: "";
|
|
55
|
+
readonly type: "bool";
|
|
56
|
+
}];
|
|
57
|
+
readonly stateMutability: "view";
|
|
58
|
+
}, {
|
|
59
|
+
readonly type: "function";
|
|
60
|
+
readonly name: "getEligibleValidatorGroups";
|
|
61
|
+
readonly inputs: readonly [];
|
|
62
|
+
readonly outputs: readonly [{
|
|
63
|
+
readonly name: "";
|
|
64
|
+
readonly type: "address[]";
|
|
65
|
+
}];
|
|
66
|
+
readonly stateMutability: "view";
|
|
67
|
+
}, {
|
|
68
|
+
readonly type: "function";
|
|
69
|
+
readonly name: "getActiveVotesForGroup";
|
|
70
|
+
readonly inputs: readonly [{
|
|
71
|
+
readonly name: "group";
|
|
72
|
+
readonly type: "address";
|
|
73
|
+
}];
|
|
74
|
+
readonly outputs: readonly [{
|
|
75
|
+
readonly name: "";
|
|
76
|
+
readonly type: "uint256";
|
|
77
|
+
}];
|
|
78
|
+
readonly stateMutability: "view";
|
|
79
|
+
}, {
|
|
80
|
+
readonly type: "function";
|
|
81
|
+
readonly name: "getTotalVotesForEligibleValidatorGroups";
|
|
82
|
+
readonly inputs: readonly [];
|
|
83
|
+
readonly outputs: readonly [{
|
|
84
|
+
readonly name: "groups";
|
|
85
|
+
readonly type: "address[]";
|
|
86
|
+
}, {
|
|
87
|
+
readonly name: "votes";
|
|
88
|
+
readonly type: "uint256[]";
|
|
89
|
+
}];
|
|
90
|
+
readonly stateMutability: "view";
|
|
91
|
+
}, {
|
|
92
|
+
readonly type: "function";
|
|
93
|
+
readonly name: "getTotalVotes";
|
|
94
|
+
readonly inputs: readonly [];
|
|
95
|
+
readonly outputs: readonly [{
|
|
96
|
+
readonly name: "";
|
|
97
|
+
readonly type: "uint256";
|
|
98
|
+
}];
|
|
99
|
+
readonly stateMutability: "view";
|
|
100
|
+
}, {
|
|
101
|
+
readonly type: "function";
|
|
102
|
+
readonly name: "getElectableValidators";
|
|
103
|
+
readonly inputs: readonly [];
|
|
104
|
+
readonly outputs: readonly [{
|
|
105
|
+
readonly name: "min";
|
|
106
|
+
readonly type: "uint256";
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "max";
|
|
109
|
+
readonly type: "uint256";
|
|
110
|
+
}];
|
|
111
|
+
readonly stateMutability: "view";
|
|
112
|
+
}, {
|
|
113
|
+
readonly type: "function";
|
|
114
|
+
readonly name: "canReceiveVotes";
|
|
115
|
+
readonly inputs: readonly [{
|
|
116
|
+
readonly name: "group";
|
|
117
|
+
readonly type: "address";
|
|
118
|
+
}];
|
|
119
|
+
readonly outputs: readonly [{
|
|
120
|
+
readonly name: "";
|
|
121
|
+
readonly type: "uint256";
|
|
122
|
+
}];
|
|
123
|
+
readonly stateMutability: "view";
|
|
124
|
+
}];
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export const electionAbi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "getGroupsVotedForByAccount",
|
|
5
|
+
inputs: [{ name: "account", type: "address" }],
|
|
6
|
+
outputs: [{ name: "", type: "address[]" }],
|
|
7
|
+
stateMutability: "view",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
type: "function",
|
|
11
|
+
name: "getPendingVotesForGroupByAccount",
|
|
12
|
+
inputs: [
|
|
13
|
+
{ name: "group", type: "address" },
|
|
14
|
+
{ name: "account", type: "address" },
|
|
15
|
+
],
|
|
16
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
17
|
+
stateMutability: "view",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: "function",
|
|
21
|
+
name: "getActiveVotesForGroupByAccount",
|
|
22
|
+
inputs: [
|
|
23
|
+
{ name: "group", type: "address" },
|
|
24
|
+
{ name: "account", type: "address" },
|
|
25
|
+
],
|
|
26
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
27
|
+
stateMutability: "view",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: "function",
|
|
31
|
+
name: "hasActivatablePendingVotes",
|
|
32
|
+
inputs: [
|
|
33
|
+
{ name: "account", type: "address" },
|
|
34
|
+
{ name: "group", type: "address" },
|
|
35
|
+
],
|
|
36
|
+
outputs: [{ name: "", type: "bool" }],
|
|
37
|
+
stateMutability: "view",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "function",
|
|
41
|
+
name: "getEligibleValidatorGroups",
|
|
42
|
+
inputs: [],
|
|
43
|
+
outputs: [{ name: "", type: "address[]" }],
|
|
44
|
+
stateMutability: "view",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: "function",
|
|
48
|
+
name: "getActiveVotesForGroup",
|
|
49
|
+
inputs: [{ name: "group", type: "address" }],
|
|
50
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
51
|
+
stateMutability: "view",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: "function",
|
|
55
|
+
name: "getTotalVotesForEligibleValidatorGroups",
|
|
56
|
+
inputs: [],
|
|
57
|
+
outputs: [
|
|
58
|
+
{ name: "groups", type: "address[]" },
|
|
59
|
+
{ name: "votes", type: "uint256[]" },
|
|
60
|
+
],
|
|
61
|
+
stateMutability: "view",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: "function",
|
|
65
|
+
name: "getTotalVotes",
|
|
66
|
+
inputs: [],
|
|
67
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
68
|
+
stateMutability: "view",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: "function",
|
|
72
|
+
name: "getElectableValidators",
|
|
73
|
+
inputs: [],
|
|
74
|
+
outputs: [
|
|
75
|
+
{ name: "min", type: "uint256" },
|
|
76
|
+
{ name: "max", type: "uint256" },
|
|
77
|
+
],
|
|
78
|
+
stateMutability: "view",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: "function",
|
|
82
|
+
name: "canReceiveVotes",
|
|
83
|
+
inputs: [{ name: "group", type: "address" }],
|
|
84
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
85
|
+
stateMutability: "view",
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
//# sourceMappingURL=election.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"election.js","sourceRoot":"","sources":["../../src/abis/election.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,4BAA4B;QAClC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;QAC1C,eAAe,EAAE,MAAM;KACxB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,kCAAkC;QACxC,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YAClC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SACrC;QACD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACxC,eAAe,EAAE,MAAM;KACxB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,iCAA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E;SACrC;QACD,eAAe,EAAE,MAAM;KACxB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACxC,eAAe,EAAE,MAAM;KACxB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,wBAAwB;QAC9B,MAAM,EAAE,EAAE;QACV,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;YAChC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;SACjC;QACD,eAAe,EAAE,MAAM;KACxB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC5C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACxC,eAAe,EAAE,MAAM;KACxB;CACO,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export declare const governanceAbi: readonly [{
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "getQueue";
|
|
4
|
+
readonly inputs: readonly [];
|
|
5
|
+
readonly outputs: readonly [{
|
|
6
|
+
readonly name: "";
|
|
7
|
+
readonly type: "uint256[]";
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "";
|
|
10
|
+
readonly type: "uint256[]";
|
|
11
|
+
}];
|
|
12
|
+
readonly stateMutability: "view";
|
|
13
|
+
}, {
|
|
14
|
+
readonly type: "function";
|
|
15
|
+
readonly name: "getDequeue";
|
|
16
|
+
readonly inputs: readonly [];
|
|
17
|
+
readonly outputs: readonly [{
|
|
18
|
+
readonly name: "";
|
|
19
|
+
readonly type: "uint256[]";
|
|
20
|
+
}];
|
|
21
|
+
readonly stateMutability: "view";
|
|
22
|
+
}, {
|
|
23
|
+
readonly type: "function";
|
|
24
|
+
readonly name: "getProposal";
|
|
25
|
+
readonly inputs: readonly [{
|
|
26
|
+
readonly name: "proposalId";
|
|
27
|
+
readonly type: "uint256";
|
|
28
|
+
}];
|
|
29
|
+
readonly outputs: readonly [{
|
|
30
|
+
readonly name: "proposer";
|
|
31
|
+
readonly type: "address";
|
|
32
|
+
}, {
|
|
33
|
+
readonly name: "deposit";
|
|
34
|
+
readonly type: "uint256";
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "timestamp";
|
|
37
|
+
readonly type: "uint256";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "transactionCount";
|
|
40
|
+
readonly type: "uint256";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "descriptionURL";
|
|
43
|
+
readonly type: "string";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "networkWeight";
|
|
46
|
+
readonly type: "uint256";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "approved";
|
|
49
|
+
readonly type: "bool";
|
|
50
|
+
}];
|
|
51
|
+
readonly stateMutability: "view";
|
|
52
|
+
}, {
|
|
53
|
+
readonly type: "function";
|
|
54
|
+
readonly name: "getProposalStage";
|
|
55
|
+
readonly inputs: readonly [{
|
|
56
|
+
readonly name: "proposalId";
|
|
57
|
+
readonly type: "uint256";
|
|
58
|
+
}];
|
|
59
|
+
readonly outputs: readonly [{
|
|
60
|
+
readonly name: "";
|
|
61
|
+
readonly type: "uint8";
|
|
62
|
+
}];
|
|
63
|
+
readonly stateMutability: "view";
|
|
64
|
+
}, {
|
|
65
|
+
readonly type: "function";
|
|
66
|
+
readonly name: "getVoteTotals";
|
|
67
|
+
readonly inputs: readonly [{
|
|
68
|
+
readonly name: "proposalId";
|
|
69
|
+
readonly type: "uint256";
|
|
70
|
+
}];
|
|
71
|
+
readonly outputs: readonly [{
|
|
72
|
+
readonly name: "yes";
|
|
73
|
+
readonly type: "uint256";
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "no";
|
|
76
|
+
readonly type: "uint256";
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "abstain";
|
|
79
|
+
readonly type: "uint256";
|
|
80
|
+
}];
|
|
81
|
+
readonly stateMutability: "view";
|
|
82
|
+
}];
|
|
83
|
+
/** On-chain proposal stage enum (Celo Governance). */
|
|
84
|
+
export declare const PROPOSAL_STAGES: readonly ["None", "Queued", "Approval", "Referendum", "Execution", "Executed", "Expiration", "Rejected", "Withdrawn"];
|
|
85
|
+
export type ProposalStageName = (typeof PROPOSAL_STAGES)[number];
|
|
86
|
+
export declare function proposalStageName(stage: number): ProposalStageName;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export const governanceAbi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "getQueue",
|
|
5
|
+
inputs: [],
|
|
6
|
+
outputs: [
|
|
7
|
+
{ name: "", type: "uint256[]" },
|
|
8
|
+
{ name: "", type: "uint256[]" },
|
|
9
|
+
],
|
|
10
|
+
stateMutability: "view",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
type: "function",
|
|
14
|
+
name: "getDequeue",
|
|
15
|
+
inputs: [],
|
|
16
|
+
outputs: [{ name: "", type: "uint256[]" }],
|
|
17
|
+
stateMutability: "view",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: "function",
|
|
21
|
+
name: "getProposal",
|
|
22
|
+
inputs: [{ name: "proposalId", type: "uint256" }],
|
|
23
|
+
outputs: [
|
|
24
|
+
{ name: "proposer", type: "address" },
|
|
25
|
+
{ name: "deposit", type: "uint256" },
|
|
26
|
+
{ name: "timestamp", type: "uint256" },
|
|
27
|
+
{ name: "transactionCount", type: "uint256" },
|
|
28
|
+
{ name: "descriptionURL", type: "string" },
|
|
29
|
+
{ name: "networkWeight", type: "uint256" },
|
|
30
|
+
{ name: "approved", type: "bool" },
|
|
31
|
+
],
|
|
32
|
+
stateMutability: "view",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "function",
|
|
36
|
+
name: "getProposalStage",
|
|
37
|
+
inputs: [{ name: "proposalId", type: "uint256" }],
|
|
38
|
+
outputs: [{ name: "", type: "uint8" }],
|
|
39
|
+
stateMutability: "view",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: "function",
|
|
43
|
+
name: "getVoteTotals",
|
|
44
|
+
inputs: [{ name: "proposalId", type: "uint256" }],
|
|
45
|
+
outputs: [
|
|
46
|
+
{ name: "yes", type: "uint256" },
|
|
47
|
+
{ name: "no", type: "uint256" },
|
|
48
|
+
{ name: "abstain", type: "uint256" },
|
|
49
|
+
],
|
|
50
|
+
stateMutability: "view",
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
/** On-chain proposal stage enum (Celo Governance). */
|
|
54
|
+
export const PROPOSAL_STAGES = [
|
|
55
|
+
"None",
|
|
56
|
+
"Queued",
|
|
57
|
+
"Approval",
|
|
58
|
+
"Referendum",
|
|
59
|
+
"Execution",
|
|
60
|
+
"Executed",
|
|
61
|
+
"Expiration",
|
|
62
|
+
"Rejected",
|
|
63
|
+
"Withdrawn",
|
|
64
|
+
];
|
|
65
|
+
export function proposalStageName(stage) {
|
|
66
|
+
return PROPOSAL_STAGES[stage] ?? "None";
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=governance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governance.js","sourceRoot":"","sources":["../../src/abis/governance.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,EAAE;QACV,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;YAC/B,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EA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AS,EAAE,CAAC;QACjD,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;YAChC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;YAC/B,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SACrC;QACD,eAAe,EAAE,MAAM;KACxB;CACO,CAAC;AAEX,sDAAsD;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM;IACN,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,WAAW;IACX,UAAU;IACV,YAAY;IACZ,UAAU;IACV,WAAW;CACH,CAAC;AAIX,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const lockedGoldAbi: readonly [{
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "getTotalLockedGold";
|
|
4
|
+
readonly inputs: readonly [];
|
|
5
|
+
readonly outputs: readonly [{
|
|
6
|
+
readonly name: "";
|
|
7
|
+
readonly type: "uint256";
|
|
8
|
+
}];
|
|
9
|
+
readonly stateMutability: "view";
|
|
10
|
+
}];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locked-gold.js","sourceRoot":"","sources":["../../src/abis/locked-gold.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,oBAAoB;QAC1B,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACxC,eAAe,EAAE,MAAM;KACxB;CACO,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export declare const erc165Abi: readonly [{
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "supportsInterface";
|
|
4
|
+
readonly inputs: readonly [{
|
|
5
|
+
readonly name: "interfaceId";
|
|
6
|
+
readonly type: "bytes4";
|
|
7
|
+
}];
|
|
8
|
+
readonly outputs: readonly [{
|
|
9
|
+
readonly name: "";
|
|
10
|
+
readonly type: "bool";
|
|
11
|
+
}];
|
|
12
|
+
readonly stateMutability: "view";
|
|
13
|
+
}];
|
|
14
|
+
export declare const erc721Abi: readonly [{
|
|
15
|
+
readonly type: "function";
|
|
16
|
+
readonly name: "name";
|
|
17
|
+
readonly inputs: readonly [];
|
|
18
|
+
readonly outputs: readonly [{
|
|
19
|
+
readonly name: "";
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
}];
|
|
22
|
+
readonly stateMutability: "view";
|
|
23
|
+
}, {
|
|
24
|
+
readonly type: "function";
|
|
25
|
+
readonly name: "symbol";
|
|
26
|
+
readonly inputs: readonly [];
|
|
27
|
+
readonly outputs: readonly [{
|
|
28
|
+
readonly name: "";
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
}];
|
|
31
|
+
readonly stateMutability: "view";
|
|
32
|
+
}, {
|
|
33
|
+
readonly type: "function";
|
|
34
|
+
readonly name: "totalSupply";
|
|
35
|
+
readonly inputs: readonly [];
|
|
36
|
+
readonly outputs: readonly [{
|
|
37
|
+
readonly name: "";
|
|
38
|
+
readonly type: "uint256";
|
|
39
|
+
}];
|
|
40
|
+
readonly stateMutability: "view";
|
|
41
|
+
}, {
|
|
42
|
+
readonly type: "function";
|
|
43
|
+
readonly name: "balanceOf";
|
|
44
|
+
readonly inputs: readonly [{
|
|
45
|
+
readonly name: "owner";
|
|
46
|
+
readonly type: "address";
|
|
47
|
+
}];
|
|
48
|
+
readonly outputs: readonly [{
|
|
49
|
+
readonly name: "";
|
|
50
|
+
readonly type: "uint256";
|
|
51
|
+
}];
|
|
52
|
+
readonly stateMutability: "view";
|
|
53
|
+
}, {
|
|
54
|
+
readonly type: "function";
|
|
55
|
+
readonly name: "ownerOf";
|
|
56
|
+
readonly inputs: readonly [{
|
|
57
|
+
readonly name: "tokenId";
|
|
58
|
+
readonly type: "uint256";
|
|
59
|
+
}];
|
|
60
|
+
readonly outputs: readonly [{
|
|
61
|
+
readonly name: "";
|
|
62
|
+
readonly type: "address";
|
|
63
|
+
}];
|
|
64
|
+
readonly stateMutability: "view";
|
|
65
|
+
}, {
|
|
66
|
+
readonly type: "function";
|
|
67
|
+
readonly name: "tokenURI";
|
|
68
|
+
readonly inputs: readonly [{
|
|
69
|
+
readonly name: "tokenId";
|
|
70
|
+
readonly type: "uint256";
|
|
71
|
+
}];
|
|
72
|
+
readonly outputs: readonly [{
|
|
73
|
+
readonly name: "";
|
|
74
|
+
readonly type: "string";
|
|
75
|
+
}];
|
|
76
|
+
readonly stateMutability: "view";
|
|
77
|
+
}];
|
|
78
|
+
export declare const erc1155Abi: readonly [{
|
|
79
|
+
readonly type: "function";
|
|
80
|
+
readonly name: "balanceOf";
|
|
81
|
+
readonly inputs: readonly [{
|
|
82
|
+
readonly name: "account";
|
|
83
|
+
readonly type: "address";
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "id";
|
|
86
|
+
readonly type: "uint256";
|
|
87
|
+
}];
|
|
88
|
+
readonly outputs: readonly [{
|
|
89
|
+
readonly name: "";
|
|
90
|
+
readonly type: "uint256";
|
|
91
|
+
}];
|
|
92
|
+
readonly stateMutability: "view";
|
|
93
|
+
}, {
|
|
94
|
+
readonly type: "function";
|
|
95
|
+
readonly name: "uri";
|
|
96
|
+
readonly inputs: readonly [{
|
|
97
|
+
readonly name: "id";
|
|
98
|
+
readonly type: "uint256";
|
|
99
|
+
}];
|
|
100
|
+
readonly outputs: readonly [{
|
|
101
|
+
readonly name: "";
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
}];
|
|
104
|
+
readonly stateMutability: "view";
|
|
105
|
+
}];
|
|
106
|
+
export declare const ERC721_INTERFACE_ID: "0x80ac58cd";
|
|
107
|
+
export declare const ERC1155_INTERFACE_ID: "0xd9b67a26";
|