@actioncodes/protocol 1.1.5 → 1.1.7
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;IA4CtB;;;;;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");
|
@@ -39,7 +42,9 @@ const spl_memo_1 = require("@solana/spl-memo");
|
|
39
42
|
const meta_1 = require("../../meta");
|
40
43
|
const base_1 = require("../base");
|
41
44
|
const nacl = __importStar(require("tweetnacl"));
|
45
|
+
const actioncode_1 = require("../../actioncode");
|
42
46
|
const buffer_1 = require("buffer");
|
47
|
+
const bs58_1 = __importDefault(require("bs58"));
|
43
48
|
/**
|
44
49
|
* Simple Solana adapter for protocol meta operations
|
45
50
|
* Supports both legacy and versioned transactions
|
@@ -330,7 +335,7 @@ class SolanaAdapter extends base_1.BaseChainAdapter {
|
|
330
335
|
const message = this.getCodeSignatureMessage(actionCode.code, actionCode.timestamp, actionCode.prefix);
|
331
336
|
const messageBytes = new TextEncoder().encode(message);
|
332
337
|
const pubkeyBytes = new web3_js_1.PublicKey(actionCode.pubkey).toBytes();
|
333
|
-
const sigBytes =
|
338
|
+
const sigBytes = bs58_1.default.decode(actionCode.signature);
|
334
339
|
return nacl.sign.detached.verify(messageBytes, sigBytes, pubkeyBytes);
|
335
340
|
}
|
336
341
|
catch (error) {
|
@@ -376,13 +381,15 @@ class SolanaAdapter extends base_1.BaseChainAdapter {
|
|
376
381
|
else {
|
377
382
|
throw new Error('Invalid transaction type');
|
378
383
|
}
|
379
|
-
const
|
380
|
-
transaction
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
384
|
+
const updatedTransaction = {
|
385
|
+
...actionCode.transaction,
|
386
|
+
transaction: tx.serialize({ requireAllSignatures: false }).toString('base64'),
|
387
|
+
};
|
388
|
+
const updatedFields = {
|
389
|
+
...actionCode.json,
|
390
|
+
transaction: updatedTransaction,
|
391
|
+
};
|
392
|
+
return actioncode_1.ActionCode.fromPayload(updatedFields);
|
386
393
|
}
|
387
394
|
catch (error) {
|
388
395
|
throw new Error(`Failed to sign transaction with protocol key: ${error instanceof Error ? error.message : 'Unknown error'}`);
|