@reflectmoney/oracle.ts 2.1.1 → 2.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/dist/index.d.ts +5 -1
- package/dist/index.js +29 -1
- package/package.json +9 -2
package/dist/index.d.ts
CHANGED
@@ -77,10 +77,14 @@ export declare class Doppler {
|
|
77
77
|
* Deserialize oracle data from a buffer
|
78
78
|
*/
|
79
79
|
deserializeOracle<T>(data: Buffer, serializer: PayloadSerializer<T>): Oracle<T>;
|
80
|
+
/**
|
81
|
+
* Create an oracle account from a keypair
|
82
|
+
*/
|
83
|
+
createOracleAccount<T>(oracleKeypair: Keypair, serializer: PayloadSerializer<T>): Promise<PublicKey>;
|
80
84
|
/**
|
81
85
|
* Create an oracle account with a seed
|
82
86
|
*/
|
83
|
-
|
87
|
+
createOracleAccountWithSeed<T>(seed: string, serializer: PayloadSerializer<T>): Promise<PublicKey>;
|
84
88
|
/**
|
85
89
|
* Update a single oracle account
|
86
90
|
*/
|
package/dist/index.js
CHANGED
@@ -211,10 +211,38 @@ class Doppler {
|
|
211
211
|
const payload = serializer.deserialize(payloadBuffer);
|
212
212
|
return { slot, payload };
|
213
213
|
}
|
214
|
+
/**
|
215
|
+
* Create an oracle account from a keypair
|
216
|
+
*/
|
217
|
+
createOracleAccount(oracleKeypair, serializer) {
|
218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
219
|
+
const oracleSize = 8 + serializer.size();
|
220
|
+
const lamports = yield this.connection.getMinimumBalanceForRentExemption(oracleSize);
|
221
|
+
const createAccountInstruction = web3_js_1.SystemProgram.createAccount({
|
222
|
+
fromPubkey: this.admin.publicKey,
|
223
|
+
newAccountPubkey: oracleKeypair.publicKey,
|
224
|
+
lamports,
|
225
|
+
space: oracleSize,
|
226
|
+
programId: exports.DOPPLER_PROGRAM_ID,
|
227
|
+
});
|
228
|
+
const recentBlockhash = yield this.connection.getLatestBlockhash();
|
229
|
+
const transaction = new web3_js_1.Transaction({
|
230
|
+
feePayer: this.admin.publicKey,
|
231
|
+
recentBlockhash: recentBlockhash.blockhash,
|
232
|
+
});
|
233
|
+
transaction.add(createAccountInstruction);
|
234
|
+
transaction.sign(this.admin, oracleKeypair);
|
235
|
+
yield (0, web3_js_1.sendAndConfirmTransaction)(this.connection, transaction, [
|
236
|
+
this.admin,
|
237
|
+
oracleKeypair,
|
238
|
+
]);
|
239
|
+
return oracleKeypair.publicKey;
|
240
|
+
});
|
241
|
+
}
|
214
242
|
/**
|
215
243
|
* Create an oracle account with a seed
|
216
244
|
*/
|
217
|
-
|
245
|
+
createOracleAccountWithSeed(seed, serializer) {
|
218
246
|
return __awaiter(this, void 0, void 0, function* () {
|
219
247
|
const oracleSize = 8 + serializer.size();
|
220
248
|
const lamports = yield this.connection.getMinimumBalanceForRentExemption(oracleSize);
|
package/package.json
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
{
|
2
2
|
"name": "@reflectmoney/oracle.ts",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.2.0",
|
4
4
|
"type": "commonjs",
|
5
5
|
"author": "L0STE, stablecoinjesus @ Palindrome Engineering",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
8
8
|
"url": "https://github.com/palindrome-eng/doppler.git"
|
9
9
|
},
|
10
|
+
"scripts": {
|
11
|
+
"cli": "tsx src/cli.ts",
|
12
|
+
"build": "tsc"
|
13
|
+
},
|
10
14
|
"dependencies": {
|
11
15
|
"@solana-program/compute-budget": "^0.9.0",
|
12
16
|
"@solana-program/token": "^0.6.0",
|
@@ -20,10 +24,13 @@
|
|
20
24
|
"@types/bn.js": "5.1.6",
|
21
25
|
"@types/chai": "^4.3.11",
|
22
26
|
"@types/mocha": "^10.0.6",
|
27
|
+
"@types/node": "^24.7.2",
|
23
28
|
"bs58": "^6.0.0",
|
24
29
|
"chai": "^4.3.10",
|
30
|
+
"commander": "^14.0.1",
|
25
31
|
"mocha": "^10.2.0",
|
26
|
-
"ts-node": "^10.9.2"
|
32
|
+
"ts-node": "^10.9.2",
|
33
|
+
"tsx": "^4.20.6"
|
27
34
|
},
|
28
35
|
"license": "MIT",
|
29
36
|
"main": "./dist/index.js",
|