Skip to content

Commit 7a797ab

Browse files
committed
fix types
1 parent 5303502 commit 7a797ab

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

.env.example

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Ethereum related
2-
# Private key with 0x prefix
3-
PRIVATE_KEY=
2+
# Secret (private) key with 0x prefix
3+
SECRET_KEY=
44
# RPC URL (e.g. Alchemy or Infura)
55
RPC_URL=https://base-sepolia.g.alchemy.com/v2/<api-key>
66

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Dria Oracle uses [Viem](https://viem.sh/) to connect with blockchains. It takes
4040
```ts
4141
// wallet client for "write" operations
4242
const walletClient = createWalletClient({
43-
account: privateKeyToAccount(PRIVATE_KEY),
43+
account: privateKeyToAccount(SECRET_KEY),
4444
transport: http(RPC_URL),
4545
chain,
4646
});

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dria-oracle-sdk",
3-
"version": "0.0.3",
3+
"version": "0.0.4",
44
"description": "An on-chain AI oracle SDK for Dria",
55
"license": "MIT",
66
"author": "FirstBatch Team <[email protected]>",
@@ -16,11 +16,14 @@
1616
"type": "module",
1717
"main": "./dist/index.cjs",
1818
"module": "./dist/index.mjs",
19+
"types": "./dist/index.d.cts",
1920
"exports": {
2021
"require": {
22+
"types": "./dist/index.d.cts",
2123
"default": "./dist/index.cjs"
2224
},
2325
"import": {
26+
"types": "./dist/index.d.mts",
2427
"default": "./dist/index.mjs"
2528
}
2629
},

src/client.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ export class Oracle<T extends Transport, C extends Chain, K = unknown> {
9797
return this;
9898
}
9999

100-
/** Returns a new instance of the LLM coordinator contract. */
101-
Coordinator(address: Address) {
100+
/** Returns a new instance of the LLM coordinator contract.
101+
* @warning This is an internal method, and making it `private` will break
102+
* the type export due to the size of ABI-inferred types.
103+
*/
104+
private Coordinator(address: Address) {
102105
return getContract({
103106
address,
104107
abi: coordinatorAbi,
@@ -109,8 +112,11 @@ export class Oracle<T extends Transport, C extends Chain, K = unknown> {
109112
});
110113
}
111114

112-
/** Returns a new instance of an ERC20 token contract. */
113-
Token(address: Address) {
115+
/** Returns a new instance of an ERC20 token contract.
116+
* @warning This is an internal method, and making it `private` will break
117+
* the type export due to the size of ABI-inferred types.
118+
*/
119+
private Token(address: Address) {
114120
return getContract({
115121
address,
116122
abi: erc20Abi,

tests/oracle.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ describe.only("oracle", () => {
1010
let requestTxHash: Hex;
1111

1212
beforeAll(async () => {
13-
const PRIVATE_KEY =
14-
(process.env.PRIVATE_KEY! as Hex) ?? "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; // anvil #0
13+
const SECRET_KEY =
14+
(process.env.SECRET_KEY! as Hex) ?? "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; // anvil #0
1515
const RPC_URL = process.env.RPC_URL ?? "https://base-sepolia-rpc.publicnode.com"; // public URL
1616
const COORDINATOR_ADDRESS =
1717
(process.env.COORDINATOR_ADDRESS as Address) ?? "0x362fDBB20191ba22d53bF3b09646AA387Cd6dF75";
1818

1919
const walletClient = createWalletClient({
20-
account: privateKeyToAccount(PRIVATE_KEY),
20+
account: privateKeyToAccount(SECRET_KEY),
2121
chain: baseSepolia,
2222
transport: http(RPC_URL),
2323
});

0 commit comments

Comments
 (0)