@magicblock-labs/ephemeral-rollups-sdk 0.3.3 → 0.3.6
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/lib/__test__/magic-router.test.d.ts.map +1 -0
- package/lib/__test__/magic-router.test.js +109 -0
- package/lib/__test__/magic-router.test.js.map +1 -0
- package/lib/instructions/delegate.d.ts +1 -1
- package/lib/instructions/delegate.d.ts.map +1 -1
- package/lib/instructions/delegate.js +9 -2
- package/lib/instructions/delegate.js.map +1 -1
- package/lib/magic-router.d.ts +16 -2
- package/lib/magic-router.d.ts.map +1 -1
- package/lib/magic-router.js +88 -86
- package/lib/magic-router.js.map +1 -1
- package/package.json +4 -5
- package/lib/__tests__/magic-router.test.d.ts.map +0 -1
- package/lib/__tests__/magic-router.test.js +0 -116
- package/lib/__tests__/magic-router.test.js.map +0 -1
- /package/lib/{__tests__ → __test__}/magic-router.test.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magic-router.test.d.ts","sourceRoot":"","sources":["../../src/__test__/magic-router.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const magic_router_js_1 = require("../magic-router.js");
|
|
5
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
6
|
+
global.fetch = vitest_1.vi.fn();
|
|
7
|
+
(0, vitest_1.describe)("getWritableAccounts", () => {
|
|
8
|
+
const mockPublicKey = (address) => ({
|
|
9
|
+
toBase58: () => address,
|
|
10
|
+
toString: () => address,
|
|
11
|
+
});
|
|
12
|
+
(0, vitest_1.it)("deduplicates writable accounts", () => {
|
|
13
|
+
const tx = {
|
|
14
|
+
feePayer: mockPublicKey("fee-payer"),
|
|
15
|
+
instructions: [
|
|
16
|
+
{
|
|
17
|
+
keys: [
|
|
18
|
+
{ pubkey: mockPublicKey("k1"), isWritable: true },
|
|
19
|
+
{ pubkey: mockPublicKey("k1"), isWritable: true },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
const result = (0, magic_router_js_1.getWritableAccounts)(tx);
|
|
25
|
+
(0, vitest_1.expect)(result).toEqual(["fee-payer", "k1"]);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
(0, vitest_1.describe)("Connection prototype methods", () => {
|
|
29
|
+
let connection;
|
|
30
|
+
let tx;
|
|
31
|
+
(0, vitest_1.beforeEach)(() => {
|
|
32
|
+
connection = new magic_router_js_1.ConnectionMagicRouter("http://localhost");
|
|
33
|
+
tx = new web3_js_1.Transaction();
|
|
34
|
+
tx.serialize = vitest_1.vi.fn(() => Buffer.from("mock"));
|
|
35
|
+
tx.sign = vitest_1.vi.fn();
|
|
36
|
+
global.fetch.mockReset();
|
|
37
|
+
});
|
|
38
|
+
(0, vitest_1.it)("getClosestValidator returns identity", async () => {
|
|
39
|
+
global.fetch.mockResolvedValueOnce({
|
|
40
|
+
json: async () => ({ result: { identity: "validator-1" } }),
|
|
41
|
+
});
|
|
42
|
+
const result = await connection.getClosestValidator();
|
|
43
|
+
(0, vitest_1.expect)(result).toEqual({ identity: "validator-1" });
|
|
44
|
+
});
|
|
45
|
+
(0, vitest_1.it)("getDelegationStatus works with string account", async () => {
|
|
46
|
+
global.fetch.mockResolvedValueOnce({
|
|
47
|
+
json: async () => ({ result: { isDelegated: true } }),
|
|
48
|
+
});
|
|
49
|
+
const result = await connection.getDelegationStatus("account1");
|
|
50
|
+
(0, vitest_1.expect)(result).toEqual({ isDelegated: true });
|
|
51
|
+
});
|
|
52
|
+
(0, vitest_1.it)("getDelegationStatus works with PublicKey account", async () => {
|
|
53
|
+
global.fetch.mockResolvedValueOnce({
|
|
54
|
+
json: async () => ({ result: { isDelegated: false } }),
|
|
55
|
+
});
|
|
56
|
+
const pk = new web3_js_1.PublicKey("11111111111111111111111111111111");
|
|
57
|
+
const result = await connection.getDelegationStatus(pk);
|
|
58
|
+
(0, vitest_1.expect)(result).toEqual({ isDelegated: false });
|
|
59
|
+
});
|
|
60
|
+
(0, vitest_1.it)("getLatestBlockhashForTransaction returns blockhash", async () => {
|
|
61
|
+
global.fetch.mockResolvedValueOnce({
|
|
62
|
+
json: async () => ({
|
|
63
|
+
result: { blockhash: "mock-blockhash", lastValidBlockHeight: 100 },
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
const result = await connection.getLatestBlockhashForTransaction(tx);
|
|
67
|
+
(0, vitest_1.expect)(result).toEqual({
|
|
68
|
+
blockhash: "mock-blockhash",
|
|
69
|
+
lastValidBlockHeight: 100,
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
(0, vitest_1.it)("prepareTransaction sets recentBlockhash", async () => {
|
|
73
|
+
vitest_1.vi.spyOn(magic_router_js_1.ConnectionMagicRouter.prototype, "getLatestBlockhashForTransaction").mockResolvedValue({
|
|
74
|
+
blockhash: "hb",
|
|
75
|
+
lastValidBlockHeight: 100,
|
|
76
|
+
});
|
|
77
|
+
const result = await connection.prepareTransaction(tx);
|
|
78
|
+
(0, vitest_1.expect)(result.recentBlockhash).toBe("hb");
|
|
79
|
+
});
|
|
80
|
+
(0, vitest_1.it)("sendTransaction signs and sends transaction", async () => {
|
|
81
|
+
vitest_1.vi.spyOn(magic_router_js_1.ConnectionMagicRouter.prototype, "getLatestBlockhashForTransaction").mockResolvedValue({
|
|
82
|
+
blockhash: "hb",
|
|
83
|
+
lastValidBlockHeight: 100,
|
|
84
|
+
});
|
|
85
|
+
vitest_1.vi.spyOn(magic_router_js_1.ConnectionMagicRouter.prototype, "sendRawTransaction").mockResolvedValue("sig123");
|
|
86
|
+
const signers = [new web3_js_1.Keypair()];
|
|
87
|
+
const sendTx = connection.sendTransaction.bind(connection);
|
|
88
|
+
const signature = await sendTx(tx, signers);
|
|
89
|
+
const signFn = tx.sign.bind(tx);
|
|
90
|
+
const serializeFn = tx.serialize.bind(tx);
|
|
91
|
+
(0, vitest_1.expect)(signFn(...signers)).toBeUndefined();
|
|
92
|
+
(0, vitest_1.expect)(serializeFn()).toBeInstanceOf(Buffer);
|
|
93
|
+
(0, vitest_1.expect)(signature).toBe("sig123");
|
|
94
|
+
});
|
|
95
|
+
(0, vitest_1.it)("sendAndConfirmTransaction calls sendTransaction and returns signature", async () => {
|
|
96
|
+
vitest_1.vi.spyOn(magic_router_js_1.ConnectionMagicRouter.prototype, "sendTransaction").mockResolvedValue("sig123");
|
|
97
|
+
vitest_1.vi.spyOn(magic_router_js_1.ConnectionMagicRouter.prototype, "confirmTransaction").mockResolvedValue({ value: { err: null } });
|
|
98
|
+
const signature = await (0, web3_js_1.sendAndConfirmTransaction)(connection, tx, [
|
|
99
|
+
new web3_js_1.Keypair(),
|
|
100
|
+
]);
|
|
101
|
+
(0, vitest_1.expect)(signature).toBe("sig123");
|
|
102
|
+
});
|
|
103
|
+
(0, vitest_1.it)("sendAndConfirmTransaction throws SendTransactionError if status has err", async () => {
|
|
104
|
+
vitest_1.vi.spyOn(magic_router_js_1.ConnectionMagicRouter.prototype, "sendTransaction").mockResolvedValue("sig123");
|
|
105
|
+
vitest_1.vi.spyOn(magic_router_js_1.ConnectionMagicRouter.prototype, "confirmTransaction").mockResolvedValue({ value: { err: { some: "error" } } });
|
|
106
|
+
await (0, vitest_1.expect)((0, web3_js_1.sendAndConfirmTransaction)(connection, tx, [new web3_js_1.Keypair()])).rejects.toThrow(web3_js_1.SendTransactionError);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=magic-router.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magic-router.test.js","sourceRoot":"","sources":["../../src/__test__/magic-router.test.ts"],"names":[],"mappings":";;AAAA,mCAA8D;AAC9D,wDAAgF;AAChF,6CAMyB;AAGzB,MAAM,CAAC,KAAK,GAAG,WAAE,CAAC,EAAE,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AAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,yEAAyE,EAAE,KAAK,IAAI,EAAE;QACvF,WAAE,CAAC,KAAK,CACN,uCAAqB,CAAC,SAAgB,EACtC,iBAAiB,CAClB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC9B,WAAE,CAAC,KAAK,CACN,uCAAqB,CAAC,SAAgB,EACtC,oBAAoB,CACrB,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAE3D,MAAM,IAAA,eAAM,EACV,IAAA,mCAAyB,EAAC,UAAU,EAAE,EAAE,EAAE,CAAC,IAAI,iBAAO,EAAE,CAAC,CAAC,CAC3D,CAAC,OAAO,CAAC,OAAO,CAAC,8BAAoB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -10,7 +10,6 @@ export declare const delegateInstructionDiscriminator: number[];
|
|
|
10
10
|
interface DelegateAccountArgs {
|
|
11
11
|
commit_frequency_ms: number;
|
|
12
12
|
seeds: Uint8Array[][];
|
|
13
|
-
validator?: web3.PublicKey;
|
|
14
13
|
}
|
|
15
14
|
export declare function createDelegateInstruction(accounts: {
|
|
16
15
|
payer: web3.PublicKey;
|
|
@@ -19,6 +18,7 @@ export declare function createDelegateInstruction(accounts: {
|
|
|
19
18
|
delegationRecord?: web3.PublicKey;
|
|
20
19
|
delegationMetadata?: web3.PublicKey;
|
|
21
20
|
systemProgram?: web3.PublicKey;
|
|
21
|
+
validator?: web3.PublicKey;
|
|
22
22
|
}, args?: DelegateAccountArgs, programId?: web3.PublicKey): web3.TransactionInstruction;
|
|
23
23
|
export {};
|
|
24
24
|
//# sourceMappingURL=delegate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate.d.ts","sourceRoot":"","sources":["../../src/instructions/delegate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAC;AAClD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAQxC,eAAO,MAAM,cAAc;8BACC,MAAM,EAAE;yBACb,IAAI,CAAC,MAAM;WACzB,MAAM,EAAE,EAAE;gBACL,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;EASrC,CAAC;AACF,eAAO,MAAM,gCAAgC,UAA2B,CAAC;AAGzE,UAAU,mBAAmB;IAC3B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"delegate.d.ts","sourceRoot":"","sources":["../../src/instructions/delegate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAC;AAClD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAQxC,eAAO,MAAM,cAAc;8BACC,MAAM,EAAE;yBACb,IAAI,CAAC,MAAM;WACzB,MAAM,EAAE,EAAE;gBACL,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;EASrC,CAAC;AACF,eAAO,MAAM,gCAAgC,UAA2B,CAAC;AAGzE,UAAU,mBAAmB;IAC3B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC;CACvB;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE;IACR,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC;IACjC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;IAC7B,gBAAgB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;IAClC,kBAAkB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;IACpC,aAAa,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;CAC5B,EACD,IAAI,CAAC,EAAE,mBAAmB,EAC1B,SAAS,iBAAwB,+BAmElC"}
|
|
@@ -53,7 +53,6 @@ function createDelegateInstruction(accounts, args, programId = constants_1.DELEG
|
|
|
53
53
|
args = args ?? {
|
|
54
54
|
commit_frequency_ms: 4294967295,
|
|
55
55
|
seeds: [],
|
|
56
|
-
validator: undefined,
|
|
57
56
|
};
|
|
58
57
|
const keys = [
|
|
59
58
|
{ pubkey: accounts.payer, isWritable: false, isSigner: true },
|
|
@@ -79,12 +78,20 @@ function createDelegateInstruction(accounts, args, programId = constants_1.DELEG
|
|
|
79
78
|
isWritable: false,
|
|
80
79
|
isSigner: false,
|
|
81
80
|
},
|
|
81
|
+
...(accounts.validator
|
|
82
|
+
? [
|
|
83
|
+
{
|
|
84
|
+
pubkey: accounts.validator,
|
|
85
|
+
isWritable: false,
|
|
86
|
+
isSigner: false,
|
|
87
|
+
},
|
|
88
|
+
]
|
|
89
|
+
: []),
|
|
82
90
|
];
|
|
83
91
|
const [data] = exports.delegateStruct.serialize({
|
|
84
92
|
instructionDiscriminator: exports.delegateInstructionDiscriminator,
|
|
85
93
|
commit_frequency_ms: args.commit_frequency_ms,
|
|
86
94
|
seeds: args.seeds.map((seed) => seed.map(Number)),
|
|
87
|
-
validator: args.validator ? args.validator.toBytes() : undefined,
|
|
88
95
|
});
|
|
89
96
|
return new web3.TransactionInstruction({
|
|
90
97
|
programId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate.js","sourceRoot":"","sources":["../../src/instructions/delegate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"delegate.js","sourceRoot":"","sources":["../../src/instructions/delegate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,8DA8EC;AA7GD,gEAAkD;AAClD,sDAAwC;AACxC,4C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18 @@
|
|
|
1
|
-
import { Connection, Transaction } from "@solana/web3.js";
|
|
1
|
+
import { Connection, Transaction, ConfirmOptions, TransactionSignature, Signer, BlockhashWithExpiryBlockHeight, SendOptions, PublicKey, VersionedTransaction } from "@solana/web3.js";
|
|
2
2
|
export declare function getWritableAccounts(transaction: Transaction): string[];
|
|
3
|
-
export
|
|
3
|
+
export declare class ConnectionMagicRouter extends Connection {
|
|
4
|
+
getClosestValidator(): Promise<{
|
|
5
|
+
identity: string;
|
|
6
|
+
fqdn?: string;
|
|
7
|
+
}>;
|
|
8
|
+
getDelegationStatus(account: PublicKey | string): Promise<{
|
|
9
|
+
isDelegated: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
getLatestBlockhashForTransaction(transaction: Transaction, options?: ConfirmOptions): Promise<BlockhashWithExpiryBlockHeight>;
|
|
12
|
+
prepareTransaction(transaction: Transaction, options?: ConfirmOptions): Promise<Transaction>;
|
|
13
|
+
sendTransaction(transaction: Transaction | VersionedTransaction, signersOrOptions?: Signer[] | SendOptions, options?: SendOptions): Promise<TransactionSignature>;
|
|
14
|
+
sendAndConfirmTransaction(transaction: Transaction, signers: Signer[], options?: ConfirmOptions & {
|
|
15
|
+
abortSignal?: AbortSignal;
|
|
16
|
+
}): Promise<TransactionSignature>;
|
|
17
|
+
}
|
|
4
18
|
//# sourceMappingURL=magic-router.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"magic-router.d.ts","sourceRoot":"","sources":["../src/magic-router.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,WAAW,
|
|
1
|
+
{"version":3,"file":"magic-router.d.ts","sourceRoot":"","sources":["../src/magic-router.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,MAAM,EACN,8BAA8B,EAC9B,WAAW,EACX,SAAS,EAET,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAOzB,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,YAgB3D;AAKD,qBAAa,qBAAsB,SAAQ,UAAU;IAK7C,mBAAmB,IAAI,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAwBnE,mBAAmB,CACvB,OAAO,EAAE,SAAS,GAAG,MAAM,GAC1B,OAAO,CAAC;QAAE,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC;IAwB9B,gCAAgC,CACpC,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,8BAA8B,CAAC;IAwBpC,kBAAkB,CACtB,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC;IAiBjB,eAAe,CACnB,WAAW,EAAE,WAAW,GAAG,oBAAoB,EAC/C,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAAG,WAAW,EACzC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,oBAAoB,CAAC;IAiC1B,yBAAyB,CAC7B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,CAAC,EAAE,cAAc,GAAG;QAAE,WAAW,CAAC,EAAE,WAAW,CAAA;KAAE,GACvD,OAAO,CAAC,oBAAoB,CAAC;CAoDjC"}
|
package/lib/magic-router.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ConnectionMagicRouter = void 0;
|
|
4
4
|
exports.getWritableAccounts = getWritableAccounts;
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
|
-
Object.defineProperty(exports, "Connection", { enumerable: true, get: function () { return web3_js_1.Connection; } });
|
|
7
6
|
function getWritableAccounts(transaction) {
|
|
8
7
|
const writableAccounts = new Set();
|
|
9
8
|
if (transaction.feePayer) {
|
|
@@ -18,39 +17,39 @@ function getWritableAccounts(transaction) {
|
|
|
18
17
|
}
|
|
19
18
|
return Array.from(writableAccounts);
|
|
20
19
|
}
|
|
21
|
-
web3_js_1.Connection
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
class ConnectionMagicRouter extends web3_js_1.Connection {
|
|
21
|
+
async getClosestValidator() {
|
|
22
|
+
const response = await fetch(this.rpcEndpoint, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers: { "Content-Type": "application/json" },
|
|
25
|
+
body: JSON.stringify({
|
|
26
|
+
jsonrpc: "2.0",
|
|
27
|
+
id: 1,
|
|
28
|
+
method: "getIdentity",
|
|
29
|
+
params: [],
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
const identityData = (await response.json())?.result;
|
|
33
|
+
if (identityData === null || identityData.identity === undefined) {
|
|
34
|
+
throw new Error("Invalid response");
|
|
35
|
+
}
|
|
36
|
+
return identityData;
|
|
37
|
+
}
|
|
38
|
+
async getDelegationStatus(account) {
|
|
39
|
+
const accountAddress = typeof account === "string" ? account : account.toBase58();
|
|
40
|
+
const response = await fetch(`${this.rpcEndpoint}/getDelegationStatus`, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
headers: { "Content-Type": "application/json" },
|
|
43
|
+
body: JSON.stringify({
|
|
44
|
+
jsonrpc: "2.0",
|
|
45
|
+
id: 1,
|
|
46
|
+
method: "getDelegationStatus",
|
|
47
|
+
params: [accountAddress],
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
return (await response.json()).result;
|
|
35
51
|
}
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
web3_js_1.Connection.prototype.getDelegationStatus = async function (account) {
|
|
39
|
-
const accountAddress = typeof account === "string" ? account : account.toBase58();
|
|
40
|
-
const response = await fetch(`${this.rpcEndpoint}/getDelegationStatus`, {
|
|
41
|
-
method: "POST",
|
|
42
|
-
headers: { "Content-Type": "application/json" },
|
|
43
|
-
body: JSON.stringify({
|
|
44
|
-
jsonrpc: "2.0",
|
|
45
|
-
id: 1,
|
|
46
|
-
method: "getDelegationStatus",
|
|
47
|
-
params: [accountAddress],
|
|
48
|
-
}),
|
|
49
|
-
});
|
|
50
|
-
return (await response.json()).result;
|
|
51
|
-
};
|
|
52
|
-
web3_js_1.Connection.prototype.getLatestBlockhashForTransaction =
|
|
53
|
-
async function (transaction, options) {
|
|
52
|
+
async getLatestBlockhashForTransaction(transaction, options) {
|
|
54
53
|
const writableAccounts = getWritableAccounts(transaction);
|
|
55
54
|
const blockHashResponse = await fetch(this.rpcEndpoint, {
|
|
56
55
|
method: "POST",
|
|
@@ -64,60 +63,63 @@ web3_js_1.Connection.prototype.getLatestBlockhashForTransaction =
|
|
|
64
63
|
});
|
|
65
64
|
const blockHashData = await blockHashResponse.json();
|
|
66
65
|
return blockHashData.result;
|
|
67
|
-
};
|
|
68
|
-
web3_js_1.Connection.prototype.prepareTransaction = async function (transaction, options) {
|
|
69
|
-
const blockHashData = await this.getLatestBlockhashForTransaction(transaction, options);
|
|
70
|
-
transaction.recentBlockhash = blockHashData.blockhash;
|
|
71
|
-
return transaction;
|
|
72
|
-
};
|
|
73
|
-
web3_js_1.Connection.prototype.sendTransaction = async function (transaction, signersOrOptions, options) {
|
|
74
|
-
const sendOpts = Array.isArray(signersOrOptions)
|
|
75
|
-
? (options ?? undefined)
|
|
76
|
-
: (signersOrOptions ?? undefined);
|
|
77
|
-
const latestBlockhash = await this.getLatestBlockhashForTransaction(transaction, sendOpts);
|
|
78
|
-
transaction.recentBlockhash = latestBlockhash.blockhash;
|
|
79
|
-
transaction.lastValidBlockHeight =
|
|
80
|
-
latestBlockhash.lastValidBlockHeight;
|
|
81
|
-
if (Array.isArray(signersOrOptions)) {
|
|
82
|
-
transaction.sign(...signersOrOptions);
|
|
83
|
-
}
|
|
84
|
-
const wireTransaction = transaction.serialize();
|
|
85
|
-
return this.sendRawTransaction(wireTransaction, sendOpts);
|
|
86
|
-
};
|
|
87
|
-
web3_js_1.Connection.prototype.sendAndConfirmTransaction = async function (transaction, signers, options) {
|
|
88
|
-
const signature = await this.sendTransaction(transaction, signers, options);
|
|
89
|
-
let status;
|
|
90
|
-
const { recentBlockhash, lastValidBlockHeight, minNonceContextSlot, nonceInfo, } = transaction;
|
|
91
|
-
if (recentBlockhash !== undefined && lastValidBlockHeight !== undefined) {
|
|
92
|
-
status = (await this.confirmTransaction({
|
|
93
|
-
abortSignal: options?.abortSignal,
|
|
94
|
-
signature,
|
|
95
|
-
blockhash: recentBlockhash,
|
|
96
|
-
lastValidBlockHeight,
|
|
97
|
-
}, options?.commitment)).value;
|
|
98
66
|
}
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
abortSignal: options?.abortSignal,
|
|
104
|
-
minContextSlot: minNonceContextSlot,
|
|
105
|
-
nonceAccountPubkey,
|
|
106
|
-
nonceValue: nonceInfo.nonce,
|
|
107
|
-
signature,
|
|
108
|
-
}, options?.commitment)).value;
|
|
67
|
+
async prepareTransaction(transaction, options) {
|
|
68
|
+
const blockHashData = await this.getLatestBlockhashForTransaction(transaction, options);
|
|
69
|
+
transaction.recentBlockhash = blockHashData.blockhash;
|
|
70
|
+
return transaction;
|
|
109
71
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
.
|
|
72
|
+
async sendTransaction(transaction, signersOrOptions, options) {
|
|
73
|
+
if (transaction instanceof web3_js_1.Transaction) {
|
|
74
|
+
const latestBlockhash = await this.getLatestBlockhashForTransaction(transaction);
|
|
75
|
+
transaction.recentBlockhash = latestBlockhash.blockhash;
|
|
76
|
+
transaction.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight;
|
|
77
|
+
if (Array.isArray(signersOrOptions)) {
|
|
78
|
+
transaction.sign(...signersOrOptions);
|
|
79
|
+
}
|
|
80
|
+
const wireTx = transaction.serialize();
|
|
81
|
+
return this.sendRawTransaction(wireTx, options);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return super.sendTransaction(transaction, signersOrOptions);
|
|
85
|
+
}
|
|
113
86
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
87
|
+
async sendAndConfirmTransaction(transaction, signers, options) {
|
|
88
|
+
const signature = await this.sendTransaction(transaction, signers, options);
|
|
89
|
+
let status;
|
|
90
|
+
const { recentBlockhash, lastValidBlockHeight, minNonceContextSlot, nonceInfo, } = transaction;
|
|
91
|
+
if (recentBlockhash !== undefined && lastValidBlockHeight !== undefined) {
|
|
92
|
+
status = (await this.confirmTransaction({
|
|
93
|
+
abortSignal: options?.abortSignal,
|
|
94
|
+
signature,
|
|
95
|
+
blockhash: recentBlockhash,
|
|
96
|
+
lastValidBlockHeight,
|
|
97
|
+
}, options?.commitment)).value;
|
|
98
|
+
}
|
|
99
|
+
else if (minNonceContextSlot !== undefined && nonceInfo !== undefined) {
|
|
100
|
+
const { nonceInstruction } = nonceInfo;
|
|
101
|
+
const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
|
|
102
|
+
status = (await this.confirmTransaction({
|
|
103
|
+
abortSignal: options?.abortSignal,
|
|
104
|
+
minContextSlot: minNonceContextSlot,
|
|
105
|
+
nonceAccountPubkey,
|
|
106
|
+
nonceValue: nonceInfo.nonce,
|
|
107
|
+
signature,
|
|
108
|
+
}, options?.commitment)).value;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
status = (await this.confirmTransaction(signature, options?.commitment))
|
|
112
|
+
.value;
|
|
113
|
+
}
|
|
114
|
+
if (status.err != null) {
|
|
115
|
+
throw new web3_js_1.SendTransactionError({
|
|
116
|
+
action: "send",
|
|
117
|
+
signature,
|
|
118
|
+
transactionMessage: `Status: (${JSON.stringify(status)})`,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return signature;
|
|
120
122
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
}
|
|
124
|
+
exports.ConnectionMagicRouter = ConnectionMagicRouter;
|
|
123
125
|
//# sourceMappingURL=magic-router.js.map
|
package/lib/magic-router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"magic-router.js","sourceRoot":"","sources":["../src/magic-router.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"magic-router.js","sourceRoot":"","sources":["../src/magic-router.ts"],"names":[],"mappings":";;;AAkBA,kDAgBC;AAlCD,6CAWyB;AAOzB,SAAgB,mBAAmB,CAAC,WAAwB;IAC1D,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE3C,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;QACzB,gBAAgB,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,MAAM,WAAW,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;QACnD,KAAK,MAAM,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC;YACnC,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;gBACnB,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AACtC,CAAC;AAKD,MAAa,qBAAsB,SAAQ,oBAAU;IAKnD,KAAK,CAAC,mBAAmB;QACvB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE;YAC7C,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EA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B,CAAC;gBAC7B,MAAM,EAAE,MAAM;gBACd,SAAS;gBACT,kBAAkB,EAAE,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG;aAC1D,CAAC,CAAC;QACL,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAnMD,sDAmMC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magicblock-labs/ephemeral-rollups-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"author": "MagicBlock Labs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,14 +20,13 @@
|
|
|
20
20
|
"lint": "eslint -c .eslintrc.yml --ext .ts,.tsx src",
|
|
21
21
|
"lint:fix": "eslint -c .eslintrc.yml --ext .ts,.tsx src --fix",
|
|
22
22
|
"pretest": "tsc",
|
|
23
|
-
"test": "
|
|
23
|
+
"test": "vitest run --reporter verbose",
|
|
24
24
|
"prepare": "npm run build"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"lib"
|
|
28
28
|
],
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@types/jest": "^29.5.12",
|
|
31
30
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
32
31
|
"@typescript-eslint/parser": "^6.21.0",
|
|
33
32
|
"eslint": "^8.55.0",
|
|
@@ -37,10 +36,9 @@
|
|
|
37
36
|
"eslint-plugin-n": "^16.6.2",
|
|
38
37
|
"eslint-plugin-prettier": "^5.2.1",
|
|
39
38
|
"eslint-plugin-promise": "^6.2.0",
|
|
40
|
-
"jest": "^29.7.0",
|
|
41
39
|
"prettier": "^3.3.2",
|
|
42
40
|
"rimraf": "^3.0.2",
|
|
43
|
-
"
|
|
41
|
+
"vitest": "^3.2.4"
|
|
44
42
|
},
|
|
45
43
|
"dependencies": {
|
|
46
44
|
"@metaplex-foundation/beet": "^0.7.2",
|
|
@@ -50,5 +48,6 @@
|
|
|
50
48
|
"rpc-websockets": "^9.0.4",
|
|
51
49
|
"typescript": "^5.3.0"
|
|
52
50
|
},
|
|
51
|
+
"optionalDependencies": {},
|
|
53
52
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
54
53
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"magic-router.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/magic-router.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const magic_router_js_1 = require("../magic-router.js");
|
|
4
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
-
global.fetch = jest.fn();
|
|
6
|
-
describe("getWritableAccounts", () => {
|
|
7
|
-
const mockPublicKey = (address) => ({
|
|
8
|
-
toBase58: () => address,
|
|
9
|
-
toString: () => address,
|
|
10
|
-
});
|
|
11
|
-
it("deduplicates writable accounts", () => {
|
|
12
|
-
const tx = {
|
|
13
|
-
feePayer: mockPublicKey("fee-payer"),
|
|
14
|
-
instructions: [
|
|
15
|
-
{
|
|
16
|
-
keys: [
|
|
17
|
-
{ pubkey: mockPublicKey("k1"), isWritable: true },
|
|
18
|
-
{ pubkey: mockPublicKey("k1"), isWritable: true },
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
};
|
|
23
|
-
const result = (0, magic_router_js_1.getWritableAccounts)(tx);
|
|
24
|
-
expect(result).toEqual(["fee-payer", "k1"]);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
describe("Connection prototype methods", () => {
|
|
28
|
-
let connection;
|
|
29
|
-
let tx;
|
|
30
|
-
beforeEach(() => {
|
|
31
|
-
connection = new magic_router_js_1.Connection("http://localhost");
|
|
32
|
-
tx = new web3_js_1.Transaction();
|
|
33
|
-
tx.serialize = jest.fn(() => Buffer.from("mock"));
|
|
34
|
-
tx.sign = jest.fn();
|
|
35
|
-
global.fetch.mockReset();
|
|
36
|
-
});
|
|
37
|
-
it("getClosestValidator returns identity", async () => {
|
|
38
|
-
global.fetch.mockResolvedValueOnce({
|
|
39
|
-
json: async () => ({ result: { identity: "validator-1" } }),
|
|
40
|
-
});
|
|
41
|
-
const result = await connection.getClosestValidator();
|
|
42
|
-
expect(result).toEqual({ identity: "validator-1" });
|
|
43
|
-
});
|
|
44
|
-
it("getDelegationStatus works with string account", async () => {
|
|
45
|
-
global.fetch.mockResolvedValueOnce({
|
|
46
|
-
json: async () => ({ result: { isDelegated: true } }),
|
|
47
|
-
});
|
|
48
|
-
const result = await connection.getDelegationStatus("account1");
|
|
49
|
-
expect(result).toEqual({ isDelegated: true });
|
|
50
|
-
});
|
|
51
|
-
it("getDelegationStatus works with PublicKey account", async () => {
|
|
52
|
-
global.fetch.mockResolvedValueOnce({
|
|
53
|
-
json: async () => ({ result: { isDelegated: false } }),
|
|
54
|
-
});
|
|
55
|
-
const pk = new web3_js_1.PublicKey("11111111111111111111111111111111");
|
|
56
|
-
const result = await connection.getDelegationStatus(pk);
|
|
57
|
-
expect(result).toEqual({ isDelegated: false });
|
|
58
|
-
});
|
|
59
|
-
it("getLatestBlockhashForTransaction returns blockhash", async () => {
|
|
60
|
-
global.fetch.mockResolvedValueOnce({
|
|
61
|
-
json: async () => ({
|
|
62
|
-
result: { blockhash: "mock-blockhash", lastValidBlockHeight: 100 },
|
|
63
|
-
}),
|
|
64
|
-
});
|
|
65
|
-
const result = await connection.getLatestBlockhashForTransaction(tx);
|
|
66
|
-
expect(result).toEqual({
|
|
67
|
-
blockhash: "mock-blockhash",
|
|
68
|
-
lastValidBlockHeight: 100,
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
it("prepareTransaction sets recentBlockhash", async () => {
|
|
72
|
-
jest
|
|
73
|
-
.spyOn(magic_router_js_1.Connection.prototype, "getLatestBlockhashForTransaction")
|
|
74
|
-
.mockResolvedValue({ blockhash: "hb", lastValidBlockHeight: 100 });
|
|
75
|
-
const result = await connection.prepareTransaction(tx);
|
|
76
|
-
expect(result.recentBlockhash).toBe("hb");
|
|
77
|
-
});
|
|
78
|
-
it("sendTransaction signs and sends transaction", async () => {
|
|
79
|
-
jest
|
|
80
|
-
.spyOn(magic_router_js_1.Connection.prototype, "getLatestBlockhashForTransaction")
|
|
81
|
-
.mockResolvedValue({ blockhash: "hb", lastValidBlockHeight: 100 });
|
|
82
|
-
jest
|
|
83
|
-
.spyOn(magic_router_js_1.Connection.prototype, "sendRawTransaction")
|
|
84
|
-
.mockResolvedValue("sig123");
|
|
85
|
-
const signers = [new web3_js_1.Keypair()];
|
|
86
|
-
const sendTx = connection.sendTransaction.bind(connection);
|
|
87
|
-
const signature = await sendTx(tx, signers);
|
|
88
|
-
const signFn = tx.sign.bind(tx);
|
|
89
|
-
const serializeFn = tx.serialize.bind(tx);
|
|
90
|
-
expect(signFn(...signers)).toBeUndefined();
|
|
91
|
-
expect(serializeFn()).toBeInstanceOf(Buffer);
|
|
92
|
-
expect(signature).toBe("sig123");
|
|
93
|
-
});
|
|
94
|
-
it("sendAndConfirmTransaction calls sendTransaction and returns signature", async () => {
|
|
95
|
-
jest
|
|
96
|
-
.spyOn(magic_router_js_1.Connection.prototype, "sendTransaction")
|
|
97
|
-
.mockResolvedValue("sig123");
|
|
98
|
-
jest
|
|
99
|
-
.spyOn(magic_router_js_1.Connection.prototype, "confirmTransaction")
|
|
100
|
-
.mockResolvedValue({ value: { err: null } });
|
|
101
|
-
const signature = await connection.sendAndConfirmTransaction(tx, [
|
|
102
|
-
new web3_js_1.Keypair(),
|
|
103
|
-
]);
|
|
104
|
-
expect(signature).toBe("sig123");
|
|
105
|
-
});
|
|
106
|
-
it("sendAndConfirmTransaction throws SendTransactionError if status has err", async () => {
|
|
107
|
-
jest
|
|
108
|
-
.spyOn(magic_router_js_1.Connection.prototype, "sendTransaction")
|
|
109
|
-
.mockResolvedValue("sig123");
|
|
110
|
-
jest
|
|
111
|
-
.spyOn(magic_router_js_1.Connection.prototype, "confirmTransaction")
|
|
112
|
-
.mockResolvedValue({ value: { err: { some: "error" } } });
|
|
113
|
-
await expect(connection.sendAndConfirmTransaction(tx, [new web3_js_1.Keypair()])).rejects.toThrow(web3_js_1.SendTransactionError);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
//# sourceMappingURL=magic-router.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"magic-router.test.js","sourceRoot":"","sources":["../../src/__tests__/magic-router.test.ts"],"names":[],"mappings":";;AAAA,wDAAqE;AACrE,6CAKyB;AAGzB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAEzB,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC;QAC1C,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO;QACvB,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO;KACxB,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,EAAE,GAAG;YACT,QAAQ,EAAE,aAAa,CAAC,WAAW,CAAC;YACpC,YAAY,EAAE;gBACZ;oBACE,IAAI,EAAE;wBACJ,EAAE,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;wBACjD,EAAE,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;qBAClD;iBACF;aACF;SACwB,CAAC;QAE5B,MAAM,MAAM,GAAG,IAAA,qCAAmB,EAAC,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CA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