@actioncodes/protocol 1.1.4 → 1.1.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.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../../src/adapters/solana/solana.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EAGpB,OAAO,EACP,4BAA4B,EAC/B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,cAAc,EAAsB,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../../src/adapters/solana/solana.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EAGpB,OAAO,EACP,4BAA4B,EAC/B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,cAAc,EAAsB,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI9C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,oBAAoB,CAAC;AAEnE;;;GAGG;AACH,qBAAa,aAAc,SAAQ,gBAAgB,CAAC,iBAAiB,CAAC;IAClE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAmB;IAE1D,QAAQ,CAAC,KAAK,YAAY;IAE1B;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,sBAAsB;IAgBxD;;;;OAIG;IACH,UAAU,CAAC,EAAE,EAAE,iBAAiB,GAAG,MAAM,GAAG,cAAc,GAAG,IAAI;IAoBjE;;;;OAIG;IACI,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,iBAAiB;IActE;;;;;OAKG;IACH,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM;IA2E9D;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,cAAc,GAAE,MAAkB,GAAG,OAAO;IAInG;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,EAAE,iBAAiB,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAoB3E;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAqB/B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAUlC;;OAEG;IACH,OAAO,CAAC,eAAe;IAuBvB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAMhC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAenC;;;;;OAKG;IACH,SAAS,CAAC,4BAA4B,CAAC,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO;IA6BrF,mBAAmB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;IAa3D;;;;OAIG;IACH,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAI7D;;;;;OAKG;IACG,mBAAmB,CACrB,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,OAAO,GACb,OAAO,CAAC,UAAU,CAAC;IAyCtB;;;;;OAKG;IACH,0BAA0B,CAAC,EAAE,EAAE,4BAA4B,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO;CAwHhG"}
|
@@ -32,6 +32,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
32
32
|
return result;
|
33
33
|
};
|
34
34
|
})();
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
37
|
+
};
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
36
39
|
exports.SolanaAdapter = void 0;
|
37
40
|
const web3_js_1 = require("@solana/web3.js");
|
@@ -40,6 +43,7 @@ const meta_1 = require("../../meta");
|
|
40
43
|
const base_1 = require("../base");
|
41
44
|
const nacl = __importStar(require("tweetnacl"));
|
42
45
|
const buffer_1 = require("buffer");
|
46
|
+
const bs58_1 = __importDefault(require("bs58"));
|
43
47
|
/**
|
44
48
|
* Simple Solana adapter for protocol meta operations
|
45
49
|
* Supports both legacy and versioned transactions
|
@@ -330,7 +334,7 @@ class SolanaAdapter extends base_1.BaseChainAdapter {
|
|
330
334
|
const message = this.getCodeSignatureMessage(actionCode.code, actionCode.timestamp, actionCode.prefix);
|
331
335
|
const messageBytes = new TextEncoder().encode(message);
|
332
336
|
const pubkeyBytes = new web3_js_1.PublicKey(actionCode.pubkey).toBytes();
|
333
|
-
const sigBytes =
|
337
|
+
const sigBytes = bs58_1.default.decode(actionCode.signature);
|
334
338
|
return nacl.sign.detached.verify(messageBytes, sigBytes, pubkeyBytes);
|
335
339
|
}
|
336
340
|
catch (error) {
|
package/dist/protocol.js
CHANGED
@@ -89,14 +89,14 @@ class ActionCodesProtocol {
|
|
89
89
|
throw new Error(`No adapter found for chain '${chain}'`);
|
90
90
|
}
|
91
91
|
const ts = timestamp || Date.now();
|
92
|
-
const { code,
|
93
|
-
const message = adapter.getCodeSignatureMessage(code,
|
92
|
+
const { code, expiresAt } = codegen_1.CodeGenerator.generateCode(pubkey, prefix, ts);
|
93
|
+
const message = adapter.getCodeSignatureMessage(code, ts, prefix);
|
94
94
|
const signature = await signFn(message);
|
95
95
|
const actionCode = actioncode_1.ActionCode.fromPayload({
|
96
96
|
code,
|
97
97
|
pubkey,
|
98
98
|
signature,
|
99
|
-
timestamp:
|
99
|
+
timestamp: ts,
|
100
100
|
expiresAt,
|
101
101
|
prefix,
|
102
102
|
chain,
|