@wallfree-dev/solana 0.13.42

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.
Files changed (38) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +4 -0
  3. package/index.d.ts +4 -0
  4. package/index.js +24 -0
  5. package/index.js.map +1 -0
  6. package/package.json +64 -0
  7. package/v1/block-explorer/SolanaBlockExplorer.d.ts +9 -0
  8. package/v1/block-explorer/SolanaBlockExplorer.js +72 -0
  9. package/v1/block-explorer/SolanaBlockExplorer.js.map +1 -0
  10. package/v1/module/SolanaModule.d.ts +16 -0
  11. package/v1/module/SolanaModule.js +106 -0
  12. package/v1/module/SolanaModule.js.map +1 -0
  13. package/v1/protocol/SolanaProtocol.d.ts +74 -0
  14. package/v1/protocol/SolanaProtocol.js +694 -0
  15. package/v1/protocol/SolanaProtocol.js.map +1 -0
  16. package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +14 -0
  17. package/v1/serializer/v3/schemas/converter/transaction-converter.js +34 -0
  18. package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
  19. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-solana.d.ts +6 -0
  20. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-solana.js +3 -0
  21. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-solana.js.map +1 -0
  22. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-solana.d.ts +3 -0
  23. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-solana.js +3 -0
  24. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-solana.js.map +1 -0
  25. package/v1/serializer/v3/schemas/generated/transaction-sign-request-solana.json +29 -0
  26. package/v1/serializer/v3/schemas/generated/transaction-sign-response-solana.json +19 -0
  27. package/v1/serializer/v3/serializer-companion.d.ts +14 -0
  28. package/v1/serializer/v3/serializer-companion.js +156 -0
  29. package/v1/serializer/v3/serializer-companion.js.map +1 -0
  30. package/v1/serializer/v3/validators/transaction-validator.d.ts +7 -0
  31. package/v1/serializer/v3/validators/transaction-validator.js +84 -0
  32. package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
  33. package/v1/serializer/v3/validators/validators.d.ts +4 -0
  34. package/v1/serializer/v3/validators/validators.js +69 -0
  35. package/v1/serializer/v3/validators/validators.js.map +1 -0
  36. package/v1/types/protocol.d.ts +16 -0
  37. package/v1/types/protocol.js +3 -0
  38. package/v1/types/protocol.js.map +1 -0
package/LICENSE.md ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2019 Papers AG
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # @wallfree-dev/solana
2
+
3
+ The `@wallfree-dev/solana` package is a Solana implementation of the `ICoinProtocol` interface.
4
+
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { SolanaModule } from './v1/module/SolanaModule';
2
+ import { SolanaProtocol, createSolanaProtocol } from './v1/protocol/SolanaProtocol';
3
+ export { SolanaModule, SolanaProtocol, createSolanaProtocol };
4
+ export * from './v1/types/protocol';
package/index.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.createSolanaProtocol = exports.SolanaProtocol = exports.SolanaModule = void 0;
18
+ var SolanaModule_1 = require("./v1/module/SolanaModule");
19
+ Object.defineProperty(exports, "SolanaModule", { enumerable: true, get: function () { return SolanaModule_1.SolanaModule; } });
20
+ var SolanaProtocol_1 = require("./v1/protocol/SolanaProtocol");
21
+ Object.defineProperty(exports, "SolanaProtocol", { enumerable: true, get: function () { return SolanaProtocol_1.SolanaProtocol; } });
22
+ Object.defineProperty(exports, "createSolanaProtocol", { enumerable: true, get: function () { return SolanaProtocol_1.createSolanaProtocol; } });
23
+ __exportStar(require("./v1/types/protocol"), exports);
24
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAuD;AAG9C,6FAHA,2BAAY,OAGA;AAFrB,+DAAmF;AAE5D,+FAFd,+BAAc,OAEc;AAAE,qGAFd,qCAAoB,OAEc;AAE3D,sDAAmC"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@wallfree-dev/solana",
3
+ "version": "0.13.42",
4
+ "description": "The @wallfree-dev/solana is a Solana implementation of the ICoinProtocol interface from @wallfree-dev/coinlib-core.",
5
+ "keywords": [
6
+ "airgap",
7
+ "blockchain",
8
+ "crypto",
9
+ "solana"
10
+ ],
11
+ "homepage": "https://www.airgap.it",
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/airgap-it/airgap-coin-lib.git"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "scripts": {
21
+ "build": "rm -rf ./dist && tsc && node scripts/copy-files-after-build.js",
22
+ "build-scripts": "tsc scripts/copy-files-after-build.ts",
23
+ "lint": "tslint -c ./tslint.json --project ./tsconfig.json --format stylish --fix",
24
+ "lint:prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
25
+ "lint-ci": "tslint -t json -o ../../lint-reports/solana.json --project . || true",
26
+ "lint-ci:prettier": "prettier \"src/**/*.ts\" \"test/**/*.ts\" --list-different",
27
+ "test": "",
28
+ "test-ci": "nyc --reporter=lcov pnpm test",
29
+ "browserify": "browserify ./dist/index.js -s airgapCoinLibSolana > ./dist/airgap-coinlib-solana.min.js"
30
+ },
31
+ "author": "Papers AG <contact@papers.ch> (https://papers.ch)",
32
+ "dependencies": {
33
+ "@wallfree-dev/coinlib-core": "^0.13.42",
34
+ "@wallfree-dev/module-kit": "^0.13.42",
35
+ "@wallfree-dev/serializer": "^0.13.42",
36
+ "@solana/web3.js": "^1.87.0",
37
+ "bs58": "^4.0.1",
38
+ "tweetnacl": "^1.0.3"
39
+ },
40
+ "nyc": {
41
+ "include": [
42
+ "src/**/*.ts"
43
+ ],
44
+ "exclude": [
45
+ "test/**/*.spec.ts"
46
+ ],
47
+ "extension": [
48
+ ".ts"
49
+ ],
50
+ "require": [
51
+ "ts-node/register"
52
+ ],
53
+ "reporter": [
54
+ "text",
55
+ "text-summary"
56
+ ],
57
+ "report-dir": "../../coverage/solana",
58
+ "sourceMap": true,
59
+ "instrument": true
60
+ },
61
+ "devDependencies": {
62
+ "rimraf": "^6.0.1"
63
+ }
64
+ }
@@ -0,0 +1,9 @@
1
+ import { AirGapBlockExplorer, BlockExplorerMetadata } from '@wallfree-dev/module-kit';
2
+ export declare class SolanaBlockExplorer implements AirGapBlockExplorer {
3
+ private readonly url;
4
+ private readonly metadata;
5
+ constructor(url: string);
6
+ getMetadata(): Promise<BlockExplorerMetadata>;
7
+ createAddressUrl(address: string): Promise<string>;
8
+ createTransactionUrl(transactionId: string): Promise<string>;
9
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.SolanaBlockExplorer = void 0;
40
+ var SolanaBlockExplorer = /** @class */ (function () {
41
+ function SolanaBlockExplorer(url) {
42
+ this.url = url;
43
+ this.metadata = {
44
+ name: 'Solana Explorer',
45
+ url: this.url
46
+ };
47
+ }
48
+ SolanaBlockExplorer.prototype.getMetadata = function () {
49
+ return __awaiter(this, void 0, void 0, function () {
50
+ return __generator(this, function (_a) {
51
+ return [2 /*return*/, this.metadata];
52
+ });
53
+ });
54
+ };
55
+ SolanaBlockExplorer.prototype.createAddressUrl = function (address) {
56
+ return __awaiter(this, void 0, void 0, function () {
57
+ return __generator(this, function (_a) {
58
+ return [2 /*return*/, "".concat(this.url, "/address/").concat(address)];
59
+ });
60
+ });
61
+ };
62
+ SolanaBlockExplorer.prototype.createTransactionUrl = function (transactionId) {
63
+ return __awaiter(this, void 0, void 0, function () {
64
+ return __generator(this, function (_a) {
65
+ return [2 /*return*/, "".concat(this.url, "/tx/").concat(transactionId)];
66
+ });
67
+ });
68
+ };
69
+ return SolanaBlockExplorer;
70
+ }());
71
+ exports.SolanaBlockExplorer = SolanaBlockExplorer;
72
+ //# sourceMappingURL=SolanaBlockExplorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolanaBlockExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/SolanaBlockExplorer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;IAME,6BAAoC,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAL9B,aAAQ,GAA0B;YACjD,IAAI,EAAE,iBAAiB;YACvB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAA;IAEiD,CAAC;IAEtC,yCAAW,GAAxB;;;gBACE,sBAAO,IAAI,CAAC,QAAQ,EAAA;;;KACrB;IAEY,8CAAgB,GAA7B,UAA8B,OAAe;;;gBAC3C,sBAAO,UAAG,IAAI,CAAC,GAAG,sBAAY,OAAO,CAAE,EAAA;;;KACxC;IAEY,kDAAoB,GAAjC,UAAkC,aAAqB;;;gBACrD,sBAAO,UAAG,IAAI,CAAC,GAAG,iBAAO,aAAa,CAAE,EAAA;;;KACzC;IACH,0BAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBY,kDAAmB"}
@@ -0,0 +1,16 @@
1
+ import { AirGapModule, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@wallfree-dev/module-kit';
2
+ import { BlockExplorer } from '@wallfree-dev/module-kit/block-explorer/block-explorer';
3
+ import { OfflineProtocol, OnlineProtocol } from '@wallfree-dev/module-kit/protocol/protocol';
4
+ import { SolanaProtocolNetwork } from '../types/protocol';
5
+ export declare class SolanaModule implements AirGapModule<{
6
+ ProtocolNetwork: SolanaProtocolNetwork;
7
+ }> {
8
+ private readonly networkRegistries;
9
+ readonly supportedProtocols: Record<string, ProtocolConfiguration>;
10
+ constructor();
11
+ createOfflineProtocol(identifier: string): Promise<OfflineProtocol | undefined>;
12
+ createOnlineProtocol(identifier: string, networkOrId?: SolanaProtocolNetwork | string): Promise<OnlineProtocol | undefined>;
13
+ createBlockExplorer(identifier: string, networkOrId?: SolanaProtocolNetwork | string): Promise<BlockExplorer | undefined>;
14
+ createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
15
+ private createProtocol;
16
+ }
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.SolanaModule = void 0;
40
+ var coinlib_core_1 = require("@wallfree-dev/coinlib-core");
41
+ var errors_1 = require("@wallfree-dev/coinlib-core/errors");
42
+ var module_kit_1 = require("@wallfree-dev/module-kit");
43
+ var SolanaBlockExplorer_1 = require("../block-explorer/SolanaBlockExplorer");
44
+ var SolanaProtocol_1 = require("../protocol/SolanaProtocol");
45
+ var serializer_companion_1 = require("../serializer/v3/serializer-companion");
46
+ var SolanaModule = /** @class */ (function () {
47
+ function SolanaModule() {
48
+ var _a;
49
+ var networkRegistry = new module_kit_1.ModuleNetworkRegistry({
50
+ supportedNetworks: [(0, SolanaProtocol_1.createSolanaProtocol)().options.network]
51
+ });
52
+ this.networkRegistries = (_a = {},
53
+ _a[coinlib_core_1.MainProtocolSymbols.SOLANA] = networkRegistry,
54
+ _a);
55
+ this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
56
+ }
57
+ SolanaModule.prototype.createOfflineProtocol = function (identifier) {
58
+ return __awaiter(this, void 0, void 0, function () {
59
+ return __generator(this, function (_a) {
60
+ return [2 /*return*/, this.createProtocol(identifier)];
61
+ });
62
+ });
63
+ };
64
+ SolanaModule.prototype.createOnlineProtocol = function (identifier, networkOrId) {
65
+ var _a;
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ var network;
68
+ return __generator(this, function (_b) {
69
+ network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
70
+ if (network === undefined) {
71
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SOLANA, 'Protocol network type not supported.');
72
+ }
73
+ return [2 /*return*/, this.createProtocol(identifier, network)];
74
+ });
75
+ });
76
+ };
77
+ SolanaModule.prototype.createBlockExplorer = function (identifier, networkOrId) {
78
+ var _a;
79
+ return __awaiter(this, void 0, void 0, function () {
80
+ var network;
81
+ return __generator(this, function (_b) {
82
+ network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
83
+ if (network === undefined) {
84
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SOLANA, 'Block Explorer network type not supported.');
85
+ }
86
+ return [2 /*return*/, new SolanaBlockExplorer_1.SolanaBlockExplorer(network.blockExplorerUrl)];
87
+ });
88
+ });
89
+ };
90
+ SolanaModule.prototype.createV3SerializerCompanion = function () {
91
+ return __awaiter(this, void 0, void 0, function () {
92
+ return __generator(this, function (_a) {
93
+ return [2 /*return*/, new serializer_companion_1.SolanaV3SerializerCompanion()];
94
+ });
95
+ });
96
+ };
97
+ SolanaModule.prototype.createProtocol = function (identifier, network) {
98
+ if (identifier === coinlib_core_1.MainProtocolSymbols.SOLANA) {
99
+ return (0, SolanaProtocol_1.createSolanaProtocol)({ network: network });
100
+ }
101
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SOLANA, "Protocol ".concat(identifier, " not supported."));
102
+ };
103
+ return SolanaModule;
104
+ }());
105
+ exports.SolanaModule = SolanaModule;
106
+ //# sourceMappingURL=SolanaModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolanaModule.js","sourceRoot":"","sources":["../../../src/v1/module/SolanaModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAwE;AACxE,4DAA2E;AAC3E,uDAOiC;AAIjC,6EAA2E;AAC3E,6DAAiE;AACjE,8EAAmF;AAGnF;IAIE;;QACE,IAAM,eAAe,GAA0B,IAAI,kCAAqB,CAAC;YACvE,iBAAiB,EAAE,CAAC,IAAA,qCAAoB,GAAE,CAAC,OAAO,CAAC,OAAO,CAAC;SAC5D,CAAC,CAAA;QAEF,IAAI,CAAC,iBAAiB;YACpB,GAAC,kCAAmB,CAAC,MAAM,IAAG,eAAe;eAC9C,CAAA;QACD,IAAI,CAAC,kBAAkB,GAAG,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAC5E,CAAC;IAEY,4CAAqB,GAAlC,UAAmC,UAAkB;;;gBACnD,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAA;;;KACvC;IAEY,2CAAoB,GAAjC,UACE,UAAkB,EAClB,WAA4C;;;;;gBAEtC,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAA;gBAE9G,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,MAAM,EAAE,sCAAsC,CAAC,CAAA;iBACzF;gBAED,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,EAAA;;;KAChD;IAEY,0CAAmB,GAAhC,UAAiC,UAAkB,EAAE,WAA4C;;;;;gBACzF,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAA;gBAE9G,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,MAAM,EAAE,4CAA4C,CAAC,CAAA;iBAC/F;gBAED,sBAAO,IAAI,yCAAmB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAA;;;KACzD;IAEY,kDAA2B,GAAxC;;;gBACE,sBAAO,IAAI,kDAA2B,EAAE,EAAA;;;KACzC;IAEO,qCAAc,GAAtB,UAAuB,UAAkB,EAAE,OAAyB;QAClE,IAAI,UAAU,KAAK,kCAAmB,CAAC,MAAM,EAAE;YAC7C,OAAO,IAAA,qCAAoB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;SACzC;QAED,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,MAAM,EAAE,mBAAY,UAAU,oBAAiB,CAAC,CAAA;IAC3F,CAAC;IACH,mBAAC;AAAD,CAAC,AAvDD,IAuDC;AAvDY,oCAAY"}
@@ -0,0 +1,74 @@
1
+ import { AirGapProtocol, AirGapTransaction, AirGapTransactionStatus, AirGapTransactionsWithCursor, Amount, Balance, CryptoDerivative, FeeDefaults, KeyPair, ProtocolMetadata, ProtocolUnitsMetadata, PublicKey, SecretKey, Signature, TransactionDetails, TransactionFullConfiguration, TransactionSimpleConfiguration, ExtendedKeyPair, ExtendedPublicKey, ExtendedSecretKey, RecursivePartial } from '@wallfree-dev/module-kit';
2
+ import { SolanaAddressResult, SolanaProtocolNetwork, SolanaProtocolOptions, SolanaUnits } from '../types/protocol';
3
+ export declare const SOLANA_UNITS_METADATA: ProtocolUnitsMetadata<SolanaUnits>;
4
+ export declare class SolanaProtocol implements AirGapProtocol<{
5
+ AddressResult: string;
6
+ ProtocolNetwork: SolanaProtocolNetwork;
7
+ CryptoConfiguration: {
8
+ algorithm: 'ed25519';
9
+ };
10
+ Units: SolanaUnits;
11
+ FeeUnits: SolanaUnits;
12
+ FeeEstimation: FeeDefaults<SolanaUnits>;
13
+ SignedTransaction: {
14
+ serialized: string;
15
+ type: 'signed';
16
+ };
17
+ UnsignedTransaction: {
18
+ serialized: string;
19
+ type: 'unsigned';
20
+ };
21
+ TransactionCursor: any;
22
+ }, 'Crypto'> {
23
+ readonly options: SolanaProtocolOptions;
24
+ constructor(options: SolanaProtocolOptions);
25
+ getMetadata(): Promise<ProtocolMetadata<SolanaUnits, SolanaUnits>>;
26
+ private getPublicKeyBuffer;
27
+ getAddressFromPublicKey(publicKey: PublicKey | ExtendedPublicKey): Promise<string>;
28
+ getAddressesFromPublicKey(publicKey: PublicKey | ExtendedPublicKey): Promise<SolanaAddressResult[]>;
29
+ getBalanceOfAddress(address: string): Promise<Balance<SolanaUnits>>;
30
+ getBalanceOfPublicKey(publicKey: PublicKey | ExtendedPublicKey): Promise<Balance<SolanaUnits>>;
31
+ getDetailsFromTransaction(transaction: {
32
+ serialized: string;
33
+ type: 'signed' | 'unsigned';
34
+ }, publicKey: PublicKey | ExtendedPublicKey): Promise<AirGapTransaction<SolanaUnits, SolanaUnits>[]>;
35
+ getTransactionDetailsFromSigned(signedTx: {
36
+ transaction: {
37
+ serialized: string;
38
+ type: 'signed' | 'unsigned';
39
+ };
40
+ }): Promise<AirGapTransaction<SolanaUnits, SolanaUnits>[]>;
41
+ verifyMessageWithPublicKey(message: string, signature: Signature, publicKey: PublicKey | ExtendedPublicKey): Promise<boolean>;
42
+ encryptAsymmetricWithPublicKey(payload: string, publicKey: PublicKey | ExtendedPublicKey): Promise<string>;
43
+ getCryptoConfiguration(): Promise<{
44
+ algorithm: 'ed25519';
45
+ }>;
46
+ getKeyPairFromDerivative(derivative: CryptoDerivative): Promise<KeyPair>;
47
+ signTransactionWithSecretKey(transaction: {
48
+ serialized: string;
49
+ type: 'unsigned';
50
+ }, secretKey: SecretKey | ExtendedSecretKey): Promise<{
51
+ serialized: string;
52
+ type: 'signed';
53
+ }>;
54
+ signMessageWithKeyPair(message: string, keyPair: KeyPair | ExtendedKeyPair): Promise<Signature>;
55
+ decryptAsymmetricWithKeyPair(payload: string, keyPair: KeyPair | ExtendedKeyPair): Promise<string>;
56
+ encryptAESWithSecretKey(payload: string, secretKey: SecretKey | ExtendedSecretKey): Promise<string>;
57
+ decryptAESWithSecretKey(payload: string, secretKey: SecretKey | ExtendedSecretKey): Promise<string>;
58
+ getNetwork(): Promise<SolanaProtocolNetwork>;
59
+ getTransactionsForAddress(address: string, limit: number, cursor?: any): Promise<AirGapTransactionsWithCursor<any, SolanaUnits, SolanaUnits>>;
60
+ getTransactionsForPublicKey(publicKey: PublicKey | ExtendedPublicKey, limit: number, cursor?: any): Promise<AirGapTransactionsWithCursor<any, SolanaUnits, SolanaUnits>>;
61
+ getTransactionStatus(transactionIds: string[]): Promise<Record<string, AirGapTransactionStatus>>;
62
+ getTransactionMaxAmountWithPublicKey(publicKey: PublicKey | ExtendedPublicKey, to: string[], configuration?: TransactionFullConfiguration<SolanaUnits>): Promise<Amount<SolanaUnits>>;
63
+ getTransactionFeeWithPublicKey(publicKey: PublicKey | ExtendedPublicKey, details: TransactionDetails<SolanaUnits>[], configuration?: TransactionSimpleConfiguration): Promise<FeeDefaults<SolanaUnits>>;
64
+ prepareTransactionWithPublicKey(publicKey: PublicKey | ExtendedPublicKey, details: TransactionDetails<SolanaUnits>[], configuration?: TransactionFullConfiguration<SolanaUnits>): Promise<{
65
+ serialized: string;
66
+ type: 'unsigned';
67
+ }>;
68
+ broadcastTransaction(transaction: {
69
+ serialized: string;
70
+ type: 'signed';
71
+ }): Promise<string>;
72
+ getTokenBalancesOfPublicKey(publicKey: PublicKey | ExtendedPublicKey, tokens: any[]): Promise<Record<string, Amount<SolanaUnits>>>;
73
+ }
74
+ export declare function createSolanaProtocol(options?: RecursivePartial<SolanaProtocolOptions>): SolanaProtocol;