@magicblock-labs/ephemeral-rollups-sdk 0.3.1 → 0.3.3
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.
|
@@ -2,226 +2,115 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const magic_router_js_1 = require("../magic-router.js");
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
-
|
|
6
|
-
toBase58: () => address,
|
|
7
|
-
toString: () => address,
|
|
8
|
-
});
|
|
9
|
-
jest.mock("@solana/web3.js", () => {
|
|
10
|
-
const actual = jest.requireActual("@solana/web3.js");
|
|
11
|
-
return {
|
|
12
|
-
...actual,
|
|
13
|
-
Connection: jest.fn().mockImplementation(() => ({
|
|
14
|
-
rpcEndpoint: "http://localhost",
|
|
15
|
-
sendRawTransaction: jest.fn().mockResolvedValue("mock-signature"),
|
|
16
|
-
})),
|
|
17
|
-
Transaction: jest.fn().mockImplementation(() => ({
|
|
18
|
-
feePayer: mockPublicKey("mock-fee-payer"),
|
|
19
|
-
signature: [],
|
|
20
|
-
instructions: [
|
|
21
|
-
{
|
|
22
|
-
keys: [
|
|
23
|
-
{ pubkey: mockPublicKey("key1"), isSigner: true, isWritable: true },
|
|
24
|
-
{
|
|
25
|
-
pubkey: mockPublicKey("key2"),
|
|
26
|
-
isSigner: false,
|
|
27
|
-
isWritable: false,
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
serialize: jest.fn(() => Buffer.from("mock")),
|
|
33
|
-
sign: jest.fn(),
|
|
34
|
-
})),
|
|
35
|
-
Keypair: jest.fn().mockImplementation(() => ({
|
|
36
|
-
publicKey: mockPublicKey("mock-public-key"),
|
|
37
|
-
sign: jest.fn(),
|
|
38
|
-
})),
|
|
39
|
-
PublicKey: jest
|
|
40
|
-
.fn()
|
|
41
|
-
.mockImplementation((address) => mockPublicKey(address)),
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
global.fetch = jest.fn(async () => Promise.resolve({
|
|
45
|
-
json: async () => Promise.resolve({ result: { blockhash: "mock-blockhash" } }),
|
|
46
|
-
}));
|
|
47
|
-
describe("prepareRouterTransaction", () => {
|
|
48
|
-
it("sets recentBlockhash and returns the transaction", async () => {
|
|
49
|
-
const connection = new web3_js_1.Connection("http://localhost");
|
|
50
|
-
const transaction = new web3_js_1.Transaction();
|
|
51
|
-
const result = await (0, magic_router_js_1.prepareMagicTransaction)(connection, transaction);
|
|
52
|
-
expect(result.recentBlockhash).toBe("mock-blockhash");
|
|
53
|
-
expect(global.fetch).toHaveBeenCalledWith("http://localhost", {
|
|
54
|
-
method: "POST",
|
|
55
|
-
headers: { "Content-Type": "application/json" },
|
|
56
|
-
body: JSON.stringify({
|
|
57
|
-
jsonrpc: "2.0",
|
|
58
|
-
id: 1,
|
|
59
|
-
method: "getBlockhashForAccounts",
|
|
60
|
-
params: [["mock-fee-payer", "key1"]],
|
|
61
|
-
}),
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
describe("sendRouterTransaction", () => {
|
|
66
|
-
it("sets recentBlockhash, feePayer, signs, and sends the transaction", async () => {
|
|
67
|
-
const connection = new web3_js_1.Connection("http://localhost");
|
|
68
|
-
const transaction = new web3_js_1.Transaction();
|
|
69
|
-
const signers = [new web3_js_1.Keypair()];
|
|
70
|
-
const signature = await (0, magic_router_js_1.sendMagicTransaction)(connection, transaction, signers);
|
|
71
|
-
expect(transaction.recentBlockhash).toBe("mock-blockhash");
|
|
72
|
-
expect(transaction.feePayer?.toBase58()).toBe("mock-fee-payer");
|
|
73
|
-
expect(transaction.sign).toHaveBeenCalledWith(...signers);
|
|
74
|
-
expect(signature).toBe("mock-signature");
|
|
75
|
-
expect(global.fetch).toHaveBeenCalledWith("http://localhost", {
|
|
76
|
-
method: "POST",
|
|
77
|
-
headers: { "Content-Type": "application/json" },
|
|
78
|
-
body: JSON.stringify({
|
|
79
|
-
jsonrpc: "2.0",
|
|
80
|
-
id: 1,
|
|
81
|
-
method: "getBlockhashForAccounts",
|
|
82
|
-
params: [["mock-fee-payer", "key1"]],
|
|
83
|
-
}),
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
});
|
|
5
|
+
global.fetch = jest.fn();
|
|
87
6
|
describe("getWritableAccounts", () => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
instructions: [
|
|
92
|
-
{
|
|
93
|
-
keys: [
|
|
94
|
-
{ pubkey: mockPublicKey("key1"), isWritable: true },
|
|
95
|
-
{ pubkey: mockPublicKey("key2"), isWritable: false },
|
|
96
|
-
{ pubkey: mockPublicKey("key3"), isWritable: true },
|
|
97
|
-
],
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
};
|
|
101
|
-
const result = (0, magic_router_js_1.getWritableAccounts)(transaction);
|
|
102
|
-
expect(result).toEqual(["fee-payer", "key1", "key3"]);
|
|
103
|
-
});
|
|
104
|
-
it("handles transaction without feePayer", () => {
|
|
105
|
-
const transaction = {
|
|
106
|
-
feePayer: null,
|
|
107
|
-
instructions: [
|
|
108
|
-
{
|
|
109
|
-
keys: [
|
|
110
|
-
{ pubkey: mockPublicKey("key1"), isWritable: true },
|
|
111
|
-
{ pubkey: mockPublicKey("key2"), isWritable: false },
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
};
|
|
116
|
-
const result = (0, magic_router_js_1.getWritableAccounts)(transaction);
|
|
117
|
-
expect(result).toEqual(["key1"]);
|
|
118
|
-
});
|
|
119
|
-
it("handles transaction without instructions", () => {
|
|
120
|
-
const transaction = {
|
|
121
|
-
feePayer: mockPublicKey("fee-payer"),
|
|
122
|
-
instructions: [],
|
|
123
|
-
};
|
|
124
|
-
const result = (0, magic_router_js_1.getWritableAccounts)(transaction);
|
|
125
|
-
expect(result).toEqual(["fee-payer"]);
|
|
7
|
+
const mockPublicKey = (address) => ({
|
|
8
|
+
toBase58: () => address,
|
|
9
|
+
toString: () => address,
|
|
126
10
|
});
|
|
127
11
|
it("deduplicates writable accounts", () => {
|
|
128
|
-
const
|
|
12
|
+
const tx = {
|
|
129
13
|
feePayer: mockPublicKey("fee-payer"),
|
|
130
14
|
instructions: [
|
|
131
15
|
{
|
|
132
16
|
keys: [
|
|
133
|
-
{ pubkey: mockPublicKey("
|
|
134
|
-
{ pubkey: mockPublicKey("
|
|
135
|
-
{ pubkey: mockPublicKey("key2"), isWritable: false },
|
|
17
|
+
{ pubkey: mockPublicKey("k1"), isWritable: true },
|
|
18
|
+
{ pubkey: mockPublicKey("k1"), isWritable: true },
|
|
136
19
|
],
|
|
137
20
|
},
|
|
138
21
|
],
|
|
139
22
|
};
|
|
140
|
-
const result = (0, magic_router_js_1.getWritableAccounts)(
|
|
141
|
-
expect(result).toEqual(["fee-payer", "
|
|
23
|
+
const result = (0, magic_router_js_1.getWritableAccounts)(tx);
|
|
24
|
+
expect(result).toEqual(["fee-payer", "k1"]);
|
|
142
25
|
});
|
|
143
26
|
});
|
|
144
|
-
describe("
|
|
27
|
+
describe("Connection prototype methods", () => {
|
|
28
|
+
let connection;
|
|
29
|
+
let tx;
|
|
145
30
|
beforeEach(() => {
|
|
146
|
-
|
|
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();
|
|
147
36
|
});
|
|
148
|
-
it("
|
|
149
|
-
const mockIdentityData = {
|
|
150
|
-
result: {
|
|
151
|
-
identity: "mock-validator-identity",
|
|
152
|
-
},
|
|
153
|
-
};
|
|
37
|
+
it("getClosestValidator returns identity", async () => {
|
|
154
38
|
global.fetch.mockResolvedValueOnce({
|
|
155
|
-
json: async () =>
|
|
39
|
+
json: async () => ({ result: { identity: "validator-1" } }),
|
|
156
40
|
});
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
expect(global.fetch).toHaveBeenCalledWith("http://localhost", {
|
|
160
|
-
method: "POST",
|
|
161
|
-
headers: { "Content-Type": "application/json" },
|
|
162
|
-
body: JSON.stringify({
|
|
163
|
-
jsonrpc: "2.0",
|
|
164
|
-
id: 1,
|
|
165
|
-
method: "getIdentity",
|
|
166
|
-
params: [],
|
|
167
|
-
}),
|
|
168
|
-
});
|
|
169
|
-
expect(result.identity).toBe("mock-validator-identity");
|
|
170
|
-
});
|
|
171
|
-
it("handles fetch errors gracefully", async () => {
|
|
172
|
-
global.fetch.mockRejectedValueOnce(new Error("Network error"));
|
|
173
|
-
const connection = new web3_js_1.Connection("http://localhost");
|
|
174
|
-
await expect((0, magic_router_js_1.getClosestValidator)(connection)).rejects.toThrow("Network error");
|
|
41
|
+
const result = await connection.getClosestValidator();
|
|
42
|
+
expect(result).toEqual({ identity: "validator-1" });
|
|
175
43
|
});
|
|
176
|
-
it("
|
|
44
|
+
it("getDelegationStatus works with string account", async () => {
|
|
177
45
|
global.fetch.mockResolvedValueOnce({
|
|
178
|
-
json: async () =>
|
|
46
|
+
json: async () => ({ result: { isDelegated: true } }),
|
|
179
47
|
});
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
describe("getDelegationStatus", () => {
|
|
185
|
-
beforeEach(() => {
|
|
186
|
-
jest.clearAllMocks();
|
|
48
|
+
const result = await connection.getDelegationStatus("account1");
|
|
49
|
+
expect(result).toEqual({ isDelegated: true });
|
|
187
50
|
});
|
|
188
|
-
it("
|
|
51
|
+
it("getDelegationStatus works with PublicKey account", async () => {
|
|
189
52
|
global.fetch.mockResolvedValueOnce({
|
|
190
|
-
json: async () =>
|
|
191
|
-
});
|
|
192
|
-
const connection = new web3_js_1.Connection("http://localhost");
|
|
193
|
-
const account = "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU";
|
|
194
|
-
const result = await (0, magic_router_js_1.getDelegationStatus)(connection, account);
|
|
195
|
-
expect(global.fetch).toHaveBeenCalledWith("http://localhost/getDelegationStatus", {
|
|
196
|
-
method: "POST",
|
|
197
|
-
headers: { "Content-Type": "application/json" },
|
|
198
|
-
body: JSON.stringify({
|
|
199
|
-
jsonrpc: "2.0",
|
|
200
|
-
id: 1,
|
|
201
|
-
method: "getDelegationStatus",
|
|
202
|
-
params: [account],
|
|
203
|
-
}),
|
|
53
|
+
json: async () => ({ result: { isDelegated: false } }),
|
|
204
54
|
});
|
|
55
|
+
const pk = new web3_js_1.PublicKey("11111111111111111111111111111111");
|
|
56
|
+
const result = await connection.getDelegationStatus(pk);
|
|
205
57
|
expect(result).toEqual({ isDelegated: false });
|
|
206
58
|
});
|
|
207
|
-
it("returns
|
|
59
|
+
it("getLatestBlockhashForTransaction returns blockhash", async () => {
|
|
208
60
|
global.fetch.mockResolvedValueOnce({
|
|
209
|
-
json: async () =>
|
|
210
|
-
|
|
211
|
-
const connection = new web3_js_1.Connection("http://localhost");
|
|
212
|
-
const accountKey = new web3_js_1.PublicKey("mock-public-key");
|
|
213
|
-
const result = await (0, magic_router_js_1.getDelegationStatus)(connection, accountKey);
|
|
214
|
-
expect(global.fetch).toHaveBeenCalledWith("http://localhost/getDelegationStatus", {
|
|
215
|
-
method: "POST",
|
|
216
|
-
headers: { "Content-Type": "application/json" },
|
|
217
|
-
body: JSON.stringify({
|
|
218
|
-
jsonrpc: "2.0",
|
|
219
|
-
id: 1,
|
|
220
|
-
method: "getDelegationStatus",
|
|
221
|
-
params: [accountKey.toBase58()],
|
|
61
|
+
json: async () => ({
|
|
62
|
+
result: { blockhash: "mock-blockhash", lastValidBlockHeight: 100 },
|
|
222
63
|
}),
|
|
223
64
|
});
|
|
224
|
-
|
|
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);
|
|
225
114
|
});
|
|
226
115
|
});
|
|
227
116
|
//# sourceMappingURL=magic-router.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"magic-router.test.js","sourceRoot":"","sources":["../../src/__tests__/magic-router.test.ts"],"names":[],"mappings":";;AAAA,
|
|
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,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,16 +1,4 @@
|
|
|
1
|
-
import { Connection, Transaction
|
|
1
|
+
import { Connection, Transaction } from "@solana/web3.js";
|
|
2
2
|
export declare function getWritableAccounts(transaction: Transaction): string[];
|
|
3
|
-
export
|
|
4
|
-
identity: string;
|
|
5
|
-
fqdn?: string;
|
|
6
|
-
}>;
|
|
7
|
-
export declare function getDelegationStatus(connection: Connection, account: PublicKey | string): Promise<{
|
|
8
|
-
isDelegated: boolean;
|
|
9
|
-
}>;
|
|
10
|
-
export declare function getLatestBlockhashForMagicTransaction(connection: Connection, transaction: Transaction, options?: ConfirmOptions): Promise<BlockhashWithExpiryBlockHeight>;
|
|
11
|
-
export declare function prepareMagicTransaction(connection: Connection, transaction: Transaction, options?: ConfirmOptions): Promise<Transaction>;
|
|
12
|
-
export declare function sendMagicTransaction(connection: Connection, transaction: Transaction, signersOrOptions?: Signer[] | SendOptions, options?: SendOptions): Promise<TransactionSignature>;
|
|
13
|
-
export declare function sendAndConfirmMagicTransaction(connection: Connection, transaction: Transaction, signers: Signer[], options?: ConfirmOptions & Readonly<{
|
|
14
|
-
abortSignal?: AbortSignal;
|
|
15
|
-
}>): Promise<TransactionSignature>;
|
|
3
|
+
export { Connection };
|
|
16
4
|
//# 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,EAQZ,MAAM,iBAAiB,CAAC;AAKzB,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,YAgB3D;AA6LD,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/lib/magic-router.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Connection = void 0;
|
|
3
4
|
exports.getWritableAccounts = getWritableAccounts;
|
|
4
|
-
exports.getClosestValidator = getClosestValidator;
|
|
5
|
-
exports.getDelegationStatus = getDelegationStatus;
|
|
6
|
-
exports.getLatestBlockhashForMagicTransaction = getLatestBlockhashForMagicTransaction;
|
|
7
|
-
exports.prepareMagicTransaction = prepareMagicTransaction;
|
|
8
|
-
exports.sendMagicTransaction = sendMagicTransaction;
|
|
9
|
-
exports.sendAndConfirmMagicTransaction = sendAndConfirmMagicTransaction;
|
|
10
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
|
+
Object.defineProperty(exports, "Connection", { enumerable: true, get: function () { return web3_js_1.Connection; } });
|
|
11
7
|
function getWritableAccounts(transaction) {
|
|
12
8
|
const writableAccounts = new Set();
|
|
13
9
|
if (transaction.feePayer) {
|
|
@@ -22,8 +18,8 @@ function getWritableAccounts(transaction) {
|
|
|
22
18
|
}
|
|
23
19
|
return Array.from(writableAccounts);
|
|
24
20
|
}
|
|
25
|
-
async function
|
|
26
|
-
const response = await fetch(
|
|
21
|
+
web3_js_1.Connection.prototype.getClosestValidator = async function () {
|
|
22
|
+
const response = await fetch(this.rpcEndpoint, {
|
|
27
23
|
method: "POST",
|
|
28
24
|
headers: { "Content-Type": "application/json" },
|
|
29
25
|
body: JSON.stringify({
|
|
@@ -34,14 +30,14 @@ async function getClosestValidator(routerConnection) {
|
|
|
34
30
|
}),
|
|
35
31
|
});
|
|
36
32
|
const identityData = (await response.json())?.result;
|
|
37
|
-
if (identityData
|
|
33
|
+
if (identityData === null || identityData.identity === undefined) {
|
|
38
34
|
throw new Error("Invalid response");
|
|
39
35
|
}
|
|
40
36
|
return identityData;
|
|
41
|
-
}
|
|
42
|
-
async function
|
|
37
|
+
};
|
|
38
|
+
web3_js_1.Connection.prototype.getDelegationStatus = async function (account) {
|
|
43
39
|
const accountAddress = typeof account === "string" ? account : account.toBase58();
|
|
44
|
-
const response = await fetch(`${
|
|
40
|
+
const response = await fetch(`${this.rpcEndpoint}/getDelegationStatus`, {
|
|
45
41
|
method: "POST",
|
|
46
42
|
headers: { "Content-Type": "application/json" },
|
|
47
43
|
body: JSON.stringify({
|
|
@@ -51,49 +47,49 @@ async function getDelegationStatus(connection, account) {
|
|
|
51
47
|
params: [accountAddress],
|
|
52
48
|
}),
|
|
53
49
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
async function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
async function
|
|
73
|
-
const blockHashData = await
|
|
50
|
+
return (await response.json()).result;
|
|
51
|
+
};
|
|
52
|
+
web3_js_1.Connection.prototype.getLatestBlockhashForTransaction =
|
|
53
|
+
async function (transaction, options) {
|
|
54
|
+
const writableAccounts = getWritableAccounts(transaction);
|
|
55
|
+
const blockHashResponse = await fetch(this.rpcEndpoint, {
|
|
56
|
+
method: "POST",
|
|
57
|
+
headers: { "Content-Type": "application/json" },
|
|
58
|
+
body: JSON.stringify({
|
|
59
|
+
jsonrpc: "2.0",
|
|
60
|
+
id: 1,
|
|
61
|
+
method: "getBlockhashForAccounts",
|
|
62
|
+
params: [writableAccounts],
|
|
63
|
+
}),
|
|
64
|
+
});
|
|
65
|
+
const blockHashData = await blockHashResponse.json();
|
|
66
|
+
return blockHashData.result;
|
|
67
|
+
};
|
|
68
|
+
web3_js_1.Connection.prototype.prepareTransaction = async function (transaction, options) {
|
|
69
|
+
const blockHashData = await this.getLatestBlockhashForTransaction(transaction, options);
|
|
74
70
|
transaction.recentBlockhash = blockHashData.blockhash;
|
|
75
71
|
return transaction;
|
|
76
|
-
}
|
|
77
|
-
async function
|
|
72
|
+
};
|
|
73
|
+
web3_js_1.Connection.prototype.sendTransaction = async function (transaction, signersOrOptions, options) {
|
|
78
74
|
const sendOpts = Array.isArray(signersOrOptions)
|
|
79
75
|
? (options ?? undefined)
|
|
80
76
|
: (signersOrOptions ?? undefined);
|
|
81
|
-
const latestBlockhash = await
|
|
77
|
+
const latestBlockhash = await this.getLatestBlockhashForTransaction(transaction, sendOpts);
|
|
78
|
+
transaction.recentBlockhash = latestBlockhash.blockhash;
|
|
82
79
|
transaction.lastValidBlockHeight =
|
|
83
80
|
latestBlockhash.lastValidBlockHeight;
|
|
84
|
-
transaction.recentBlockhash = latestBlockhash.blockhash;
|
|
85
81
|
if (Array.isArray(signersOrOptions)) {
|
|
86
|
-
transaction.sign
|
|
82
|
+
transaction.sign(...signersOrOptions);
|
|
87
83
|
}
|
|
88
84
|
const wireTransaction = transaction.serialize();
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
async function
|
|
92
|
-
const signature = await
|
|
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);
|
|
93
89
|
let status;
|
|
94
90
|
const { recentBlockhash, lastValidBlockHeight, minNonceContextSlot, nonceInfo, } = transaction;
|
|
95
91
|
if (recentBlockhash !== undefined && lastValidBlockHeight !== undefined) {
|
|
96
|
-
status = (await
|
|
92
|
+
status = (await this.confirmTransaction({
|
|
97
93
|
abortSignal: options?.abortSignal,
|
|
98
94
|
signature,
|
|
99
95
|
blockhash: recentBlockhash,
|
|
@@ -103,7 +99,7 @@ async function sendAndConfirmMagicTransaction(connection, transaction, signers,
|
|
|
103
99
|
else if (minNonceContextSlot !== undefined && nonceInfo !== undefined) {
|
|
104
100
|
const { nonceInstruction } = nonceInfo;
|
|
105
101
|
const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
|
|
106
|
-
status = (await
|
|
102
|
+
status = (await this.confirmTransaction({
|
|
107
103
|
abortSignal: options?.abortSignal,
|
|
108
104
|
minContextSlot: minNonceContextSlot,
|
|
109
105
|
nonceAccountPubkey,
|
|
@@ -112,23 +108,16 @@ async function sendAndConfirmMagicTransaction(connection, transaction, signers,
|
|
|
112
108
|
}, options?.commitment)).value;
|
|
113
109
|
}
|
|
114
110
|
else {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` " +
|
|
118
|
-
"or a combination of `nonceInfo` and `minNonceContextSlot` are abortable.");
|
|
119
|
-
}
|
|
120
|
-
status = (await connection.confirmTransaction(signature, options?.commitment)).value;
|
|
111
|
+
status = (await this.confirmTransaction(signature, options?.commitment))
|
|
112
|
+
.value;
|
|
121
113
|
}
|
|
122
114
|
if (status.err != null) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);
|
|
115
|
+
throw new web3_js_1.SendTransactionError({
|
|
116
|
+
action: "send",
|
|
117
|
+
signature,
|
|
118
|
+
transactionMessage: `Status: (${JSON.stringify(status)})`,
|
|
119
|
+
});
|
|
131
120
|
}
|
|
132
121
|
return signature;
|
|
133
|
-
}
|
|
122
|
+
};
|
|
134
123
|
//# 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":";;;AAeA,kDAgBC;AA/BD,6CAUyB;AAkNhB,2FA3NP,oBAAU,OA2NO;AA7MnB,SAAgB,mBAAmB,CAAC,WAAwB;IAC1D,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;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