@wormhole-foundation/sdk-aptos-core 0.5.0-alpha.1 → 0.5.0-alpha.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/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +8 -10
- package/dist/cjs/core.d.ts +0 -20
- package/dist/cjs/core.d.ts.map +0 -1
- package/dist/cjs/core.js +0 -79
- package/dist/cjs/core.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js +0 -9
- package/dist/cjs/index.js.map +0 -1
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AptosWormholeCore } from "./core";
|
|
1
|
+
export { AptosWormholeCore } from "./core.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { registerProtocol } from "@wormhole-foundation/sdk-connect";
|
|
2
|
-
import { AptosWormholeCore } from "./core";
|
|
2
|
+
import { AptosWormholeCore } from "./core.js";
|
|
3
3
|
registerProtocol("Aptos", "WormholeCore", AptosWormholeCore);
|
|
4
|
-
export { AptosWormholeCore } from "./core";
|
|
4
|
+
export { AptosWormholeCore } from "./core.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wormhole-foundation/sdk-aptos-core",
|
|
3
|
-
"version": "0.5.0-alpha.
|
|
3
|
+
"version": "0.5.0-alpha.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/wormhole-foundation/connect-sdk.git"
|
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
"test": "__tests__"
|
|
14
14
|
},
|
|
15
15
|
"license": "Apache-2.0",
|
|
16
|
-
"main": "./dist/
|
|
16
|
+
"main": "./dist/esm/index.js",
|
|
17
17
|
"module": "./dist/esm/index.js",
|
|
18
|
-
"types": "./dist/
|
|
19
|
-
"author": "",
|
|
18
|
+
"types": "./dist/esm/index.d.ts",
|
|
20
19
|
"description": "SDK for Solana, used in conjunction with @wormhole-foundation/connect-sdk",
|
|
21
20
|
"files": [
|
|
22
|
-
"dist/cjs",
|
|
23
21
|
"dist/esm"
|
|
24
22
|
],
|
|
25
23
|
"keywords": [
|
|
@@ -35,8 +33,7 @@
|
|
|
35
33
|
"sideEffects": true,
|
|
36
34
|
"scripts": {
|
|
37
35
|
"build:cjs": "tsc -p ./tsconfig.cjs.json",
|
|
38
|
-
"build
|
|
39
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
36
|
+
"build": "tsc -p ./tsconfig.esm.json",
|
|
40
37
|
"rebuild": "npm run clean && npm run build",
|
|
41
38
|
"clean": "rm -rf ./dist && rm -rf ./.turbo",
|
|
42
39
|
"lint": "npm run prettier && eslint --fix ./src --ext .ts",
|
|
@@ -46,7 +43,8 @@
|
|
|
46
43
|
"nock": "^13.3.3"
|
|
47
44
|
},
|
|
48
45
|
"dependencies": {
|
|
49
|
-
"@wormhole-foundation/sdk-connect": "0.5.0-alpha.
|
|
50
|
-
"@wormhole-foundation/sdk-aptos": "0.5.0-alpha.
|
|
51
|
-
}
|
|
46
|
+
"@wormhole-foundation/sdk-connect": "0.5.0-alpha.2",
|
|
47
|
+
"@wormhole-foundation/sdk-aptos": "0.5.0-alpha.2"
|
|
48
|
+
},
|
|
49
|
+
"type": "module"
|
|
52
50
|
}
|
package/dist/cjs/core.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ChainId, ChainsConfig, Contracts, Network, UnsignedTransaction, VAA, WormholeCore, WormholeMessageId } from "@wormhole-foundation/sdk-connect";
|
|
2
|
-
import type { AnyAptosAddress, AptosChains, AptosPlatformType } from "@wormhole-foundation/sdk-aptos";
|
|
3
|
-
import type { AptosClient } from "aptos";
|
|
4
|
-
export declare class AptosWormholeCore<N extends Network, C extends AptosChains> implements WormholeCore<N, C> {
|
|
5
|
-
readonly network: N;
|
|
6
|
-
readonly chain: C;
|
|
7
|
-
readonly connection: AptosClient;
|
|
8
|
-
readonly contracts: Contracts;
|
|
9
|
-
readonly chainId: ChainId;
|
|
10
|
-
readonly coreBridge: string;
|
|
11
|
-
private constructor();
|
|
12
|
-
getGuardianSetIndex(): Promise<number>;
|
|
13
|
-
getMessageFee(): Promise<bigint>;
|
|
14
|
-
static fromRpc<N extends Network>(connection: AptosClient, config: ChainsConfig<N, AptosPlatformType>): Promise<AptosWormholeCore<N, AptosChains>>;
|
|
15
|
-
publishMessage(sender: AnyAptosAddress, message: string | Uint8Array): AsyncGenerator<UnsignedTransaction<N, C>>;
|
|
16
|
-
verifyMessage(sender: AnyAptosAddress, vaa: VAA): AsyncGenerator<never, void, unknown>;
|
|
17
|
-
parseTransaction(txid: string): Promise<WormholeMessageId[]>;
|
|
18
|
-
parseMessages(txid: string): Promise<VAA[]>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=core.d.ts.map
|
package/dist/cjs/core.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EACZ,SAAS,EACT,OAAO,EACP,mBAAmB,EACnB,GAAG,EACH,YAAY,EACZ,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,iBAAiB,EAClB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAS,MAAM,OAAO,CAAC;AAEhD,qBAAa,iBAAiB,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,WAAW,CACrE,YAAW,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;IAM3B,QAAQ,CAAC,OAAO,EAAE,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,QAAQ,CAAC,UAAU,EAAE,WAAW;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS;IAP/B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,OAAO;IAYP,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;IAGtC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;WAInB,OAAO,CAAC,CAAC,SAAS,OAAO,EACpC,UAAU,EAAE,WAAW,EACvB,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE,iBAAiB,CAAC,GACzC,OAAO,CAAC,iBAAiB,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IAQtC,cAAc,CACnB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,MAAM,GAAG,UAAU,GAC3B,cAAc,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAGrC,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,GAAG;IAIhD,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAW5D,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;CAqClD"}
|
package/dist/cjs/core.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AptosWormholeCore = void 0;
|
|
4
|
-
const sdk_connect_1 = require("@wormhole-foundation/sdk-connect");
|
|
5
|
-
const sdk_aptos_1 = require("@wormhole-foundation/sdk-aptos");
|
|
6
|
-
class AptosWormholeCore {
|
|
7
|
-
network;
|
|
8
|
-
chain;
|
|
9
|
-
connection;
|
|
10
|
-
contracts;
|
|
11
|
-
chainId;
|
|
12
|
-
coreBridge;
|
|
13
|
-
constructor(network, chain, connection, contracts) {
|
|
14
|
-
this.network = network;
|
|
15
|
-
this.chain = chain;
|
|
16
|
-
this.connection = connection;
|
|
17
|
-
this.contracts = contracts;
|
|
18
|
-
this.chainId = (0, sdk_connect_1.toChainId)(chain);
|
|
19
|
-
const coreBridgeAddress = contracts.coreBridge;
|
|
20
|
-
if (!coreBridgeAddress)
|
|
21
|
-
throw new Error(`CoreBridge contract Address for chain ${chain} not found`);
|
|
22
|
-
this.coreBridge = coreBridgeAddress;
|
|
23
|
-
}
|
|
24
|
-
getGuardianSetIndex() {
|
|
25
|
-
throw new Error("Method not implemented.");
|
|
26
|
-
}
|
|
27
|
-
getMessageFee() {
|
|
28
|
-
throw new Error("Method not implemented.");
|
|
29
|
-
}
|
|
30
|
-
static async fromRpc(connection, config) {
|
|
31
|
-
const [network, chain] = await sdk_aptos_1.AptosPlatform.chainFromRpc(connection);
|
|
32
|
-
const conf = config[chain];
|
|
33
|
-
if (conf.network !== network)
|
|
34
|
-
throw new Error(`Network mismatch: ${conf.network} !== ${network}`);
|
|
35
|
-
return new AptosWormholeCore(network, chain, connection, conf.contracts);
|
|
36
|
-
}
|
|
37
|
-
async *publishMessage(sender, message) {
|
|
38
|
-
throw new Error("Method not implemented.");
|
|
39
|
-
}
|
|
40
|
-
async *verifyMessage(sender, vaa) {
|
|
41
|
-
throw new Error("Not implemented.");
|
|
42
|
-
}
|
|
43
|
-
async parseTransaction(txid) {
|
|
44
|
-
const msgs = await this.parseMessages(txid);
|
|
45
|
-
return msgs.map((message) => {
|
|
46
|
-
return {
|
|
47
|
-
chain: message.emitterChain,
|
|
48
|
-
emitter: message.emitterAddress,
|
|
49
|
-
sequence: message.sequence,
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
async parseMessages(txid) {
|
|
54
|
-
const transaction = await this.connection.getTransactionByHash(txid);
|
|
55
|
-
if (transaction.type !== "user_transaction")
|
|
56
|
-
throw new Error(`${txid} is not a user_transaction`);
|
|
57
|
-
const userTransaction = transaction;
|
|
58
|
-
const messages = userTransaction.events.filter((event) => event.type.endsWith("WormholeMessage"));
|
|
59
|
-
if (!messages || messages.length === 0)
|
|
60
|
-
throw new Error(`WormholeMessage not found for ${txid}`);
|
|
61
|
-
return messages.map((message) => {
|
|
62
|
-
const msg = message.data;
|
|
63
|
-
const emitter = new sdk_connect_1.UniversalAddress(BigInt(msg.sender).toString(16).padStart(64, "0"));
|
|
64
|
-
return (0, sdk_connect_1.createVAA)("Uint8Array", {
|
|
65
|
-
guardianSet: 0,
|
|
66
|
-
emitterChain: this.chain,
|
|
67
|
-
emitterAddress: emitter,
|
|
68
|
-
sequence: BigInt(msg.sequence),
|
|
69
|
-
timestamp: Number(msg.timestamp),
|
|
70
|
-
consistencyLevel: msg.consistency_level,
|
|
71
|
-
nonce: Number(msg.nonce),
|
|
72
|
-
signatures: [],
|
|
73
|
-
payload: sdk_connect_1.encoding.hex.decode(msg.payload),
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.AptosWormholeCore = AptosWormholeCore;
|
|
79
|
-
//# sourceMappingURL=core.js.map
|
package/dist/cjs/core.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":";;;AAUA,kEAAoG;AAMpG,8DAA+D;AAG/D,MAAa,iBAAiB;IAOjB;IACA;IACA;IACA;IAPF,OAAO,CAAU;IACjB,UAAU,CAAS;IAE5B,YACW,OAAU,EACV,KAAQ,EACR,UAAuB,EACvB,SAAoB;QAHpB,YAAO,GAAP,OAAO,CAAG;QACV,UAAK,GAAL,KAAK,CAAG;QACR,eAAU,GAAV,UAAU,CAAa;QACvB,cAAS,GAAT,SAAS,CAAW;QAE7B,IAAI,CAAC,OAAO,GAAG,IAAA,uBAAS,EAAC,KAAK,CAAC,CAAC;QAChC,MAAM,iBAAiB,GAAG,SAAS,CAAC,UAAU,CAAC;QAC/C,IAAI,CAAC,iBAAiB;YACpB,MAAM,IAAI,KAAK,CAAC,yCAAyC,KAAK,YAAY,CAAC,CAAC;QAC9E,IAAI,CAAC,UAAU,GAAG,iBAAiB,CAAC;IACtC,CAAC;IACD,mBAAmB;QACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,aAAa;QACX,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,UAAuB,E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":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AptosWormholeCore = void 0;
|
|
4
|
-
const sdk_connect_1 = require("@wormhole-foundation/sdk-connect");
|
|
5
|
-
const core_1 = require("./core");
|
|
6
|
-
(0, sdk_connect_1.registerProtocol)("Aptos", "WormholeCore", core_1.AptosWormholeCore);
|
|
7
|
-
var core_2 = require("./core");
|
|
8
|
-
Object.defineProperty(exports, "AptosWormholeCore", { enumerable: true, get: function () { return core_2.AptosWormholeCore; } });
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,kEAAoE;AACpE,iCAA2C;AAE3C,IAAA,8BAAgB,EAAC,OAAO,EAAE,cAAc,EAAE,wBAAiB,CAAC,CAAC;AAE7D,+BAA2C;AAAlC,yGAAA,iBAAiB,OAAA"}
|