@wormhole-foundation/sdk-solana-core 0.5.0-beta.0 → 0.5.0-beta.2
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/cjs/core.d.ts +7 -1
- package/dist/cjs/core.d.ts.map +1 -1
- package/dist/cjs/core.js +76 -28
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/postMessageLayout.d.ts +65 -0
- package/dist/cjs/postMessageLayout.d.ts.map +1 -0
- package/dist/cjs/postMessageLayout.js +20 -0
- package/dist/cjs/postMessageLayout.js.map +1 -0
- package/dist/esm/core.d.ts +7 -1
- package/dist/esm/core.d.ts.map +1 -1
- package/dist/esm/core.js +77 -29
- package/dist/esm/core.js.map +1 -1
- package/dist/esm/postMessageLayout.d.ts +65 -0
- package/dist/esm/postMessageLayout.d.ts.map +1 -0
- package/dist/esm/postMessageLayout.js +17 -0
- package/dist/esm/postMessageLayout.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/cjs/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Program } from '@project-serum/anchor';
|
|
2
|
-
import { Connection, TransactionResponse, VersionedTransactionResponse } from '@solana/web3.js';
|
|
2
|
+
import { Connection, PublicKey, TransactionResponse, VersionedTransactionResponse } from '@solana/web3.js';
|
|
3
3
|
import { ChainId, ChainsConfig, Contracts, Network, Platform, UniversalAddress, VAA, WormholeCore, WormholeMessageId } from '@wormhole-foundation/sdk-connect';
|
|
4
4
|
import { AnySolanaAddress, SolanaChains, SolanaUnsignedTransaction } from '@wormhole-foundation/sdk-solana';
|
|
5
5
|
import { Wormhole as WormholeCoreContract } from './types';
|
|
@@ -15,12 +15,18 @@ export declare class SolanaWormholeCore<N extends Network, C extends SolanaChain
|
|
|
15
15
|
protected bridgeData?: BridgeData;
|
|
16
16
|
constructor(network: N, chain: C, connection: Connection, contracts: Contracts);
|
|
17
17
|
static fromRpc<N extends Network>(connection: Connection, config: ChainsConfig<N, Platform>): Promise<SolanaWormholeCore<N, "Solana" | "Pythnet">>;
|
|
18
|
+
private ensureBridgeConfig;
|
|
18
19
|
getMessageFee(): Promise<bigint>;
|
|
20
|
+
getGuardianSetIndex(): Promise<number>;
|
|
19
21
|
publishMessage(sender: AnySolanaAddress, message: Uint8Array, nonce: number, consistencyLevel: number): AsyncGenerator<SolanaUnsignedTransaction<N, C>, void, unknown>;
|
|
20
22
|
verifyMessage(sender: AnySolanaAddress, vaa: VAA): AsyncGenerator<SolanaUnsignedTransaction<N, C>, void, unknown>;
|
|
21
23
|
postVaa(sender: AnySolanaAddress, vaa: VAA): AsyncGenerator<SolanaUnsignedTransaction<N, C>, void, unknown>;
|
|
22
24
|
static parseSequenceFromLog(coreBridgeAddress: string, transaction: VersionedTransactionResponse | TransactionResponse): [UniversalAddress, bigint] | null;
|
|
25
|
+
private getMessageAccountKeys;
|
|
26
|
+
private findBridgeInstructions;
|
|
27
|
+
parsePostMessageAccount(messageAccount: PublicKey): Promise<VAA>;
|
|
23
28
|
parseTransaction(txid: string): Promise<WormholeMessageId[]>;
|
|
29
|
+
parseMessages(txid: string): Promise<VAA[]>;
|
|
24
30
|
private createUnsignedTx;
|
|
25
31
|
}
|
|
26
32
|
//# sourceMappingURL=core.d.ts.map
|
package/dist/cjs/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EACL,UAAU,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EACL,UAAU,EAIV,SAAS,EAET,mBAAmB,EACnB,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U,EACnB,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,MAAM;IA8BnB,aAAa,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG;IAIhD,OAAO,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG;IAkDjD,MAAM,CAAC,oBAAoB,CACzB,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,4BAA4B,GAAG,mBAAmB,GAC9D,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG,IAAI;YA4BtB,qBAAqB;YAoCrB,sBAAsB;IAgC9B,uBAAuB,CAAC,cAAc,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;IA2BhE,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA+C5D,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IA2BjD,OAAO,CAAC,gBAAgB;CAazB"}
|
package/dist/cjs/core.js
CHANGED
|
@@ -5,6 +5,7 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
5
5
|
const sdk_connect_1 = require("@wormhole-foundation/sdk-connect");
|
|
6
6
|
const sdk_solana_1 = require("@wormhole-foundation/sdk-solana");
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
|
+
const postMessageLayout_1 = require("./postMessageLayout");
|
|
8
9
|
const SOLANA_SEQ_LOG = 'Program log: Sequence: ';
|
|
9
10
|
class SolanaWormholeCore {
|
|
10
11
|
network;
|
|
@@ -34,12 +35,19 @@ class SolanaWormholeCore {
|
|
|
34
35
|
throw new Error(`Network mismatch for chain ${chain}: ${conf.network} != ${network}`);
|
|
35
36
|
return new SolanaWormholeCore(network, chain, connection, config[chain].contracts);
|
|
36
37
|
}
|
|
37
|
-
async
|
|
38
|
+
async ensureBridgeConfig() {
|
|
38
39
|
// cache lookups since this should not change frequently
|
|
39
40
|
if (!this.bridgeData)
|
|
40
41
|
this.bridgeData = await (0, utils_1.getWormholeBridgeData)(this.connection, this.coreBridge.programId);
|
|
42
|
+
}
|
|
43
|
+
async getMessageFee() {
|
|
44
|
+
await this.ensureBridgeConfig();
|
|
41
45
|
return this.bridgeData.config.fee;
|
|
42
46
|
}
|
|
47
|
+
async getGuardianSetIndex() {
|
|
48
|
+
await this.ensureBridgeConfig();
|
|
49
|
+
return this.bridgeData.guardianSetIndex;
|
|
50
|
+
}
|
|
43
51
|
async *publishMessage(sender, message, nonce, consistencyLevel) {
|
|
44
52
|
const messageAccount = web3_js_1.Keypair.generate();
|
|
45
53
|
const payer = new sdk_solana_1.SolanaAddress(sender).unwrap();
|
|
@@ -96,23 +104,7 @@ class SolanaWormholeCore {
|
|
|
96
104
|
return null;
|
|
97
105
|
return [emitter, BigInt(sequence)];
|
|
98
106
|
}
|
|
99
|
-
async
|
|
100
|
-
const response = await this.connection.getTransaction(txid, {
|
|
101
|
-
maxSupportedTransactionVersion: 0,
|
|
102
|
-
});
|
|
103
|
-
if (!response || !response.meta || !response.meta.innerInstructions)
|
|
104
|
-
throw new Error('transaction not found');
|
|
105
|
-
// The sequence is frequently found in the log, pull from there if we can
|
|
106
|
-
const loggedSeq = SolanaWormholeCore.parseSequenceFromLog(this.coreBridge.programId.toBase58(), response);
|
|
107
|
-
if (loggedSeq)
|
|
108
|
-
return [
|
|
109
|
-
{
|
|
110
|
-
chain: this.chain,
|
|
111
|
-
emitter: loggedSeq[0],
|
|
112
|
-
sequence: loggedSeq[1],
|
|
113
|
-
},
|
|
114
|
-
];
|
|
115
|
-
// Otherwise we need to get it from the message account
|
|
107
|
+
async getMessageAccountKeys(response) {
|
|
116
108
|
// Resolve any LUT accounts if necessary
|
|
117
109
|
let accounts;
|
|
118
110
|
// a string type is indicative of a 'legacy' transaction
|
|
@@ -137,12 +129,17 @@ class SolanaWormholeCore {
|
|
|
137
129
|
else {
|
|
138
130
|
accounts = response.transaction.message.getAccountKeys();
|
|
139
131
|
}
|
|
132
|
+
return accounts;
|
|
133
|
+
}
|
|
134
|
+
async findBridgeInstructions(accounts, response) {
|
|
140
135
|
// find the instruction where the programId equals the Wormhole ProgramId
|
|
141
|
-
const iix = response
|
|
136
|
+
const iix = response
|
|
137
|
+
.meta.innerInstructions[0].instructions.filter((i) => {
|
|
142
138
|
const programId = accounts.get(i.programIdIndex).toString();
|
|
143
139
|
const wormholeCore = this.coreBridge.programId.toString();
|
|
144
140
|
return programId === wormholeCore;
|
|
145
|
-
})
|
|
141
|
+
})
|
|
142
|
+
.map((ix) => {
|
|
146
143
|
// map over inner ixs to put it in the same format as the compiled instructions
|
|
147
144
|
// from the message
|
|
148
145
|
return {
|
|
@@ -156,23 +153,74 @@ class SolanaWormholeCore {
|
|
|
156
153
|
return programId === wormholeCore;
|
|
157
154
|
});
|
|
158
155
|
// find the instruction where the programId equals the Wormhole ProgramId
|
|
159
|
-
|
|
156
|
+
return [...iix, ...cix];
|
|
157
|
+
}
|
|
158
|
+
async parsePostMessageAccount(messageAccount) {
|
|
159
|
+
const acctInfo = await this.connection.getAccountInfo(messageAccount);
|
|
160
|
+
if (!acctInfo?.data)
|
|
161
|
+
throw new Error('No data found in message account');
|
|
162
|
+
const { timestamp, emitterAddress, emitterChain, consistencyLevel, sequence, nonce, payload, } = (0, sdk_connect_1.deserializeLayout)(postMessageLayout_1.postMessageLayout, new Uint8Array(acctInfo?.data));
|
|
163
|
+
return (0, sdk_connect_1.createVAA)('Uint8Array', {
|
|
164
|
+
guardianSet: await this.getGuardianSetIndex(),
|
|
165
|
+
emitterChain: (0, sdk_connect_1.toChain)(emitterChain),
|
|
166
|
+
timestamp,
|
|
167
|
+
emitterAddress,
|
|
168
|
+
consistencyLevel,
|
|
169
|
+
sequence,
|
|
170
|
+
nonce,
|
|
171
|
+
payload,
|
|
172
|
+
signatures: [],
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
async parseTransaction(txid) {
|
|
176
|
+
const response = await this.connection.getTransaction(txid, {
|
|
177
|
+
maxSupportedTransactionVersion: 0,
|
|
178
|
+
});
|
|
179
|
+
if (!response || !response.meta || !response.meta.innerInstructions)
|
|
180
|
+
throw new Error('transaction not found');
|
|
181
|
+
// The sequence is frequently found in the log, pull from there if we can
|
|
182
|
+
const loggedSeq = SolanaWormholeCore.parseSequenceFromLog(this.coreBridge.programId.toBase58(), response);
|
|
183
|
+
if (loggedSeq)
|
|
184
|
+
return [
|
|
185
|
+
{
|
|
186
|
+
chain: this.chain,
|
|
187
|
+
emitter: loggedSeq[0],
|
|
188
|
+
sequence: loggedSeq[1],
|
|
189
|
+
},
|
|
190
|
+
];
|
|
191
|
+
// Otherwise we need to get it from the message account
|
|
192
|
+
const accounts = await this.getMessageAccountKeys(response);
|
|
193
|
+
const bridgeInstructions = await this.findBridgeInstructions(accounts, response);
|
|
160
194
|
if (!bridgeInstructions || bridgeInstructions.length === 0)
|
|
161
195
|
throw new Error('no bridge messages found');
|
|
162
196
|
const messagePromises = bridgeInstructions.map(async (bi) => {
|
|
163
197
|
const messageAcct = accounts.get(bi.accountKeyIndexes[1]);
|
|
164
|
-
const
|
|
165
|
-
const sequence = acctInfo.data.readBigUInt64LE(49);
|
|
166
|
-
const emitterAddr = new Uint8Array(acctInfo.data.subarray(59, 91));
|
|
167
|
-
const emitter = new sdk_solana_1.SolanaAddress(emitterAddr);
|
|
198
|
+
const vaa = await this.parsePostMessageAccount(messageAcct);
|
|
168
199
|
return {
|
|
169
|
-
chain:
|
|
170
|
-
emitter:
|
|
171
|
-
sequence:
|
|
200
|
+
chain: vaa.emitterChain,
|
|
201
|
+
emitter: vaa.emitterAddress,
|
|
202
|
+
sequence: vaa.sequence,
|
|
172
203
|
};
|
|
173
204
|
});
|
|
174
205
|
return await Promise.all(messagePromises);
|
|
175
206
|
}
|
|
207
|
+
async parseMessages(txid) {
|
|
208
|
+
const response = await this.connection.getTransaction(txid, {
|
|
209
|
+
maxSupportedTransactionVersion: 0,
|
|
210
|
+
});
|
|
211
|
+
if (!response || !response.meta || !response.meta.innerInstructions)
|
|
212
|
+
throw new Error('transaction not found');
|
|
213
|
+
// Otherwise we need to get it from the message account
|
|
214
|
+
const accounts = await this.getMessageAccountKeys(response);
|
|
215
|
+
const bridgeInstructions = await this.findBridgeInstructions(accounts, response);
|
|
216
|
+
if (!bridgeInstructions || bridgeInstructions.length === 0)
|
|
217
|
+
throw new Error('no bridge messages found');
|
|
218
|
+
const messagePromises = bridgeInstructions.map(async (bi) => {
|
|
219
|
+
const messageAcct = accounts.get(bi.accountKeyIndexes[1]);
|
|
220
|
+
return await this.parsePostMessageAccount(messageAcct);
|
|
221
|
+
});
|
|
222
|
+
return await Promise.all(messagePromises);
|
|
223
|
+
}
|
|
176
224
|
createUnsignedTx(txReq, description, parallelizable = false) {
|
|
177
225
|
return new sdk_solana_1.SolanaUnsignedTransaction(txReq, this.network, this.chain, description, parallelizable);
|
|
178
226
|
}
|
package/dist/cjs/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":";;;AACA,6CASyB;AACzB,kEAc0C;AAC1C,gEAOyC;AAEzC,mCASiB;AACjB,2DAAwD;AAExD,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAEjD,MAAa,kBAAkB;IASlB;IACA;IACA;IACA;IATF,OAAO,CAAU;IACjB,UAAU,CAAgC;IAC1C,OAAO,CAAS;IACf,UAAU,CAAc;IAElC,YACW,OAAU,EACV,KAAQ,EACR,UAAsB,EACtB,SAAoB;QAHpB,YAAO,GAAP,OAAO,CAAG;QACV,UAAK,GAAL,KAAK,CAAG;QACR,eAAU,GAAV,UAAU,CAAY;QACtB,cAAS,GAAT,SAAS,CAAW;QAE7B,IAAI,CAAC,OAAO,GAAG,IAAA,uBAAS,EAAC,KAAK,CAAC,CAAC;QAEhC,MAAM,iBAAi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AAE,EAAE,EAAE,EAAE;YAC1D,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAE,CAAC,CAAC;YAC3D,OAAO,MAAM,IAAI,CAAC,uBAAuB,CAAC,WAAY,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC5C,CAAC;IAEO,gBAAgB,CACtB,KAAwB,EACxB,WAAmB,EACnB,iBAA0B,KAAK;QAE/B,OAAO,IAAI,sCAAyB,CAClC,KAAK,EACL,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,KAAK,EACV,WAAW,EACX,cAAc,CACf,CAAC;IACJ,CAAC;CACF;AAjXD,gDAiXC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** Binary layout for postMessage account */
|
|
2
|
+
export declare const postMessageLayout: readonly [{
|
|
3
|
+
readonly name: "discriminator";
|
|
4
|
+
readonly binary: "bytes";
|
|
5
|
+
readonly size: 4;
|
|
6
|
+
}, {
|
|
7
|
+
readonly name: "consistencyLevel";
|
|
8
|
+
readonly binary: "uint";
|
|
9
|
+
readonly size: 1;
|
|
10
|
+
readonly endianness: "little";
|
|
11
|
+
}, {
|
|
12
|
+
readonly binary: "bytes";
|
|
13
|
+
readonly size: 32;
|
|
14
|
+
readonly custom: {
|
|
15
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-connect").UniversalAddress;
|
|
16
|
+
from: (val: import("@wormhole-foundation/sdk-connect").UniversalAddress) => Uint8Array;
|
|
17
|
+
};
|
|
18
|
+
readonly name: "emitterAuthority";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "messageStatus";
|
|
21
|
+
readonly binary: "uint";
|
|
22
|
+
readonly size: 1;
|
|
23
|
+
readonly endianness: "little";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "gap";
|
|
26
|
+
readonly binary: "uint";
|
|
27
|
+
readonly size: 3;
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "timestamp";
|
|
30
|
+
readonly binary: "uint";
|
|
31
|
+
readonly size: 4;
|
|
32
|
+
readonly endianness: "little";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "nonce";
|
|
35
|
+
readonly binary: "uint";
|
|
36
|
+
readonly size: 4;
|
|
37
|
+
readonly endianness: "little";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "sequence";
|
|
40
|
+
readonly binary: "uint";
|
|
41
|
+
readonly size: 8;
|
|
42
|
+
readonly endianness: "little";
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "emitterChain";
|
|
45
|
+
readonly binary: "uint";
|
|
46
|
+
readonly size: 2;
|
|
47
|
+
readonly endianness: "little";
|
|
48
|
+
}, {
|
|
49
|
+
readonly binary: "bytes";
|
|
50
|
+
readonly size: 32;
|
|
51
|
+
readonly custom: {
|
|
52
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-connect").UniversalAddress;
|
|
53
|
+
from: (val: import("@wormhole-foundation/sdk-connect").UniversalAddress) => Uint8Array;
|
|
54
|
+
};
|
|
55
|
+
readonly name: "emitterAddress";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "payloadLength";
|
|
58
|
+
readonly binary: "uint";
|
|
59
|
+
readonly size: 4;
|
|
60
|
+
readonly endianness: "little";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "payload";
|
|
63
|
+
readonly binary: "bytes";
|
|
64
|
+
}];
|
|
65
|
+
//# sourceMappingURL=postMessageLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postMessageLayout.d.ts","sourceRoot":"","sources":["../../src/postMessageLayout.ts"],"names":[],"mappings":"AAEA,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.postMessageLayout = void 0;
|
|
4
|
+
const sdk_connect_1 = require("@wormhole-foundation/sdk-connect");
|
|
5
|
+
/** Binary layout for postMessage account */
|
|
6
|
+
exports.postMessageLayout = [
|
|
7
|
+
{ name: 'discriminator', binary: 'bytes', size: 4 },
|
|
8
|
+
{ name: 'consistencyLevel', binary: 'uint', size: 1, endianness: 'little' },
|
|
9
|
+
{ name: 'emitterAuthority', ...sdk_connect_1.layoutItems.universalAddressItem },
|
|
10
|
+
{ name: 'messageStatus', binary: 'uint', size: 1, endianness: 'little' },
|
|
11
|
+
{ name: 'gap', binary: 'uint', size: 3 },
|
|
12
|
+
{ name: 'timestamp', binary: 'uint', size: 4, endianness: 'little' },
|
|
13
|
+
{ name: 'nonce', binary: 'uint', size: 4, endianness: 'little' },
|
|
14
|
+
{ name: 'sequence', binary: 'uint', size: 8, endianness: 'little' },
|
|
15
|
+
{ name: 'emitterChain', binary: 'uint', size: 2, endianness: 'little' },
|
|
16
|
+
{ name: 'emitterAddress', ...sdk_connect_1.layoutItems.universalAddressItem },
|
|
17
|
+
{ name: 'payloadLength', binary: 'uint', size: 4, endianness: 'little' },
|
|
18
|
+
{ name: 'payload', binary: 'bytes' },
|
|
19
|
+
];
|
|
20
|
+
//# sourceMappingURL=postMessageLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postMessageLayout.js","sourceRoot":"","sources":["../../src/postMessageLayout.ts"],"names":[],"mappings":";;;AAAA,kEAAuE;AAEvE,4CAA4C;AAC/B,QAAA,iBAAiB,GAAG;IAC/B,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE;IACnD,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE;IAC3E,EAAE,IAAI,EAAE,kBAAkB,EAAE,GAAG,yBAAW,CAAC,oBAAoB,EAAE;IACjE,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE;IACxE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE;IACxC,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE;IACpE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE;IAChE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE;IACnE,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE;IACvE,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,yBAAW,CAAC,oBAAoB,EAAE;IAC/D,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE;IACxE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE;CACX,CAAC"}
|
package/dist/esm/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Program } from '@project-serum/anchor';
|
|
2
|
-
import { Connection, TransactionResponse, VersionedTransactionResponse } from '@solana/web3.js';
|
|
2
|
+
import { Connection, PublicKey, TransactionResponse, VersionedTransactionResponse } from '@solana/web3.js';
|
|
3
3
|
import { ChainId, ChainsConfig, Contracts, Network, Platform, UniversalAddress, VAA, WormholeCore, WormholeMessageId } from '@wormhole-foundation/sdk-connect';
|
|
4
4
|
import { AnySolanaAddress, SolanaChains, SolanaUnsignedTransaction } from '@wormhole-foundation/sdk-solana';
|
|
5
5
|
import { Wormhole as WormholeCoreContract } from './types';
|
|
@@ -15,12 +15,18 @@ export declare class SolanaWormholeCore<N extends Network, C extends SolanaChain
|
|
|
15
15
|
protected bridgeData?: BridgeData;
|
|
16
16
|
constructor(network: N, chain: C, connection: Connection, contracts: Contracts);
|
|
17
17
|
static fromRpc<N extends Network>(connection: Connection, config: ChainsConfig<N, Platform>): Promise<SolanaWormholeCore<N, "Solana" | "Pythnet">>;
|
|
18
|
+
private ensureBridgeConfig;
|
|
18
19
|
getMessageFee(): Promise<bigint>;
|
|
20
|
+
getGuardianSetIndex(): Promise<number>;
|
|
19
21
|
publishMessage(sender: AnySolanaAddress, message: Uint8Array, nonce: number, consistencyLevel: number): AsyncGenerator<SolanaUnsignedTransaction<N, C>, void, unknown>;
|
|
20
22
|
verifyMessage(sender: AnySolanaAddress, vaa: VAA): AsyncGenerator<SolanaUnsignedTransaction<N, C>, void, unknown>;
|
|
21
23
|
postVaa(sender: AnySolanaAddress, vaa: VAA): AsyncGenerator<SolanaUnsignedTransaction<N, C>, void, unknown>;
|
|
22
24
|
static parseSequenceFromLog(coreBridgeAddress: string, transaction: VersionedTransactionResponse | TransactionResponse): [UniversalAddress, bigint] | null;
|
|
25
|
+
private getMessageAccountKeys;
|
|
26
|
+
private findBridgeInstructions;
|
|
27
|
+
parsePostMessageAccount(messageAccount: PublicKey): Promise<VAA>;
|
|
23
28
|
parseTransaction(txid: string): Promise<WormholeMessageId[]>;
|
|
29
|
+
parseMessages(txid: string): Promise<VAA[]>;
|
|
24
30
|
private createUnsignedTx;
|
|
25
31
|
}
|
|
26
32
|
//# sourceMappingURL=core.d.ts.map
|
package/dist/esm/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EACL,UAAU,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EACL,UAAU,EAIV,SAAS,EAET,mBAAmB,EACnB,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,OAAO,EACP,YAAY,EACZ,SAAS,EACT,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,GAAG,EACH,YAAY,EACZ,iBAAiB,EAKlB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAEhB,YAAY,EAGZ,yBAAyB,EAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,QAAQ,IAAI,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EACL,UAAU,EAQX,MAAM,SAAS,CAAC;AAKjB,qBAAa,kBAAkB,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,YAAY,CACvE,YAAW,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;IAQ3B,QAAQ,CAAC,OAAO,EAAE,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,QAAQ,CAAC,UAAU,EAAE,UAAU;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS;IAT/B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;gBAGvB,OAAO,EAAE,CAAC,EACV,KAAK,EAAE,CAAC,EACR,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS;WAkBlB,OAAO,CAAC,CAAC,SAAS,OAAO,EACpC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC;YAiBrB,kBAAkB;IAS1B,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKhC,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;IAKrC,cAAc,CACnB,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,MAAM;IA8BnB,aAAa,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG;IAIhD,OAAO,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG;IAkDjD,MAAM,CAAC,oBAAoB,CACzB,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,4BAA4B,GAAG,mBAAmB,GAC9D,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG,IAAI;YA4BtB,qBAAqB;YAoCrB,sBAAsB;IAgC9B,uBAAuB,CAAC,cAAc,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;IA2BhE,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA+C5D,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IA2BjD,OAAO,CAAC,gBAAgB;CAazB"}
|
package/dist/esm/core.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Keypair, Transaction, } from '@solana/web3.js';
|
|
2
|
-
import { toChainId, } from '@wormhole-foundation/sdk-connect';
|
|
2
|
+
import { createVAA, deserializeLayout, toChain, toChainId, } from '@wormhole-foundation/sdk-connect';
|
|
3
3
|
import { SolanaAddress, SolanaPlatform, SolanaUnsignedTransaction, } from '@wormhole-foundation/sdk-solana';
|
|
4
4
|
import { createBridgeFeeTransferInstruction, createPostMessageInstruction, createPostVaaInstruction, createReadOnlyWormholeProgramInterface, createVerifySignaturesInstructions, derivePostedVaaKey, getWormholeBridgeData, } from './utils';
|
|
5
|
+
import { postMessageLayout } from './postMessageLayout';
|
|
5
6
|
const SOLANA_SEQ_LOG = 'Program log: Sequence: ';
|
|
6
7
|
export class SolanaWormholeCore {
|
|
7
8
|
network;
|
|
@@ -31,12 +32,19 @@ export class SolanaWormholeCore {
|
|
|
31
32
|
throw new Error(`Network mismatch for chain ${chain}: ${conf.network} != ${network}`);
|
|
32
33
|
return new SolanaWormholeCore(network, chain, connection, config[chain].contracts);
|
|
33
34
|
}
|
|
34
|
-
async
|
|
35
|
+
async ensureBridgeConfig() {
|
|
35
36
|
// cache lookups since this should not change frequently
|
|
36
37
|
if (!this.bridgeData)
|
|
37
38
|
this.bridgeData = await getWormholeBridgeData(this.connection, this.coreBridge.programId);
|
|
39
|
+
}
|
|
40
|
+
async getMessageFee() {
|
|
41
|
+
await this.ensureBridgeConfig();
|
|
38
42
|
return this.bridgeData.config.fee;
|
|
39
43
|
}
|
|
44
|
+
async getGuardianSetIndex() {
|
|
45
|
+
await this.ensureBridgeConfig();
|
|
46
|
+
return this.bridgeData.guardianSetIndex;
|
|
47
|
+
}
|
|
40
48
|
async *publishMessage(sender, message, nonce, consistencyLevel) {
|
|
41
49
|
const messageAccount = Keypair.generate();
|
|
42
50
|
const payer = new SolanaAddress(sender).unwrap();
|
|
@@ -93,23 +101,7 @@ export class SolanaWormholeCore {
|
|
|
93
101
|
return null;
|
|
94
102
|
return [emitter, BigInt(sequence)];
|
|
95
103
|
}
|
|
96
|
-
async
|
|
97
|
-
const response = await this.connection.getTransaction(txid, {
|
|
98
|
-
maxSupportedTransactionVersion: 0,
|
|
99
|
-
});
|
|
100
|
-
if (!response || !response.meta || !response.meta.innerInstructions)
|
|
101
|
-
throw new Error('transaction not found');
|
|
102
|
-
// The sequence is frequently found in the log, pull from there if we can
|
|
103
|
-
const loggedSeq = SolanaWormholeCore.parseSequenceFromLog(this.coreBridge.programId.toBase58(), response);
|
|
104
|
-
if (loggedSeq)
|
|
105
|
-
return [
|
|
106
|
-
{
|
|
107
|
-
chain: this.chain,
|
|
108
|
-
emitter: loggedSeq[0],
|
|
109
|
-
sequence: loggedSeq[1],
|
|
110
|
-
},
|
|
111
|
-
];
|
|
112
|
-
// Otherwise we need to get it from the message account
|
|
104
|
+
async getMessageAccountKeys(response) {
|
|
113
105
|
// Resolve any LUT accounts if necessary
|
|
114
106
|
let accounts;
|
|
115
107
|
// a string type is indicative of a 'legacy' transaction
|
|
@@ -134,12 +126,17 @@ export class SolanaWormholeCore {
|
|
|
134
126
|
else {
|
|
135
127
|
accounts = response.transaction.message.getAccountKeys();
|
|
136
128
|
}
|
|
129
|
+
return accounts;
|
|
130
|
+
}
|
|
131
|
+
async findBridgeInstructions(accounts, response) {
|
|
137
132
|
// find the instruction where the programId equals the Wormhole ProgramId
|
|
138
|
-
const iix = response
|
|
133
|
+
const iix = response
|
|
134
|
+
.meta.innerInstructions[0].instructions.filter((i) => {
|
|
139
135
|
const programId = accounts.get(i.programIdIndex).toString();
|
|
140
136
|
const wormholeCore = this.coreBridge.programId.toString();
|
|
141
137
|
return programId === wormholeCore;
|
|
142
|
-
})
|
|
138
|
+
})
|
|
139
|
+
.map((ix) => {
|
|
143
140
|
// map over inner ixs to put it in the same format as the compiled instructions
|
|
144
141
|
// from the message
|
|
145
142
|
return {
|
|
@@ -153,23 +150,74 @@ export class SolanaWormholeCore {
|
|
|
153
150
|
return programId === wormholeCore;
|
|
154
151
|
});
|
|
155
152
|
// find the instruction where the programId equals the Wormhole ProgramId
|
|
156
|
-
|
|
153
|
+
return [...iix, ...cix];
|
|
154
|
+
}
|
|
155
|
+
async parsePostMessageAccount(messageAccount) {
|
|
156
|
+
const acctInfo = await this.connection.getAccountInfo(messageAccount);
|
|
157
|
+
if (!acctInfo?.data)
|
|
158
|
+
throw new Error('No data found in message account');
|
|
159
|
+
const { timestamp, emitterAddress, emitterChain, consistencyLevel, sequence, nonce, payload, } = deserializeLayout(postMessageLayout, new Uint8Array(acctInfo?.data));
|
|
160
|
+
return createVAA('Uint8Array', {
|
|
161
|
+
guardianSet: await this.getGuardianSetIndex(),
|
|
162
|
+
emitterChain: toChain(emitterChain),
|
|
163
|
+
timestamp,
|
|
164
|
+
emitterAddress,
|
|
165
|
+
consistencyLevel,
|
|
166
|
+
sequence,
|
|
167
|
+
nonce,
|
|
168
|
+
payload,
|
|
169
|
+
signatures: [],
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
async parseTransaction(txid) {
|
|
173
|
+
const response = await this.connection.getTransaction(txid, {
|
|
174
|
+
maxSupportedTransactionVersion: 0,
|
|
175
|
+
});
|
|
176
|
+
if (!response || !response.meta || !response.meta.innerInstructions)
|
|
177
|
+
throw new Error('transaction not found');
|
|
178
|
+
// The sequence is frequently found in the log, pull from there if we can
|
|
179
|
+
const loggedSeq = SolanaWormholeCore.parseSequenceFromLog(this.coreBridge.programId.toBase58(), response);
|
|
180
|
+
if (loggedSeq)
|
|
181
|
+
return [
|
|
182
|
+
{
|
|
183
|
+
chain: this.chain,
|
|
184
|
+
emitter: loggedSeq[0],
|
|
185
|
+
sequence: loggedSeq[1],
|
|
186
|
+
},
|
|
187
|
+
];
|
|
188
|
+
// Otherwise we need to get it from the message account
|
|
189
|
+
const accounts = await this.getMessageAccountKeys(response);
|
|
190
|
+
const bridgeInstructions = await this.findBridgeInstructions(accounts, response);
|
|
157
191
|
if (!bridgeInstructions || bridgeInstructions.length === 0)
|
|
158
192
|
throw new Error('no bridge messages found');
|
|
159
193
|
const messagePromises = bridgeInstructions.map(async (bi) => {
|
|
160
194
|
const messageAcct = accounts.get(bi.accountKeyIndexes[1]);
|
|
161
|
-
const
|
|
162
|
-
const sequence = acctInfo.data.readBigUInt64LE(49);
|
|
163
|
-
const emitterAddr = new Uint8Array(acctInfo.data.subarray(59, 91));
|
|
164
|
-
const emitter = new SolanaAddress(emitterAddr);
|
|
195
|
+
const vaa = await this.parsePostMessageAccount(messageAcct);
|
|
165
196
|
return {
|
|
166
|
-
chain:
|
|
167
|
-
emitter:
|
|
168
|
-
sequence:
|
|
197
|
+
chain: vaa.emitterChain,
|
|
198
|
+
emitter: vaa.emitterAddress,
|
|
199
|
+
sequence: vaa.sequence,
|
|
169
200
|
};
|
|
170
201
|
});
|
|
171
202
|
return await Promise.all(messagePromises);
|
|
172
203
|
}
|
|
204
|
+
async parseMessages(txid) {
|
|
205
|
+
const response = await this.connection.getTransaction(txid, {
|
|
206
|
+
maxSupportedTransactionVersion: 0,
|
|
207
|
+
});
|
|
208
|
+
if (!response || !response.meta || !response.meta.innerInstructions)
|
|
209
|
+
throw new Error('transaction not found');
|
|
210
|
+
// Otherwise we need to get it from the message account
|
|
211
|
+
const accounts = await this.getMessageAccountKeys(response);
|
|
212
|
+
const bridgeInstructions = await this.findBridgeInstructions(accounts, response);
|
|
213
|
+
if (!bridgeInstructions || bridgeInstructions.length === 0)
|
|
214
|
+
throw new Error('no bridge messages found');
|
|
215
|
+
const messagePromises = bridgeInstructions.map(async (bi) => {
|
|
216
|
+
const messageAcct = accounts.get(bi.accountKeyIndexes[1]);
|
|
217
|
+
return await this.parsePostMessageAccount(messageAcct);
|
|
218
|
+
});
|
|
219
|
+
return await Promise.all(messagePromises);
|
|
220
|
+
}
|
|
173
221
|
createUnsignedTx(txReq, description, parallelizable = false) {
|
|
174
222
|
return new SolanaUnsignedTransaction(txReq, this.network, this.chain, description, parallelizable);
|
|
175
223
|
}
|
package/dist/esm/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,EAIP,WAAW,GAGZ,MAAM,iBAAiB,CAAC;AACzB,OA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
|
2
|
+
export declare const postMessageLayout: readonly [{
|
|
3
|
+
readonly name: "discriminator";
|
|
4
|
+
readonly binary: "bytes";
|
|
5
|
+
readonly size: 4;
|
|
6
|
+
}, {
|
|
7
|
+
readonly name: "consistencyLevel";
|
|
8
|
+
readonly binary: "uint";
|
|
9
|
+
readonly size: 1;
|
|
10
|
+
readonly endianness: "little";
|
|
11
|
+
}, {
|
|
12
|
+
readonly binary: "bytes";
|
|
13
|
+
readonly size: 32;
|
|
14
|
+
readonly custom: {
|
|
15
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-connect").UniversalAddress;
|
|
16
|
+
from: (val: import("@wormhole-foundation/sdk-connect").UniversalAddress) => Uint8Array;
|
|
17
|
+
};
|
|
18
|
+
readonly name: "emitterAuthority";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "messageStatus";
|
|
21
|
+
readonly binary: "uint";
|
|
22
|
+
readonly size: 1;
|
|
23
|
+
readonly endianness: "little";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "gap";
|
|
26
|
+
readonly binary: "uint";
|
|
27
|
+
readonly size: 3;
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "timestamp";
|
|
30
|
+
readonly binary: "uint";
|
|
31
|
+
readonly size: 4;
|
|
32
|
+
readonly endianness: "little";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "nonce";
|
|
35
|
+
readonly binary: "uint";
|
|
36
|
+
readonly size: 4;
|
|
37
|
+
readonly endianness: "little";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "sequence";
|
|
40
|
+
readonly binary: "uint";
|
|
41
|
+
readonly size: 8;
|
|
42
|
+
readonly endianness: "little";
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "emitterChain";
|
|
45
|
+
readonly binary: "uint";
|
|
46
|
+
readonly size: 2;
|
|
47
|
+
readonly endianness: "little";
|
|
48
|
+
}, {
|
|
49
|
+
readonly binary: "bytes";
|
|
50
|
+
readonly size: 32;
|
|
51
|
+
readonly custom: {
|
|
52
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-connect").UniversalAddress;
|
|
53
|
+
from: (val: import("@wormhole-foundation/sdk-connect").UniversalAddress) => Uint8Array;
|
|
54
|
+
};
|
|
55
|
+
readonly name: "emitterAddress";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "payloadLength";
|
|
58
|
+
readonly binary: "uint";
|
|
59
|
+
readonly size: 4;
|
|
60
|
+
readonly endianness: "little";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "payload";
|
|
63
|
+
readonly binary: "bytes";
|
|
64
|
+
}];
|
|
65
|
+
//# sourceMappingURL=postMessageLayout.d.ts.map
|