@airgap/mina 0.13.19-beta.10
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/LICENSE.md +7 -0
- package/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +63 -0
- package/readme.md +121 -0
- package/v1/block-explorer/MinaExplorerBlockExplorer.d.ts +9 -0
- package/v1/block-explorer/MinaExplorerBlockExplorer.js +72 -0
- package/v1/block-explorer/MinaExplorerBlockExplorer.js.map +1 -0
- package/v1/index.d.ts +8 -0
- package/v1/index.js +8 -0
- package/v1/index.js.map +1 -0
- package/v1/indexer/MinaExplorerIndexer.d.ts +8 -0
- package/v1/indexer/MinaExplorerIndexer.js +116 -0
- package/v1/indexer/MinaExplorerIndexer.js.map +1 -0
- package/v1/indexer/MinaIndexer.d.ts +5 -0
- package/v1/indexer/MinaIndexer.js +3 -0
- package/v1/indexer/MinaIndexer.js.map +1 -0
- package/v1/module/MinaModule.d.ts +12 -0
- package/v1/module/MinaModule.js +109 -0
- package/v1/module/MinaModule.js.map +1 -0
- package/v1/module.d.ts +3 -0
- package/v1/module.js +24 -0
- package/v1/module.js.map +1 -0
- package/v1/node/GraphQLNode.d.ts +10 -0
- package/v1/node/GraphQLNode.js +115 -0
- package/v1/node/GraphQLNode.js.map +1 -0
- package/v1/node/MinaNode.d.ts +7 -0
- package/v1/node/MinaNode.js +3 -0
- package/v1/node/MinaNode.js.map +1 -0
- package/v1/protocol/MinaProtocol.d.ts +47 -0
- package/v1/protocol/MinaProtocol.js +410 -0
- package/v1/protocol/MinaProtocol.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +7 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +37 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-mina.d.ts +4 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-mina.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-mina.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-mina.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-mina.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-mina.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-mina.json +61 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-mina.json +19 -0
- package/v1/serializer/v3/serializer-companion.d.ts +13 -0
- package/v1/serializer/v3/serializer-companion.js +173 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validator.d.ts +7 -0
- package/v1/serializer/v3/validators/transaction-validator.js +90 -0
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
- package/v1/serializer/v3/validators/validators.d.ts +5 -0
- package/v1/serializer/v3/validators/validators.js +118 -0
- package/v1/serializer/v3/validators/validators.js.map +1 -0
- package/v1/types/crypto.d.ts +2 -0
- package/v1/types/crypto.js +3 -0
- package/v1/types/crypto.js.map +1 -0
- package/v1/types/indexer.d.ts +12 -0
- package/v1/types/indexer.js +5 -0
- package/v1/types/indexer.js.map +1 -0
- package/v1/types/node.d.ts +4 -0
- package/v1/types/node.js +3 -0
- package/v1/types/node.js.map +1 -0
- package/v1/types/protocol.d.ts +10 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
- package/v1/types/transaction.d.ts +32 -0
- package/v1/types/transaction.js +3 -0
- package/v1/types/transaction.js.map +1 -0
- package/v1/utils/key.d.ts +5 -0
- package/v1/utils/key.js +40 -0
- package/v1/utils/key.js.map +1 -0
- package/v1/utils/math.d.ts +5 -0
- package/v1/utils/math.js +24 -0
- package/v1/utils/math.js.map +1 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
+
export declare type MinaUnits = 'MINA';
|
|
3
|
+
export declare type MinaNetworkType = 'mainnet' | 'testnet';
|
|
4
|
+
export interface MinaProtocolNetwork extends ProtocolNetwork {
|
|
5
|
+
blockExplorerApi: string;
|
|
6
|
+
minaType: MinaNetworkType;
|
|
7
|
+
}
|
|
8
|
+
export interface MinaProtocolOptions {
|
|
9
|
+
network: MinaProtocolNetwork;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/v1/types/protocol.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SignedTransaction, TransactionCursor, UnsignedTransaction } from '@airgap/module-kit';
|
|
2
|
+
import { MinaNetworkType } from './protocol';
|
|
3
|
+
export interface MinaPayment {
|
|
4
|
+
to: string;
|
|
5
|
+
from: string;
|
|
6
|
+
amount: string;
|
|
7
|
+
fee: string;
|
|
8
|
+
nonce: string;
|
|
9
|
+
memo?: string;
|
|
10
|
+
validUntil?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MinaRawSignature {
|
|
13
|
+
type: 'raw';
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
export interface MinaLegacySignature {
|
|
17
|
+
type: 'legacy';
|
|
18
|
+
field: string;
|
|
19
|
+
scalar: string;
|
|
20
|
+
}
|
|
21
|
+
export declare type MinaSignature = MinaRawSignature | MinaLegacySignature;
|
|
22
|
+
export interface MinaUnsignedTransaction extends UnsignedTransaction {
|
|
23
|
+
networkType: MinaNetworkType;
|
|
24
|
+
data: MinaPayment;
|
|
25
|
+
}
|
|
26
|
+
export interface MinaSignedTransaction extends SignedTransaction {
|
|
27
|
+
data: MinaPayment;
|
|
28
|
+
signature: MinaSignature;
|
|
29
|
+
}
|
|
30
|
+
export interface MinaTransactionCursor extends TransactionCursor {
|
|
31
|
+
lastDateTime?: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/v1/types/transaction.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { PublicKey, SecretKey } from '@airgap/module-kit';
|
|
3
|
+
import Client from 'mina-signer';
|
|
4
|
+
export declare function finalizeSecretKey(rawSecretKey: Buffer): SecretKey;
|
|
5
|
+
export declare function derivePublicKey(client: Client, secretKey: SecretKey): PublicKey;
|
package/v1/utils/key.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.derivePublicKey = exports.finalizeSecretKey = void 0;
|
|
27
|
+
var bs58check = __importStar(require("@airgap/coinlib-core/dependencies/src/bs58check-2.1.2"));
|
|
28
|
+
var module_kit_1 = require("@airgap/module-kit");
|
|
29
|
+
function finalizeSecretKey(rawSecretKey) {
|
|
30
|
+
rawSecretKey[0] &= 0x3f;
|
|
31
|
+
var secretKey = Buffer.concat([Buffer.from('5a01', 'hex'), rawSecretKey.reverse()]);
|
|
32
|
+
return (0, module_kit_1.newSecretKey)(bs58check.encode(secretKey), 'encoded');
|
|
33
|
+
}
|
|
34
|
+
exports.finalizeSecretKey = finalizeSecretKey;
|
|
35
|
+
function derivePublicKey(client, secretKey) {
|
|
36
|
+
var publicKey = client.derivePublicKey(secretKey.value);
|
|
37
|
+
return (0, module_kit_1.newPublicKey)(publicKey, 'encoded');
|
|
38
|
+
}
|
|
39
|
+
exports.derivePublicKey = derivePublicKey;
|
|
40
|
+
//# sourceMappingURL=key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../../src/v1/utils/key.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+FAAkF;AAClF,iDAAqF;AAGrF,SAAgB,iBAAiB,CAAC,YAAoB;IACpD,YAAY,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA;IACvB,IAAM,SAAS,GAAW,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;IAE7F,OAAO,IAAA,yBAAY,EAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAA;AAC7D,CAAC;AALD,8CAKC;AAED,SAAgB,eAAe,CAAC,MAAc,EAAE,SAAoB;IAClE,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAEzD,OAAO,IAAA,yBAAY,EAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAC3C,CAAC;AAJD,0CAIC"}
|
package/v1/utils/math.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.quantile = void 0;
|
|
7
|
+
var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
8
|
+
function quantile(values, q, options) {
|
|
9
|
+
if (options === void 0) { options = { isSorted: false }; }
|
|
10
|
+
var bigNumberValues = values.map(function (value) {
|
|
11
|
+
return bignumber_1.default.isBigNumber(value) ? value : new bignumber_1.default(value);
|
|
12
|
+
});
|
|
13
|
+
var sortedValues = options.isSorted ? bigNumberValues : bigNumberValues.sort();
|
|
14
|
+
var index = Math.floor((sortedValues.length - 1) * q);
|
|
15
|
+
if (sortedValues.length % 2 !== 0 || index === sortedValues.length - 1) {
|
|
16
|
+
return sortedValues[index];
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
var avg = sortedValues[index].plus(sortedValues[index + 1]).div(2);
|
|
20
|
+
return options.roundingMode ? avg.integerValue(options.roundingMode) : avg;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.quantile = quantile;
|
|
24
|
+
//# sourceMappingURL=math.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.js","sourceRoot":"","sources":["../../../src/v1/utils/math.ts"],"names":[],"mappings":";;;;;;AAAA,iHAA0F;AAE1F,SAAgB,QAAQ,CACtB,MAAuC,EACvC,CAAS,EACT,OAGuB;IAHvB,wBAAA,EAAA,YAGM,QAAQ,EAAE,KAAK,EAAE;IAEvB,IAAM,eAAe,GAAgB,MAAM,CAAC,GAAG,CAAC,UAAC,KAAkC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