@andrewkimjoseph/celina-sdk 0.1.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 +61 -0
- package/build/abis/aave-pool.d.ts +37 -0
- package/build/abis/aave-pool.js +26 -0
- package/build/abis/aave-pool.js.map +1 -0
- package/build/abis/gooddollar-identity.d.ts +61 -0
- package/build/abis/gooddollar-identity.js +38 -0
- package/build/abis/gooddollar-identity.js.map +1 -0
- package/build/clients/celo-client.d.ts +11 -0
- package/build/clients/celo-client.js +23 -0
- package/build/clients/celo-client.js.map +1 -0
- package/build/clients/ens-client.d.ts +10 -0
- package/build/clients/ens-client.js +23 -0
- package/build/clients/ens-client.js.map +1 -0
- package/build/clients/mento-sdk.d.ts +2 -0
- package/build/clients/mento-sdk.js +9 -0
- package/build/clients/mento-sdk.js.map +1 -0
- package/build/config/aave.d.ts +11 -0
- package/build/config/aave.js +55 -0
- package/build/config/aave.js.map +1 -0
- package/build/config/celina-tag.d.ts +1 -0
- package/build/config/celina-tag.js +3 -0
- package/build/config/celina-tag.js.map +1 -0
- package/build/config/chains.d.ts +935 -0
- package/build/config/chains.js +251 -0
- package/build/config/chains.js.map +1 -0
- package/build/config/gooddollar.d.ts +1 -0
- package/build/config/gooddollar.js +2 -0
- package/build/config/gooddollar.js.map +1 -0
- package/build/config/sdk-config.d.ts +6 -0
- package/build/config/sdk-config.js +8 -0
- package/build/config/sdk-config.js.map +1 -0
- package/build/index.d.ts +26 -0
- package/build/index.js +28 -0
- package/build/index.js.map +1 -0
- package/build/services/aave.service.d.ts +13 -0
- package/build/services/aave.service.js +144 -0
- package/build/services/aave.service.js.map +1 -0
- package/build/services/account.service.d.ts +13 -0
- package/build/services/account.service.js +23 -0
- package/build/services/account.service.js.map +1 -0
- package/build/services/blockchain.service.d.ts +40 -0
- package/build/services/blockchain.service.js +81 -0
- package/build/services/blockchain.service.js.map +1 -0
- package/build/services/ens.service.d.ts +30 -0
- package/build/services/ens.service.js +78 -0
- package/build/services/ens.service.js.map +1 -0
- package/build/services/gooddollar.service.d.ts +38 -0
- package/build/services/gooddollar.service.js +127 -0
- package/build/services/gooddollar.service.js.map +1 -0
- package/build/services/mento-fx.service.d.ts +48 -0
- package/build/services/mento-fx.service.js +234 -0
- package/build/services/mento-fx.service.js.map +1 -0
- package/build/services/token.service.d.ts +54 -0
- package/build/services/token.service.js +147 -0
- package/build/services/token.service.js.map +1 -0
- package/build/services/transaction.service.d.ts +16 -0
- package/build/services/transaction.service.js +93 -0
- package/build/services/transaction.service.js.map +1 -0
- package/build/types/prepared.d.ts +21 -0
- package/build/types/prepared.js +11 -0
- package/build/types/prepared.js.map +1 -0
- package/build/utils/erc20-allowance-storage.d.ts +7 -0
- package/build/utils/erc20-allowance-storage.js +44 -0
- package/build/utils/erc20-allowance-storage.js.map +1 -0
- package/build/utils/format-date.d.ts +1 -0
- package/build/utils/format-date.js +12 -0
- package/build/utils/format-date.js.map +1 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrew Kim Joseph
|
|
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,61 @@
|
|
|
1
|
+
# Celina SDK
|
|
2
|
+
|
|
3
|
+
Celo mainnet library for frontend apps: **reads** and **unsigned transaction preparation** (no private keys).
|
|
4
|
+
|
|
5
|
+
Pair with [wagmi](https://wagmi.sh) / viem in the browser — users sign prepared transactions in their wallet.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i @andrewkimjoseph/celina-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires Node.js ≥ 20.
|
|
14
|
+
|
|
15
|
+
## Quick start
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createCelinaClient } from "@andrewkimjoseph/celina-sdk";
|
|
19
|
+
|
|
20
|
+
const celina = createCelinaClient({
|
|
21
|
+
rpcUrl: "https://forno.celo.org",
|
|
22
|
+
ethRpcUrl: "https://ethereum.publicnode.com", // optional, for ENS
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Reads
|
|
26
|
+
await celina.token.getStablecoinBalances("0xYourAddress");
|
|
27
|
+
await celina.mentoFx.getFxQuote("USDm", "EURm", "100");
|
|
28
|
+
|
|
29
|
+
// Prepare unsigned txs (user signs in wallet)
|
|
30
|
+
const flow = await celina.transaction.prepareSend(
|
|
31
|
+
"0xFrom",
|
|
32
|
+
"0xTo",
|
|
33
|
+
"USDm",
|
|
34
|
+
"10",
|
|
35
|
+
);
|
|
36
|
+
// flow.steps → pass to wagmi sendTransaction
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
| Service | Reads | Prepare (unsigned) |
|
|
42
|
+
|---------|-------|---------------------|
|
|
43
|
+
| `blockchain` | network status, blocks, transactions | — |
|
|
44
|
+
| `account` | CELO balance, nonce | — |
|
|
45
|
+
| `token` | balances, token info, stablecoins | — |
|
|
46
|
+
| `ens` | resolve ENS names | — |
|
|
47
|
+
| `gooddollar` | whitelist status | — |
|
|
48
|
+
| `transaction` | `estimateSend(from, …)` | `prepareSend(from, …)` |
|
|
49
|
+
| `mentoFx` | `getFxQuote`, `estimateFx(from, …)` | `prepareFx(from, …)` |
|
|
50
|
+
| `aave` | — | `prepareSupply(from, …)`, `prepareWithdraw(from, …)` |
|
|
51
|
+
|
|
52
|
+
Prepared flows return `{ preparedFlow: true, steps, summary, from, network }` with JSON-safe `value` strings.
|
|
53
|
+
|
|
54
|
+
## Related packages
|
|
55
|
+
|
|
56
|
+
- [`@andrewkimjoseph/celina-mcp`](https://www.npmjs.com/package/@andrewkimjoseph/celina-mcp) — MCP server for IDE/CLI agents (server-key writes + Self Agent ID)
|
|
57
|
+
- [`@selfxyz/agent-sdk`](https://www.npmjs.com/package/@selfxyz/agent-sdk) — Self Agent ID (separate from this SDK)
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const aavePoolAbi: readonly [{
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "supply";
|
|
4
|
+
readonly inputs: readonly [{
|
|
5
|
+
readonly name: "asset";
|
|
6
|
+
readonly type: "address";
|
|
7
|
+
}, {
|
|
8
|
+
readonly name: "amount";
|
|
9
|
+
readonly type: "uint256";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "onBehalfOf";
|
|
12
|
+
readonly type: "address";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "referralCode";
|
|
15
|
+
readonly type: "uint16";
|
|
16
|
+
}];
|
|
17
|
+
readonly outputs: readonly [];
|
|
18
|
+
readonly stateMutability: "nonpayable";
|
|
19
|
+
}, {
|
|
20
|
+
readonly type: "function";
|
|
21
|
+
readonly name: "withdraw";
|
|
22
|
+
readonly inputs: readonly [{
|
|
23
|
+
readonly name: "asset";
|
|
24
|
+
readonly type: "address";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "amount";
|
|
27
|
+
readonly type: "uint256";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "to";
|
|
30
|
+
readonly type: "address";
|
|
31
|
+
}];
|
|
32
|
+
readonly outputs: readonly [{
|
|
33
|
+
readonly name: "";
|
|
34
|
+
readonly type: "uint256";
|
|
35
|
+
}];
|
|
36
|
+
readonly stateMutability: "nonpayable";
|
|
37
|
+
}];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const aavePoolAbi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "supply",
|
|
5
|
+
inputs: [
|
|
6
|
+
{ name: "asset", type: "address" },
|
|
7
|
+
{ name: "amount", type: "uint256" },
|
|
8
|
+
{ name: "onBehalfOf", type: "address" },
|
|
9
|
+
{ name: "referralCode", type: "uint16" },
|
|
10
|
+
],
|
|
11
|
+
outputs: [],
|
|
12
|
+
stateMutability: "nonpayable",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: "function",
|
|
16
|
+
name: "withdraw",
|
|
17
|
+
inputs: [
|
|
18
|
+
{ name: "asset", type: "address" },
|
|
19
|
+
{ name: "amount", type: "uint256" },
|
|
20
|
+
{ name: "to", type: "address" },
|
|
21
|
+
],
|
|
22
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
23
|
+
stateMutability: "nonpayable",
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
//# sourceMappingURL=aave-pool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aave-pool.js","sourceRoot":"","sources":["../../src/abis/aave-pool.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YAClC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;YACnC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE;YACvC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE;SACzC;QACD,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;KAC9B;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YAClC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;YACnC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;SAChC;QACD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACxC,eAAe,EAAE,YAAY;KAC9B;CACO,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare const goodDollarIdentityAbi: readonly [{
|
|
2
|
+
readonly name: "identities";
|
|
3
|
+
readonly type: "function";
|
|
4
|
+
readonly stateMutability: "view";
|
|
5
|
+
readonly inputs: readonly [{
|
|
6
|
+
readonly name: "account";
|
|
7
|
+
readonly type: "address";
|
|
8
|
+
}];
|
|
9
|
+
readonly outputs: readonly [{
|
|
10
|
+
readonly name: "dateAuthenticated";
|
|
11
|
+
readonly type: "uint256";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "dateAdded";
|
|
14
|
+
readonly type: "uint256";
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "did";
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "whitelistedOnChainId";
|
|
20
|
+
readonly type: "uint256";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "status";
|
|
23
|
+
readonly type: "uint8";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "authCount";
|
|
26
|
+
readonly type: "uint32";
|
|
27
|
+
}];
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "isWhitelisted";
|
|
30
|
+
readonly type: "function";
|
|
31
|
+
readonly stateMutability: "view";
|
|
32
|
+
readonly inputs: readonly [{
|
|
33
|
+
readonly name: "account";
|
|
34
|
+
readonly type: "address";
|
|
35
|
+
}];
|
|
36
|
+
readonly outputs: readonly [{
|
|
37
|
+
readonly name: "";
|
|
38
|
+
readonly type: "bool";
|
|
39
|
+
}];
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "authenticationPeriod";
|
|
42
|
+
readonly type: "function";
|
|
43
|
+
readonly stateMutability: "view";
|
|
44
|
+
readonly inputs: readonly [];
|
|
45
|
+
readonly outputs: readonly [{
|
|
46
|
+
readonly name: "";
|
|
47
|
+
readonly type: "uint256";
|
|
48
|
+
}];
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "reverifyDaysOptions";
|
|
51
|
+
readonly type: "function";
|
|
52
|
+
readonly stateMutability: "view";
|
|
53
|
+
readonly inputs: readonly [{
|
|
54
|
+
readonly name: "";
|
|
55
|
+
readonly type: "uint256";
|
|
56
|
+
}];
|
|
57
|
+
readonly outputs: readonly [{
|
|
58
|
+
readonly name: "";
|
|
59
|
+
readonly type: "uint8";
|
|
60
|
+
}];
|
|
61
|
+
}];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const goodDollarIdentityAbi = [
|
|
2
|
+
{
|
|
3
|
+
name: "identities",
|
|
4
|
+
type: "function",
|
|
5
|
+
stateMutability: "view",
|
|
6
|
+
inputs: [{ name: "account", type: "address" }],
|
|
7
|
+
outputs: [
|
|
8
|
+
{ name: "dateAuthenticated", type: "uint256" },
|
|
9
|
+
{ name: "dateAdded", type: "uint256" },
|
|
10
|
+
{ name: "did", type: "string" },
|
|
11
|
+
{ name: "whitelistedOnChainId", type: "uint256" },
|
|
12
|
+
{ name: "status", type: "uint8" },
|
|
13
|
+
{ name: "authCount", type: "uint32" },
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "isWhitelisted",
|
|
18
|
+
type: "function",
|
|
19
|
+
stateMutability: "view",
|
|
20
|
+
inputs: [{ name: "account", type: "address" }],
|
|
21
|
+
outputs: [{ name: "", type: "bool" }],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "authenticationPeriod",
|
|
25
|
+
type: "function",
|
|
26
|
+
stateMutability: "view",
|
|
27
|
+
inputs: [],
|
|
28
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "reverifyDaysOptions",
|
|
32
|
+
type: "function",
|
|
33
|
+
stateMutability: "view",
|
|
34
|
+
inputs: [{ name: "", type: "uint256" }],
|
|
35
|
+
outputs: [{ name: "", type: "uint8" }],
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
//# sourceMappingURL=gooddollar-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gooddollar-identity.js","sourceRoot":"","sources":["../../src/abis/gooddollar-identity.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC;QACE,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9C,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE;YAC9C,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;YACtC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC/B,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,SAAS,EAAE;YACjD,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE;YACjC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;SACtC;KACF;IACD;QACE,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;KACtC;IACD;QACE,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KACzC;IACD;QACE,IAAI,EAAE,qBAAqB;QAC3B,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;KACvC;CACqB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type PublicClient } from "viem";
|
|
2
|
+
import type { SdkConfig } from "../config/sdk-config.js";
|
|
3
|
+
export interface CeloClients {
|
|
4
|
+
public: PublicClient;
|
|
5
|
+
}
|
|
6
|
+
export declare class CeloClientFactory {
|
|
7
|
+
private readonly config;
|
|
8
|
+
private clients;
|
|
9
|
+
constructor(config: SdkConfig);
|
|
10
|
+
getClients(): CeloClients;
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createPublicClient, http, } from "viem";
|
|
2
|
+
import { CHAIN, DEFAULT_RPC_URL } from "../config/chains.js";
|
|
3
|
+
export class CeloClientFactory {
|
|
4
|
+
config;
|
|
5
|
+
clients = null;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.config = config;
|
|
8
|
+
}
|
|
9
|
+
getClients() {
|
|
10
|
+
if (this.clients) {
|
|
11
|
+
return this.clients;
|
|
12
|
+
}
|
|
13
|
+
const rpcUrl = this.config.rpcUrl ?? DEFAULT_RPC_URL;
|
|
14
|
+
const transport = http(rpcUrl);
|
|
15
|
+
const publicClient = createPublicClient({
|
|
16
|
+
chain: CHAIN,
|
|
17
|
+
transport,
|
|
18
|
+
});
|
|
19
|
+
this.clients = { public: publicClient };
|
|
20
|
+
return this.clients;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=celo-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"celo-client.js","sourceRoot":"","sources":["../../src/clients/celo-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,IAAI,GAEL,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAM7D,MAAM,OAAO,iBAAiB;IAGC;IAFrB,OAAO,GAAuB,IAAI,CAAC;IAE3C,YAA6B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAElD,UAAU;QACR,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,eAAe,CAAC;QACrD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/B,MAAM,YAAY,GAAG,kBAAkB,CAAC;YACtC,KAAK,EAAE,KAAK;YACZ,SAAS;SACV,CAAiB,CAAC;QAEnB,IAAI,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PublicClient } from "viem";
|
|
2
|
+
import type { SdkConfig } from "../config/sdk-config.js";
|
|
3
|
+
export declare const DEFAULT_ETH_RPC_URL = "https://ethereum.publicnode.com";
|
|
4
|
+
export declare const ENS_CCIP_GATEWAY = "https://ccip.ens.xyz";
|
|
5
|
+
export declare class EnsClientFactory {
|
|
6
|
+
private readonly config;
|
|
7
|
+
private client;
|
|
8
|
+
constructor(config: SdkConfig);
|
|
9
|
+
getClient(): PublicClient;
|
|
10
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createPublicClient, http } from "viem";
|
|
2
|
+
import { mainnet } from "viem/chains";
|
|
3
|
+
export const DEFAULT_ETH_RPC_URL = "https://ethereum.publicnode.com";
|
|
4
|
+
export const ENS_CCIP_GATEWAY = "https://ccip.ens.xyz";
|
|
5
|
+
export class EnsClientFactory {
|
|
6
|
+
config;
|
|
7
|
+
client = null;
|
|
8
|
+
constructor(config) {
|
|
9
|
+
this.config = config;
|
|
10
|
+
}
|
|
11
|
+
getClient() {
|
|
12
|
+
if (this.client) {
|
|
13
|
+
return this.client;
|
|
14
|
+
}
|
|
15
|
+
const rpcUrl = this.config.ethRpcUrl ?? DEFAULT_ETH_RPC_URL;
|
|
16
|
+
this.client = createPublicClient({
|
|
17
|
+
chain: mainnet,
|
|
18
|
+
transport: http(rpcUrl, { timeout: 15_000 }),
|
|
19
|
+
});
|
|
20
|
+
return this.client;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ens-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ens-client.js","sourceRoot":"","sources":["../../src/clients/ens-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAqB,MAAM,MAAM,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;AAErE,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEvD,MAAM,OAAO,gBAAgB;IAGE;IAFrB,MAAM,GAAwB,IAAI,CAAC;IAE3C,YAA6B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAElD,SAAS;QACP,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,mBAAmB,CAAC;QAC5D,IAAI,CAAC,MAAM,GAAG,kBAAkB,CAAC;YAC/B,KAAK,EAAE,OAAO;YACd,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;SAC7C,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const Mento: typeof import("@mento-protocol/mento-sdk").Mento, ChainId: typeof import("@mento-protocol/mento-sdk").ChainId, deadlineFromMinutes: typeof import("@mento-protocol/mento-sdk").deadlineFromMinutes, RouteNotFoundError: typeof import("@mento-protocol/mento-sdk").RouteNotFoundError, FXMarketClosedError: typeof import("@mento-protocol/mento-sdk").FXMarketClosedError;
|
|
2
|
+
export type { CallParams } from "@mento-protocol/mento-sdk";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
/**
|
|
3
|
+
* @mento-protocol/mento-sdk's ESM build omits .js extensions on internal imports.
|
|
4
|
+
* Load the CJS entry via createRequire until upstream fixes exports.
|
|
5
|
+
*/
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const mentoSdk = require("@mento-protocol/mento-sdk");
|
|
8
|
+
export const { Mento, ChainId, deadlineFromMinutes, RouteNotFoundError, FXMarketClosedError, } = mentoSdk;
|
|
9
|
+
//# sourceMappingURL=mento-sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mento-sdk.js","sourceRoot":"","sources":["../../src/clients/mento-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;GAGG;AACH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,QAAQ,GAAG,OAAO,CAAC,2BAA2B,CAA+C,CAAC;AAEpG,MAAM,CAAC,MAAM,EACX,KAAK,EACL,OAAO,EACP,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACpB,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Aave V3 on Celo mainnet — from bgd-labs/aave-address-book AaveV3Celo */
|
|
2
|
+
export declare const AAVE_POOL: "0x3E59A31363E2ad014dcbc521c4a0d5757d9f3402";
|
|
3
|
+
export declare const AAVE_CHAIN_ID = 42220;
|
|
4
|
+
export type AaveAsset = {
|
|
5
|
+
symbol: string;
|
|
6
|
+
underlying: `0x${string}`;
|
|
7
|
+
aToken: `0x${string}`;
|
|
8
|
+
};
|
|
9
|
+
export declare const AAVE_ASSETS: Record<string, AaveAsset>;
|
|
10
|
+
export declare const AAVE_SUPPORTED_SYMBOLS: readonly ["USDT", "WETH", "USDm", "USDC", "CELO", "EURm"];
|
|
11
|
+
export declare function resolveAaveAsset(token: string): AaveAsset;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { findKnownToken } from "./chains.js";
|
|
2
|
+
/** Aave V3 on Celo mainnet — from bgd-labs/aave-address-book AaveV3Celo */
|
|
3
|
+
export const AAVE_POOL = "0x3E59A31363E2ad014dcbc521c4a0d5757d9f3402";
|
|
4
|
+
export const AAVE_CHAIN_ID = 42220;
|
|
5
|
+
export const AAVE_ASSETS = {
|
|
6
|
+
USDT: {
|
|
7
|
+
symbol: "USDT",
|
|
8
|
+
underlying: "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e",
|
|
9
|
+
aToken: "0xDeE98402A302e4D707fB9bf2bac66fAEEc31e8Df",
|
|
10
|
+
},
|
|
11
|
+
WETH: {
|
|
12
|
+
symbol: "WETH",
|
|
13
|
+
underlying: "0xD221812de1BD094f35587EE8E174B07B6167D9Af",
|
|
14
|
+
aToken: "0xf385280F36e009C157697D25E0B802EfaBfd789c",
|
|
15
|
+
},
|
|
16
|
+
USDm: {
|
|
17
|
+
symbol: "USDm",
|
|
18
|
+
underlying: "0x765DE816845861e75A25fCA122bb6898B8B1282a",
|
|
19
|
+
aToken: "0xBba98352628B0B0c4b40583F593fFCb630935a45",
|
|
20
|
+
},
|
|
21
|
+
USDC: {
|
|
22
|
+
symbol: "USDC",
|
|
23
|
+
underlying: "0xcebA9300f2b948710d2653dD7B07f33A8B32118C",
|
|
24
|
+
aToken: "0xFF8309b9e99bfd2D4021bc71a362aBD93dBd4785",
|
|
25
|
+
},
|
|
26
|
+
CELO: {
|
|
27
|
+
symbol: "CELO",
|
|
28
|
+
underlying: "0x471EcE3750Da237f93B8E339c536989b8978a438",
|
|
29
|
+
aToken: "0xC3e77dC389537Db1EEc7C33B95Cf3beECA71A209",
|
|
30
|
+
},
|
|
31
|
+
EURm: {
|
|
32
|
+
symbol: "EURm",
|
|
33
|
+
underlying: "0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73",
|
|
34
|
+
aToken: "0x34c02571094e08E935B8cf8dC10F1Ad6795f1f81",
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const AAVE_SUPPORTED_SYMBOLS = [
|
|
38
|
+
"USDT",
|
|
39
|
+
"WETH",
|
|
40
|
+
"USDm",
|
|
41
|
+
"USDC",
|
|
42
|
+
"CELO",
|
|
43
|
+
"EURm",
|
|
44
|
+
];
|
|
45
|
+
export function resolveAaveAsset(token) {
|
|
46
|
+
const normalized = token.trim();
|
|
47
|
+
const known = findKnownToken(normalized);
|
|
48
|
+
const symbol = known?.symbol ?? normalized.toUpperCase();
|
|
49
|
+
const asset = AAVE_ASSETS[symbol];
|
|
50
|
+
if (!asset) {
|
|
51
|
+
throw new Error(`Token "${token}" is not supported on Aave V3 Celo. Supported: ${AAVE_SUPPORTED_SYMBOLS.join(", ")}.`);
|
|
52
|
+
}
|
|
53
|
+
return asset;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=aave.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aave.js","sourceRoot":"","sources":["../../src/config/aave.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,2EAA2E;AAC3E,MAAM,CAAC,MAAM,SAAS,GAAG,4CAAqD,CAAC;AAC/E,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC;AAQnC,MAAM,CAAC,MAAM,WAAW,GAA8B;IACpD,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,4CAA4C;QACxD,MAAM,EAAE,4CAA4C;KACrD;IACD,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,4CAA4C;QACxD,MAAM,EAAE,4CAA4C;KACrD;IACD,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,4CAA4C;QACxD,MAAM,EAAE,4CAA4C;KACrD;IACD,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,4CAA4C;QACxD,MAAM,EAAE,4CAA4C;KACrD;IACD,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,4CAA4C;QACxD,MAAM,EAAE,4CAA4C;KACrD;IACD,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,4CAA4C;QACxD,MAAM,EAAE,4CAA4C;KACrD;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;CACE,CAAC;AAEX,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,KAAK,EAAE,MAAM,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;IAEzD,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,UAAU,KAAK,kDAAkD,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACtG,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CELINA_DATA_SUFFIX: `0x${string}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"celina-tag.js","sourceRoot":"","sources":["../../src/config/celina-tag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC"}
|