├── README-doc.md ├── README.md ├── dist ├── PrivateKey.d.ts ├── PrivateKey.js ├── PrivateKey.js.map ├── PublicKey.d.ts ├── PublicKey.js ├── PublicKey.js.map ├── Signature.d.ts ├── Signature.js ├── Signature.js.map ├── index.d.ts ├── index.js ├── index.js.map ├── inery-api-interfaces.doc.js ├── ineryjs-api-interfaces.d.ts ├── ineryjs-api-interfaces.js ├── ineryjs-api-interfaces.js.map ├── ineryjs-api.d.ts ├── ineryjs-api.js ├── ineryjs-api.js.map ├── ineryjs-ecc-migration.d.ts ├── ineryjs-ecc-migration.js ├── ineryjs-ecc-migration.js.map ├── ineryjs-jsonrpc.d.ts ├── ineryjs-jsonrpc.js ├── ineryjs-jsonrpc.js.map ├── ineryjs-jssig.d.ts ├── ineryjs-jssig.js ├── ineryjs-jssig.js.map ├── ineryjs-key-conversions.d.ts ├── ineryjs-key-conversions.js ├── ineryjs-key-conversions.js.map ├── ineryjs-numeric.d.ts ├── ineryjs-numeric.js ├── ineryjs-numeric.js.map ├── ineryjs-rpc-interfaces.d.ts ├── ineryjs-rpc-interfaces.doc.js ├── ineryjs-rpc-interfaces.js ├── ineryjs-rpc-interfaces.js.map ├── ineryjs-rpcerror.d.ts ├── ineryjs-rpcerror.js ├── ineryjs-rpcerror.js.map ├── ineryjs-serialize.d.ts ├── ineryjs-serialize.js ├── ineryjs-serialize.js.map ├── ineryjs-webauthn-sig.d.ts ├── ineryjs-webauthn-sig.js ├── ineryjs-webauthn-sig.js.map ├── ripemd.js ├── rpc-web.d.ts ├── rpc-web.js └── rpc-web.js.map ├── docs ├── ActionBuilder.html ├── ActionSerializer.html ├── Api.html ├── JsSignatureProvider.html ├── JsonRpc.html ├── RPC-API-Methods%0Acopyright%20defined%20in%20ineryjs_LICENSE.txtmodule_.html ├── TransactionBuilder.html ├── data │ └── search.json ├── fonts │ ├── Inconsolata-Regular.ttf │ ├── OpenSans-Bold-webfont.eot │ ├── OpenSans-Bold-webfont.svg │ ├── OpenSans-Bold-webfont.woff │ ├── OpenSans-BoldItalic-webfont.eot │ ├── OpenSans-BoldItalic-webfont.svg │ ├── OpenSans-BoldItalic-webfont.woff │ ├── OpenSans-Italic-webfont.eot │ ├── OpenSans-Italic-webfont.svg │ ├── OpenSans-Italic-webfont.woff │ ├── OpenSans-Light-webfont.eot │ ├── OpenSans-Light-webfont.svg │ ├── OpenSans-Light-webfont.woff │ ├── OpenSans-LightItalic-webfont.eot │ ├── OpenSans-LightItalic-webfont.svg │ ├── OpenSans-LightItalic-webfont.woff │ ├── OpenSans-Regular-webfont.eot │ ├── OpenSans-Regular-webfont.svg │ ├── OpenSans-Regular-webfont.woff │ ├── OpenSans-Regular.ttf │ └── WorkSans-Bold.ttf ├── global.html ├── index.html ├── inery-api-interfaces.doc.js.html ├── ineryjs-api.js.html ├── ineryjs-jsonrpc.js.html ├── ineryjs-jssig.js.html ├── ineryjs-rpc-interfaces.doc.js.html ├── module-API.html ├── module-JsonRpc-JsonRpc.html ├── module-JsonRpc.html ├── scripts │ ├── core.js │ ├── core.min.js │ ├── linenumber.js │ ├── prettify │ │ ├── Apache-License-2.0.txt │ │ ├── lang-css.js │ │ └── prettify.js │ ├── resize.js │ ├── search.js │ ├── search.min.js │ └── third-party │ │ ├── Apache-License-2.0.txt │ │ ├── fuse.js │ │ ├── hljs-line-num-original.js │ │ ├── hljs-line-num.js │ │ ├── hljs-original.js │ │ ├── hljs.js │ │ ├── popper.js │ │ ├── tippy.js │ │ └── tocbot.js ├── styles │ ├── clean-jsdoc-theme-base.css │ ├── clean-jsdoc-theme-dark.css │ ├── clean-jsdoc-theme-light.css │ ├── clean-jsdoc-theme.min.css │ ├── jsdoc-default.css │ ├── prettify-jsdoc.css │ └── prettify-tomorrow.css ├── tutorial-Angular.html ├── tutorial-React.html ├── tutorial-Vue.html ├── tutorial-module-in-browser.html └── tutorial-push-transaction.html ├── jsdoc.json ├── package-lock.json ├── package.json ├── template ├── README.md ├── publish.js ├── static │ ├── fonts │ │ ├── OpenSans-Bold-webfont.eot │ │ ├── OpenSans-Bold-webfont.svg │ │ ├── OpenSans-Bold-webfont.woff │ │ ├── OpenSans-BoldItalic-webfont.eot │ │ ├── OpenSans-BoldItalic-webfont.svg │ │ ├── OpenSans-BoldItalic-webfont.woff │ │ ├── OpenSans-Italic-webfont.eot │ │ ├── OpenSans-Italic-webfont.svg │ │ ├── OpenSans-Italic-webfont.woff │ │ ├── OpenSans-Light-webfont.eot │ │ ├── OpenSans-Light-webfont.svg │ │ ├── OpenSans-Light-webfont.woff │ │ ├── OpenSans-LightItalic-webfont.eot │ │ ├── OpenSans-LightItalic-webfont.svg │ │ ├── OpenSans-LightItalic-webfont.woff │ │ ├── OpenSans-Regular-webfont.eot │ │ ├── OpenSans-Regular-webfont.svg │ │ └── OpenSans-Regular-webfont.woff │ ├── scripts │ │ ├── linenumber.js │ │ └── prettify │ │ │ ├── Apache-License-2.0.txt │ │ │ ├── lang-css.js │ │ │ └── prettify.js │ └── styles │ │ ├── jsdoc-default.css │ │ ├── prettify-jsdoc.css │ │ └── prettify-tomorrow.css └── tmpl │ ├── augments.tmpl │ ├── container.tmpl │ ├── details.tmpl │ ├── example.tmpl │ ├── examples.tmpl │ ├── exceptions.tmpl │ ├── layout.tmpl │ ├── mainpage.tmpl │ ├── members.tmpl │ ├── method.tmpl │ ├── modifies.tmpl │ ├── params.tmpl │ ├── properties.tmpl │ ├── returns.tmpl │ ├── source.tmpl │ ├── tutorial.tmpl │ └── type.tmpl ├── tutorials ├── Angular.md ├── React.md ├── Vue.md ├── module-in-browser.md ├── push-transaction.md └── tutorials.json └── webpack.config.js /README-doc.md: -------------------------------------------------------------------------------- 1 | # ineryjs 2 | Javascript API for integration with Inery-based blockchains using Inery RPC API. 3 | Documentation can be found in docs folder. 4 | 5 | ## Import 6 | 7 | ### Browser 8 | 9 | Run command `npm run build-web`. Then copy folder dist-web in your project folder. Import scripts in your HTML file and use it. See [Module in browser](tutorial-module-in-browser.html) tutorial for more. 10 | 11 | ### ES Modules 12 | 13 | ```js 14 | import { Api, JsonRpc, RpcError, JsSignatureProvider } from 'ineryjs'; 15 | ``` 16 | 17 | ### CommonJS 18 | 19 | ```js 20 | const { Api, JsonRpc, RpcError, JsSignatureProvider } = require('ineryjs'); 21 | ``` 22 | 23 | ## Basic Usage 24 | 25 | ### Signature Provider 26 | 27 | The Signature Provider holds private keys and is responsible for signing transactions. 28 | 29 | **Using the JsSignatureProvider in the browser is not secure and should only be used for development purposes. Use a secure vault outside of the context of the webpage to ensure security when signing transactions in production** 30 | 31 | ```js 32 | const user1PrivateKey = "5JRchd5OZaHl9DAuVPEMo0gEx5nYiGc0Tn2aB75ef96FjuOiq"; // user1 private key 33 | const signatureProvider = new JsSignatureProvider([user1PrivateKey]); 34 | ``` 35 | 36 | ### JsonRpc 37 | 38 | Open a connection to JsonRpc. 39 | ```js 40 | const url="https://www.myurl.com"; 41 | const rpc = new JsonRpc(url); 42 | ``` 43 | 44 | ### API 45 | 46 | You may exclude these when running in a browser since most modern browsers now natively support these. If your browser does not support these (https://caniuse.com/#feat=textencoder), then you can import them as a dependency through the following deprecated npm package: https://www.npmjs.com/package/text-encoding 47 | ```js 48 | const api = new Api({ rpc, signatureProvider }); 49 | ``` 50 | 51 | ### Sending a transaction 52 | 53 | `transact()` is used to sign and push transactions onto the blockchain with an optional configuration object parameter. Given no configuration options, transactions are expected to be unpacked with TAPOS fields (`expiration`, `ref_block_num`, `ref_block_prefix`) and will automatically be broadcast onto the chain. 54 | 55 | ```js 56 | (async () => { 57 | const result = await api.transact({ 58 | actions: [{ 59 | account: 'inery.token', 60 | name: 'transfer', 61 | authorization: [{ 62 | actor: 'user1', 63 | permission: 'active', 64 | }], 65 | data: { 66 | from: 'user1', 67 | to: 'user2', 68 | quantity: '0.0001 INR', 69 | memo: '' 70 | } 71 | }] 72 | }); 73 | console.log(result); 74 | })(); 75 | ``` -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ineryjs 2 | 3 | Javascript API for integration with Inery-based blockchains using Inery RPC API. 4 | Documentation can be found in docs folder. 5 | 6 | ## Import 7 | 8 | ### Browser 9 | 10 | Run command `npm run build-web`. Then copy folder dist-web in your project folder. Import scripts in your HTML file and use it. See [Module in browser](./tutorials/module-in-browser.md) tutorial for more. 11 | 12 | ### ES Modules 13 | 14 | ```js 15 | import { Api, JsonRpc, RpcError, JsSignatureProvider } from 'ineryjs'; 16 | ``` 17 | 18 | ### CommonJS 19 | 20 | ```js 21 | const { Api, JsonRpc, RpcError, JsSignatureProvider } = require('ineryjs'); 22 | ``` 23 | 24 | ## Basic Usage 25 | 26 | ### Signature Provider 27 | 28 | The Signature Provider holds private keys and is responsible for signing transactions. 29 | **Using the JsSignatureProvider in the browser is not secure and should only be used for development purposes. Use a secure vault outside of the context of the webpage to ensure security when signing transactions in production** 30 | 31 | ```js 32 | const user1PrivateKey = "5JRchd5OZaHl9DAuVPEMo0gEx5nYiGc0Tn2aB75ef96FjuOiq"; // user1 private key 33 | const signatureProvider = new JsSignatureProvider([user1PrivateKey]); 34 | ``` 35 | 36 | ### JsonRpc 37 | 38 | Open a connection to JsonRpc. 39 | 40 | ```js 41 | const url="https://www.myurl.com"; 42 | const rpc = new JsonRpc(url); 43 | ``` 44 | 45 | ### API 46 | 47 | You may exclude these when running in a browser since most modern browsers now natively support these. If your browser does not support [these](https://caniuse.com/#feat=textencoder), then you can import them as a dependency through the following deprecated [npm package](https://www.npmjs.com/package/text-encoding). 48 | 49 | ```js 50 | const api = new Api({ rpc, signatureProvider }); 51 | ``` 52 | 53 | ### Sending a transaction 54 | 55 | `transact()` is used to sign and push transactions onto the blockchain with an optional configuration object parameter. Given no configuration options, transactions are expected to be unpacked with TAPOS fields (`expiration`, `ref_block_num`, `ref_block_prefix`) and will automatically be broadcast onto the chain. 56 | 57 | ```js 58 | (async () => { 59 | const result = await api.transact({ 60 | actions: [{ 61 | account: 'inery.token', 62 | name: 'transfer', 63 | authorization: [{ 64 | actor: 'user1', 65 | permission: 'active', 66 | }], 67 | data: { 68 | from: 'user1', 69 | to: 'user2', 70 | quantity: '0.0001 INR', 71 | memo: '' 72 | } 73 | }] 74 | }); 75 | console.log(result); 76 | })(); 77 | ``` 78 | 79 | ## Documentation 80 | 81 | When you install module, open `index.html` file in `docs` directory to see documentation. 82 | -------------------------------------------------------------------------------- /dist/PrivateKey.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { BNInput, ec as EC } from 'elliptic'; 3 | import { Key, KeyType } from './ineryjs-numeric'; 4 | import { PublicKey, Signature } from './ineryjs-key-conversions'; 5 | /** Represents/stores a private key and provides easy conversion for use with `elliptic` lib */ 6 | export declare class PrivateKey { 7 | private key; 8 | private ec; 9 | constructor(key: Key, ec: EC); 10 | /** Instantiate private key from an `elliptic`-format private key */ 11 | static fromElliptic(privKey: EC.KeyPair, keyType: KeyType, ec?: EC): PrivateKey; 12 | /** Instantiate private key from an INERYIO-format private key */ 13 | static fromString(keyString: string, ec?: EC): PrivateKey; 14 | /** Export private key as `elliptic`-format private key */ 15 | toElliptic(): EC.KeyPair; 16 | toLegacyString(): string; 17 | /** Export private key as INERYIO-format private key */ 18 | toString(): string; 19 | /** Get key type from key */ 20 | getType(): KeyType; 21 | /** Retrieve the public key from a private key */ 22 | getPublicKey(): PublicKey; 23 | /** Sign a message or hashed message digest with private key */ 24 | sign(data: BNInput, shouldHash?: boolean, encoding?: BufferEncoding): Signature; 25 | /** Validate a private key */ 26 | isValid(): boolean; 27 | } 28 | -------------------------------------------------------------------------------- /dist/PrivateKey.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.PrivateKey = void 0; 4 | var ineryjs_numeric_1 = require("./ineryjs-numeric"); 5 | var ineryjs_key_conversions_1 = require("./ineryjs-key-conversions"); 6 | /** Represents/stores a private key and provides easy conversion for use with `elliptic` lib */ 7 | var PrivateKey = /** @class */ (function () { 8 | function PrivateKey(key, ec) { 9 | this.key = key; 10 | this.ec = ec; 11 | } 12 | /** Instantiate private key from an `elliptic`-format private key */ 13 | PrivateKey.fromElliptic = function (privKey, keyType, ec) { 14 | if (!ec) { 15 | ec = ineryjs_key_conversions_1.constructElliptic(keyType); 16 | } 17 | return new PrivateKey({ 18 | type: keyType, 19 | data: privKey.getPrivate().toArrayLike(Buffer, 'be', 32), 20 | }, ec); 21 | }; 22 | /** Instantiate private key from an INERYIO-format private key */ 23 | PrivateKey.fromString = function (keyString, ec) { 24 | var privateKey = ineryjs_numeric_1.stringToPrivateKey(keyString); 25 | if (!ec) { 26 | ec = ineryjs_key_conversions_1.constructElliptic(privateKey.type); 27 | } 28 | return new PrivateKey(privateKey, ec); 29 | }; 30 | /** Export private key as `elliptic`-format private key */ 31 | PrivateKey.prototype.toElliptic = function () { 32 | return this.ec.keyFromPrivate(this.key.data); 33 | }; 34 | PrivateKey.prototype.toLegacyString = function () { 35 | return ineryjs_numeric_1.privateKeyToLegacyString(this.key); 36 | }; 37 | /** Export private key as INERYIO-format private key */ 38 | PrivateKey.prototype.toString = function () { 39 | return ineryjs_numeric_1.privateKeyToString(this.key); 40 | }; 41 | /** Get key type from key */ 42 | PrivateKey.prototype.getType = function () { 43 | return this.key.type; 44 | }; 45 | /** Retrieve the public key from a private key */ 46 | PrivateKey.prototype.getPublicKey = function () { 47 | var ellipticPrivateKey = this.toElliptic(); 48 | return ineryjs_key_conversions_1.PublicKey.fromElliptic(ellipticPrivateKey, this.getType(), this.ec); 49 | }; 50 | /** Sign a message or hashed message digest with private key */ 51 | PrivateKey.prototype.sign = function (data, shouldHash, encoding) { 52 | var _this = this; 53 | if (shouldHash === void 0) { shouldHash = true; } 54 | if (encoding === void 0) { encoding = 'utf8'; } 55 | if (shouldHash) { 56 | if (typeof data === 'string') { 57 | data = Buffer.from(data, encoding); 58 | } 59 | data = this.ec.hash().update(data).digest(); 60 | } 61 | var tries = 0; 62 | var signature; 63 | var isCanonical = function (sigData) { 64 | return !(sigData[1] & 0x80) && !(sigData[1] === 0 && !(sigData[2] & 0x80)) 65 | && !(sigData[33] & 0x80) && !(sigData[33] === 0 && !(sigData[34] & 0x80)); 66 | }; 67 | var constructSignature = function (options) { 68 | var ellipticPrivateKey = _this.toElliptic(); 69 | var ellipticSignature = ellipticPrivateKey.sign(data, options); 70 | return ineryjs_key_conversions_1.Signature.fromElliptic(ellipticSignature, _this.getType(), _this.ec); 71 | }; 72 | if (this.key.type === ineryjs_numeric_1.KeyType.k1) { 73 | do { 74 | signature = constructSignature({ canonical: true, pers: [++tries] }); 75 | } while (!isCanonical(signature.toBinary())); 76 | } 77 | else { 78 | signature = constructSignature({ canonical: true }); 79 | } 80 | return signature; 81 | }; 82 | /** Validate a private key */ 83 | PrivateKey.prototype.isValid = function () { 84 | try { 85 | var ellipticPrivateKey = this.toElliptic(); 86 | var validationObj = ellipticPrivateKey.validate(); 87 | return validationObj.result; 88 | } 89 | catch (_a) { 90 | return false; 91 | } 92 | }; 93 | return PrivateKey; 94 | }()); 95 | exports.PrivateKey = PrivateKey; -------------------------------------------------------------------------------- /dist/PrivateKey.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"PrivateKey.js","sourceRoot":"","sources":["../src/PrivateKey.ts"],"names":[],"mappings":";;;AACA,iDAMyB;AACzB,iEAAkF;AAElF,+FAA+F;AAC/F;IACI,oBAAoB,GAAQ,EAAU,EAAM;QAAxB,QAAG,GAAH,GAAG,CAAK;QAAU,OAAE,GAAF,EAAE,CAAI;IAAG,CAAC;IAEhD,oEAAoE;IACtD,uBAAY,GAA1B,UAA2B,OAAmB,EAAE,OAAgB,EAAE,EAAO;QACrE,IAAI,CAAC,EAAE,EAAE;YACL,EAAE,GAAG,yCAAiB,CAAC,OAAO,CAAC,CAAC;SACnC;QACD,OAAO,IAAI,UAAU,CAAC;YAClB,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;SAC3D,EAAE,EAAE,CAAC,CA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AS,EAAE,IAAI,EAAC,CAAC,CAAC;SACrD;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,6BAA6B;IACtB,4BAAO,GAAd;QACI,IAAI;YACA,IAAM,kBAAkB,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAC7C,IAAM,aAAa,GAAG,kBAAkB,CAAC,QAAQ,EAAE,CAAC;YACpD,OAAO,aAAa,CAAC,MAAM,CAAC;SAC/B;QAAC,WAAM;YACJ,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;IACL,iBAAC;AAAD,CAAC,AAvFD,IAuFC;AAvFY,gCAAU"} -------------------------------------------------------------------------------- /dist/PublicKey.d.ts: -------------------------------------------------------------------------------- 1 | import { ec as EC } from 'elliptic'; 2 | import { Key, KeyType } from './ineryjs-numeric'; 3 | /** Represents/stores a public key and provides easy conversion for use with `elliptic` lib */ 4 | export declare class PublicKey { 5 | private key; 6 | private ec; 7 | constructor(key: Key, ec: EC); 8 | /** Instantiate public key from an INERYIO-format public key */ 9 | static fromString(publicKeyStr: string, ec?: EC): PublicKey; 10 | /** Instantiate public key from an `elliptic`-format public key */ 11 | static fromElliptic(publicKey: EC.KeyPair, keyType: KeyType, ec?: EC): PublicKey; 12 | /** Export public key as INERYIO-format public key */ 13 | toString(): string; 14 | /** Export public key as Legacy INERYIO-format public key */ 15 | toLegacyString(): string; 16 | /** Export public key as `elliptic`-format public key */ 17 | toElliptic(): EC.KeyPair; 18 | /** Get key type from key */ 19 | getType(): KeyType; 20 | /** Validate a public key */ 21 | isValid(): boolean; 22 | } 23 | -------------------------------------------------------------------------------- /dist/PublicKey.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.PublicKey = void 0; 4 | var ineryjs_numeric_1 = require("./ineryjs-numeric"); 5 | var ineryjs_key_conversions_1 = require("./ineryjs-key-conversions"); 6 | /** Represents/stores a public key and provides easy conversion for use with `elliptic` lib */ 7 | var PublicKey = /** @class */ (function () { 8 | function PublicKey(key, ec) { 9 | this.key = key; 10 | this.ec = ec; 11 | } 12 | /** Instantiate public key from an INERYIO-format public key */ 13 | PublicKey.fromString = function (publicKeyStr, ec) { 14 | var key = ineryjs_numeric_1.stringToPublicKey(publicKeyStr); 15 | if (!ec) { 16 | ec = ineryjs_key_conversions_1.constructElliptic(key.type); 17 | } 18 | return new PublicKey(key, ec); 19 | }; 20 | /** Instantiate public key from an `elliptic`-format public key */ 21 | PublicKey.fromElliptic = function (publicKey, keyType, ec) { 22 | var x = publicKey.getPublic().getX().toArray('be', 32); 23 | var y = publicKey.getPublic().getY().toArray('be', 32); 24 | if (!ec) { 25 | ec = ineryjs_key_conversions_1.constructElliptic(keyType); 26 | } 27 | return new PublicKey({ 28 | type: keyType, 29 | data: new Uint8Array([(y[31] & 1) ? 3 : 2].concat(x)), 30 | }, ec); 31 | }; 32 | /** Export public key as INERYIO-format public key */ 33 | PublicKey.prototype.toString = function () { 34 | return ineryjs_numeric_1.publicKeyToString(this.key); 35 | }; 36 | /** Export public key as Legacy INERYIO-format public key */ 37 | PublicKey.prototype.toLegacyString = function () { 38 | return ineryjs_numeric_1.publicKeyToLegacyString(this.key); 39 | }; 40 | /** Export public key as `elliptic`-format public key */ 41 | PublicKey.prototype.toElliptic = function () { 42 | return this.ec.keyPair({ 43 | pub: Buffer.from(this.key.data), 44 | }); 45 | }; 46 | /** Get key type from key */ 47 | PublicKey.prototype.getType = function () { 48 | return this.key.type; 49 | }; 50 | /** Validate a public key */ 51 | PublicKey.prototype.isValid = function () { 52 | try { 53 | var ellipticPublicKey = this.toElliptic(); 54 | var validationObj = ellipticPublicKey.validate(); 55 | return validationObj.result; 56 | } 57 | catch (_a) { 58 | return false; 59 | } 60 | }; 61 | return PublicKey; 62 | }()); 63 | exports.PublicKey = PublicKey; -------------------------------------------------------------------------------- /dist/PublicKey.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"PublicKey.js","sourceRoot":"","sources":["../src/PublicKey.ts"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DAA0D;IACnD,kCAAc,GAArB;QACI,OAAO,uCAAuB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,wDAAwD;IACjD,8BAAU,GAAjB;QACI,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;YACnB,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;SAClC,CAAC,CAAC;IACP,CAAC;IAED,4BAA4B;IACrB,2BAAO,GAAd;QACI,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,4BAA4B;IACrB,2BAAO,GAAd;QACI,IAAI;YACA,IAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAC5C,IAAM,aAAa,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YACnD,OAAO,aAAa,CAAC,MAAM,CAAC;SAC/B;QAAC,WAAM;YACJ,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;IACL,gBAAC;AAAD,CAAC,AAzDD,IAyDC;AAzDY,8BAAS"} -------------------------------------------------------------------------------- /dist/Signature.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { BNInput, ec as EC } from 'elliptic'; 3 | import { Key, KeyType } from './ineryjs-numeric'; 4 | import { PublicKey } from './ineryjs-key-conversions'; 5 | /** Represents/stores a Signature and provides easy conversion for use with `elliptic` lib */ 6 | export declare class Signature { 7 | private signature; 8 | private ec; 9 | constructor(signature: Key, ec: EC); 10 | /** Instantiate Signature from an INERYIO-format Signature */ 11 | static fromString(sig: string, ec?: EC): Signature; 12 | /** Instantiate Signature from an `elliptic`-format Signature */ 13 | static fromElliptic(ellipticSig: EC.Signature, keyType: KeyType, ec?: EC): Signature; 14 | /** Export Signature as `elliptic`-format Signature 15 | * NOTE: This isn't an actual elliptic-format Signature, as ec.Signature is not exported by the library. 16 | * That's also why the return type is `any`. We're *actually* returning an object with the 3 params 17 | * not an ec.Signature. 18 | * Further NOTE: @types/elliptic shows ec.Signature as exported; it is *not*. Hence the `any`. 19 | */ 20 | toElliptic(): any; 21 | /** Export Signature as INERYIO-format Signature */ 22 | toString(): string; 23 | /** Export Signature in binary format */ 24 | toBinary(): Uint8Array; 25 | /** Get key type from signature */ 26 | getType(): KeyType; 27 | /** Verify a signature with a message or hashed message digest and public key */ 28 | verify(data: BNInput, publicKey: PublicKey, shouldHash?: boolean, encoding?: BufferEncoding): boolean; 29 | /** Recover a public key from a message or hashed message digest and signature */ 30 | recover(data: BNInput, shouldHash?: boolean, encoding?: BufferEncoding): PublicKey; 31 | } 32 | -------------------------------------------------------------------------------- /dist/Signature.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Signature = void 0; 4 | var BN = require("bn.js"); 5 | var ineryjs_numeric_1 = require("./ineryjs-numeric"); 6 | var ineryjs_key_conversions_1 = require("./ineryjs-key-conversions"); 7 | /** Represents/stores a Signature and provides easy conversion for use with `elliptic` lib */ 8 | var Signature = /** @class */ (function () { 9 | function Signature(signature, ec) { 10 | this.signature = signature; 11 | this.ec = ec; 12 | } 13 | /** Instantiate Signature from an INERYIO-format Signature */ 14 | Signature.fromString = function (sig, ec) { 15 | var signature = ineryjs_numeric_1.stringToSignature(sig); 16 | if (!ec) { 17 | ec = ineryjs_key_conversions_1.constructElliptic(signature.type); 18 | } 19 | return new Signature(signature, ec); 20 | }; 21 | /** Instantiate Signature from an `elliptic`-format Signature */ 22 | Signature.fromElliptic = function (ellipticSig, keyType, ec) { 23 | var r = ellipticSig.r.toArray('be', 32); 24 | var s = ellipticSig.s.toArray('be', 32); 25 | var ineryioRecoveryParam; 26 | if (keyType === ineryjs_numeric_1.KeyType.k1 || keyType === ineryjs_numeric_1.KeyType.r1) { 27 | ineryioRecoveryParam = ellipticSig.recoveryParam + 27; 28 | if (ellipticSig.recoveryParam <= 3) { 29 | ineryioRecoveryParam += 4; 30 | } 31 | } 32 | else if (keyType === ineryjs_numeric_1.KeyType.wa) { 33 | ineryioRecoveryParam = ellipticSig.recoveryParam; 34 | } 35 | var sigData = new Uint8Array([ineryioRecoveryParam].concat(r, s)); 36 | if (!ec) { 37 | ec = ineryjs_key_conversions_1.constructElliptic(keyType); 38 | } 39 | return new Signature({ 40 | type: keyType, 41 | data: sigData, 42 | }, ec); 43 | }; 44 | /** Export Signature as `elliptic`-format Signature 45 | * NOTE: This isn't an actual elliptic-format Signature, as ec.Signature is not exported by the library. 46 | * That's also why the return type is `any`. We're *actually* returning an object with the 3 params 47 | * not an ec.Signature. 48 | * Further NOTE: @types/elliptic shows ec.Signature as exported; it is *not*. Hence the `any`. 49 | */ 50 | Signature.prototype.toElliptic = function () { 51 | var lengthOfR = 32; 52 | var lengthOfS = 32; 53 | var r = new BN(this.signature.data.slice(1, lengthOfR + 1)); 54 | var s = new BN(this.signature.data.slice(lengthOfR + 1, lengthOfR + lengthOfS + 1)); 55 | var ellipticRecoveryBitField; 56 | if (this.signature.type === ineryjs_numeric_1.KeyType.k1 || this.signature.type === ineryjs_numeric_1.KeyType.r1) { 57 | ellipticRecoveryBitField = this.signature.data[0] - 27; 58 | if (ellipticRecoveryBitField > 3) { 59 | ellipticRecoveryBitField -= 4; 60 | } 61 | } 62 | else if (this.signature.type === ineryjs_numeric_1.KeyType.wa) { 63 | ellipticRecoveryBitField = this.signature.data[0]; 64 | } 65 | var recoveryParam = ellipticRecoveryBitField & 3; 66 | return { r: r, s: s, recoveryParam: recoveryParam }; 67 | }; 68 | /** Export Signature as INERYIO-format Signature */ 69 | Signature.prototype.toString = function () { 70 | return ineryjs_numeric_1.signatureToString(this.signature); 71 | }; 72 | /** Export Signature in binary format */ 73 | Signature.prototype.toBinary = function () { 74 | return this.signature.data; 75 | }; 76 | /** Get key type from signature */ 77 | Signature.prototype.getType = function () { 78 | return this.signature.type; 79 | }; 80 | /** Verify a signature with a message or hashed message digest and public key */ 81 | Signature.prototype.verify = function (data, publicKey, shouldHash, encoding) { 82 | if (shouldHash === void 0) { shouldHash = true; } 83 | if (encoding === void 0) { encoding = 'utf8'; } 84 | if (shouldHash) { 85 | if (typeof data === 'string') { 86 | data = Buffer.from(data, encoding); 87 | } 88 | data = this.ec.hash().update(data).digest(); 89 | } 90 | var ellipticSignature = this.toElliptic(); 91 | var ellipticPublicKey = publicKey.toElliptic(); 92 | return this.ec.verify(data, ellipticSignature, ellipticPublicKey, encoding); 93 | }; 94 | /** Recover a public key from a message or hashed message digest and signature */ 95 | Signature.prototype.recover = function (data, shouldHash, encoding) { 96 | if (shouldHash === void 0) { shouldHash = true; } 97 | if (encoding === void 0) { encoding = 'utf8'; } 98 | if (shouldHash) { 99 | if (typeof data === 'string') { 100 | data = Buffer.from(data, encoding); 101 | } 102 | data = this.ec.hash().update(data).digest(); 103 | } 104 | var ellipticSignature = this.toElliptic(); 105 | var recoveredPublicKey = this.ec.recoverPubKey(data, ellipticSignature, ellipticSignature.recoveryParam, encoding); 106 | var ellipticKPub = this.ec.keyFromPublic(recoveredPublicKey); 107 | return ineryjs_key_conversions_1.PublicKey.fromElliptic(ellipticKPub, this.getType(), this.ec); 108 | }; 109 | return Signature; 110 | }()); 111 | exports.Signature = Signature; -------------------------------------------------------------------------------- /dist/Signature.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Signature.js","sourceRoot":"","sources":["../src/Signature.ts"],"names":[],"mappings":";;;AACA,0BAA6B;AAE7B,iDAKyB;AACzB,iEAAuE;AAEvE,6FAA6F;AAC7F;IACI,mBAAoB,SAAc,EAAU,EAAM;QAA9B,cAAS,GAAT,SAAS,CAAK;QAAU,OAAE,GAAF,EAAE,CAAI;IAAG,CAAC;IAEtD,2DAA2D;IAC7C,oBAAU,GAAxB,UAAyB,GAAW,EAAE,EAAO;QACzC,IAAM,SAAS,GAAG,iCAAiB,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,EAAE,EAAE;YACL,EAAE,GAAG,yCAAiB,CAAC,SAAS,CAAC,IAAI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Y,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC;IACL,gBAAC;AAAD,CAAC,AA1GD,IA0GC;AA1GY,8BAAS"} -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | import { Api } from './ineryjs-api'; 2 | import * as ApiInterfaces from './ineryjs-api-interfaces'; 3 | import { JsonRpc } from './ineryjs-jsonrpc'; 4 | import * as Numeric from './ineryjs-numeric'; 5 | import * as RpcInterfaces from './ineryjs-rpc-interfaces'; 6 | import { RpcError } from './ineryjs-rpcerror'; 7 | import * as Serialize from './ineryjs-serialize'; 8 | import { JsSignatureProvider, PrivateKey } from './ineryjs-jssig'; 9 | import { PublicKey } from './ineryjs-jssig'; 10 | import { PrivateKey } from './ineryjs-jssig'; 11 | export { Api, ApiInterfaces, JsonRpc, Numeric, RpcInterfaces, RpcError, Serialize, JsSignatureProvider, PublicKey, PrivateKey }; 12 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Serialize = exports.RpcError = exports.RpcInterfaces = exports.Numeric = exports.JsonRpc = exports.ApiInterfaces = exports.Api = void 0; 4 | var ineryjs_api_1 = require("./ineryjs-api"); 5 | Object.defineProperty(exports, "Api", { enumerable: true, get: function () { return ineryjs_api_1.Api; } }); 6 | var ApiInterfaces = require("./ineryjs-api-interfaces"); 7 | exports.ApiInterfaces = ApiInterfaces; 8 | var ineryjs_jsonrpc_1 = require("./ineryjs-jsonrpc"); 9 | Object.defineProperty(exports, "JsonRpc", { enumerable: true, get: function () { return ineryjs_jsonrpc_1.JsonRpc; } }); 10 | var Numeric = require("./ineryjs-numeric"); 11 | exports.Numeric = Numeric; 12 | var RpcInterfaces = require("./ineryjs-rpc-interfaces"); 13 | exports.RpcInterfaces = RpcInterfaces; 14 | var ineryjs_rpcerror_1 = require("./ineryjs-rpcerror"); 15 | Object.defineProperty(exports, "RpcError", { enumerable: true, get: function () { return ineryjs_rpcerror_1.RpcError; } }); 16 | var Serialize = require("./ineryjs-serialize"); 17 | exports.Serialize = Serialize; 18 | var {JsSignatureProvider}=require("./ineryjs-jssig"); 19 | exports.JsSignatureProvider=JsSignatureProvider; 20 | var {PublicKey}=require('./PublicKey'); 21 | exports.PublicKey=PublicKey; 22 | var {PrivateKey}=require('./PrivateKey'); 23 | exports.PrivateKey=PrivateKey; 24 | var {ecc}=require('./ineryjs-ecc-migration'); 25 | exports.ecc=ecc; 26 | var KeyConversion=require('./ineryjs-key-conversions'); 27 | exports.KeyConversion=KeyConversion; 28 | var WebAuth=require('./ineryjs-webauthn-sig'); 29 | exports.WebAuth=WebAuth; 30 | var Signature=require('./Signature'); 31 | exports.Signature=Signature; 32 | exports.default={ 33 | JsSignatureProvider, 34 | Api:ineryjs_api_1.Api, 35 | JsonRpc:ineryjs_jsonrpc_1.JsonRpc, 36 | RpcError:ineryjs_rpcerror_1.RpcError, 37 | PublicKey, 38 | PrivateKey 39 | }; -------------------------------------------------------------------------------- /dist/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAkC;AAQzB,oFARA,eAAG,OAQA;AAPZ,sDAAwD;AAO1C,sCAAa;AAN3B,iDAA0C;AAMb,wFANpB,uBAAO,OAMoB;AALpC,yCAA2C;AAKL,0BAAO;AAJ7C,sDAAwD;AAIT,sCAAa;AAH5D,mDAA4C;AAGkB,yFAHrD,yBAAQ,OAGqD;AAFtE,6CAA+C;AAEyB,8BAAS"} -------------------------------------------------------------------------------- /dist/inery-api-interfaces.doc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @typedef {Object} Action 3 | * @property {string} account 4 | * @property {string} name 5 | * @property {Array} authorization 6 | * @property {any} data 7 | * @property {string} [hex_data] 8 | */ 9 | /** 10 | * @typedef {SerializedAction} 11 | * @property {string} account 12 | * @property {string} name 13 | * @property {Array} authorization 14 | * @property {any} data 15 | */ 16 | /** Arguments to `getRequiredKeys` 17 | * @typedef {Object} AuthorityProviderArgs 18 | * *Transaction that needs to be signed 19 | * @property {any} transaction 20 | * *Public keys associated with the private keys that the `SignatureProvider` holds 21 | * @property {Array} availableKeys 22 | */ 23 | /** 24 | * @typedef {Object} BinaryAbi 25 | * @property {string} accountName 26 | * @property {Uint8Array} abi 27 | */ 28 | /** 29 | * @typedef {Object} SignArgs 30 | * @property {string} chainId 31 | * @property {Array} requiredKeys 32 | * @property {Uint8Array} serializedTransaction 33 | * @property {Uint8Array} [serializedContextFreeData] 34 | * @property {Array} abis 35 | */ 36 | /** 37 | * @typedef {Object} SignResult 38 | * @property {Array} signatures 39 | * @property {Uint8Array} serializedTransaction 40 | * @property {Uint8Array} serializedContextFreeData 41 | */ 42 | /** 43 | * @typedef {Object} ResourcePayer 44 | * @property {string} payer 45 | * @property {number} max_net_bytes 46 | * @property {number} max_cpu_us 47 | * @property {number} max_memory_bytes 48 | */ 49 | /** 50 | * @typedef {Object} Transaction 51 | * @property {string} [expiration] 52 | * @property {number} [ref_block_num] 53 | * @property {number} [ref_block_prefix] 54 | * @property {number} [max_net_usage_words] 55 | * @property {number} [max_cpu_usage_ms] 56 | * @property {number} [delay_sec] 57 | * @property {Array} [context_free_actions] 58 | * @property {Array} [context_free_data] 59 | * @property {Array} actions 60 | * @property {Array} [transaction_extensions] 61 | * @property {ResourcePayer} [resource_payer] 62 | */ 63 | 64 | /** 65 | * @summary Optional transact configuration object 66 | * @typedef {Object} TransactConfig 67 | * @property {boolean} [broadcast] 68 | * @property {boolean} [sign] 69 | * @property {boolean} [readOnlyTrx] 70 | * @property {boolean} [returnFailureTraces] 71 | * @property {Array} [requiredKeys] 72 | * @property {boolean} [compression] 73 | * @property {number} [blocksBehind] 74 | * @property {boolean} [useLastIrreversible] 75 | * @property {number} [expireSeconds] 76 | */ 77 | /** 78 | * @typedef {Object} TransactionHeader 79 | * @property {string} expiration 80 | * @property {number} ref_block_num 81 | * @property {number} ref_block_prefix 82 | */ 83 | /** 84 | * @typedef {Object} AccountDelta 85 | * @property {string} account 86 | * @property {number} delta 87 | */ 88 | /** 89 | * @typedef {Object} AuthSequence 90 | * @property {string} account 91 | * @property {number} sequence 92 | */ 93 | /** 94 | * @typedef {Object} ActionReceipt 95 | * @property {string} receiver 96 | * @property {string} act_digest 97 | * @property {number} global_sequence 98 | * @property {number} recv_sequence 99 | * @property {Array} auth_sequence 100 | * @property {number} code_sequence 101 | * @property {number} abi_sequence 102 | */ 103 | /** 104 | * @typedef {Object} ActionTrace 105 | * @property {number} action_ordinal 106 | * @property {number} creator_action_ordinal 107 | * @property {number} closest_unnotified_ancestor_action_ordinal 108 | * @property {ActionReceipt} receipt 109 | * @property {string} receiver 110 | * @property {ProcessedAction} act 111 | * @property {boolean} context_free 112 | * @property {number} elapsed 113 | * @property {string} console 114 | * @property {string} trx_id 115 | * @property {number} block_num 116 | * @property {string} block_time 117 | * @property {string | null} producer_block_id 118 | * @property {Array} account_ram_deltas 119 | * @property {Array} account_disk_deltas 120 | * @property {any} except 121 | * @property {number | null} error_code 122 | * @property {any} [return_value] 123 | * @property {string} [return_value_hex_data] 124 | * @property {any} [return_value_data] 125 | * @property {Array} [inline_traces] 126 | */ 127 | /** 128 | * @typedef {Object} TransactResult 129 | * @property {string} transaction_id 130 | * @property {TransactionTrace} processed 131 | */ 132 | /** 133 | * @summary Optional query configuration object 134 | * @typedef {Object} QueryConfig 135 | * @property {boolean} [sign] 136 | * @property {Array} requiredKeys 137 | * @property {Array} 138 | */ 139 | -------------------------------------------------------------------------------- /dist/ineryjs-api-interfaces.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @module Javascript-API 3 | * copyright defined in ineryjs/LICENSE.txt 4 | */ 5 | import { Abi, PushTransactionArgs, ProcessedAction } from './ineryjs-rpc-interfaces'; 6 | import { Anyvar, Authorization, Action, SerializedAction } from './ineryjs-serialize'; 7 | /** Arguments to `getRequiredKeys` */ 8 | export interface AuthorityProviderArgs { 9 | /** Transaction that needs to be signed */ 10 | transaction: any; 11 | /** Public keys associated with the private keys that the `SignatureProvider` holds */ 12 | availableKeys: string[]; 13 | } 14 | /** Get subset of `availableKeys` needed to meet authorities in `transaction` */ 15 | export interface AuthorityProvider { 16 | /** Get subset of `availableKeys` needed to meet authorities in `transaction` */ 17 | getRequiredKeys: (args: AuthorityProviderArgs) => Promise; 18 | } 19 | /** Retrieves raw ABIs for a specified accountName */ 20 | export interface AbiProvider { 21 | /** Retrieve the BinaryAbi */ 22 | getRawAbi: (accountName: string) => Promise; 23 | } 24 | /** Structure for the raw form of ABIs */ 25 | export interface BinaryAbi { 26 | /** account which has deployed the ABI */ 27 | accountName: string; 28 | /** abi in binary form */ 29 | abi: Uint8Array; 30 | } 31 | /** Holds a fetched abi */ 32 | export interface CachedAbi { 33 | /** abi in binary form */ 34 | rawAbi: Uint8Array; 35 | /** abi in structured form */ 36 | abi: Abi; 37 | } 38 | /** Arguments to `sign` */ 39 | export interface SignatureProviderArgs { 40 | /** Chain transaction is for */ 41 | chainId: string; 42 | /** Public keys associated with the private keys needed to sign the transaction */ 43 | requiredKeys: string[]; 44 | /** Transaction to sign */ 45 | serializedTransaction: Uint8Array; 46 | /** Context-free data to sign */ 47 | serializedContextFreeData?: Uint8Array; 48 | /** ABIs for all contracts with actions included in `serializedTransaction` */ 49 | abis: BinaryAbi[]; 50 | } 51 | /** Signs transactions */ 52 | export interface SignatureProvider { 53 | /** Public keys associated with the private keys that the `SignatureProvider` holds */ 54 | getAvailableKeys: () => Promise; 55 | /** Sign a transaction */ 56 | sign: (args: SignatureProviderArgs) => Promise; 57 | } 58 | export interface ResourcePayer { 59 | payer: string; 60 | max_net_bytes: number; 61 | max_cpu_us: number; 62 | max_memory_bytes: number; 63 | } 64 | export interface Transaction { 65 | expiration?: string; 66 | ref_block_num?: number; 67 | ref_block_prefix?: number; 68 | max_net_usage_words?: number; 69 | max_cpu_usage_ms?: number; 70 | delay_sec?: number; 71 | context_free_actions?: Action[]; 72 | context_free_data?: Uint8Array[]; 73 | actions: Action[]; 74 | transaction_extensions?: [number, string][]; 75 | resource_payer?: ResourcePayer; 76 | } 77 | /** Optional transact configuration object */ 78 | export interface TransactConfig { 79 | broadcast?: boolean; 80 | sign?: boolean; 81 | readOnlyTrx?: boolean; 82 | returnFailureTraces?: boolean; 83 | requiredKeys?: string[]; 84 | compression?: boolean; 85 | blocksBehind?: number; 86 | useLastIrreversible?: boolean; 87 | expireSeconds?: number; 88 | } 89 | export interface TransactionHeader { 90 | expiration: string; 91 | ref_block_num: number; 92 | ref_block_prefix: number; 93 | } 94 | export interface AccountDelta { 95 | account: string; 96 | delta: number; 97 | } 98 | export interface AuthSequence { 99 | account: string; 100 | sequence: number; 101 | } 102 | export interface ActionReceipt { 103 | receiver: string; 104 | act_digest: string; 105 | global_sequence: number; 106 | recv_sequence: number; 107 | auth_sequence: [string, number][]; 108 | code_sequence: number; 109 | abi_sequence: number; 110 | } 111 | export interface ActionTrace { 112 | action_ordinal: number; 113 | creator_action_ordinal: number; 114 | closest_unnotified_ancestor_action_ordinal: number; 115 | receipt: ActionReceipt; 116 | receiver: string; 117 | act: ProcessedAction; 118 | context_free: boolean; 119 | elapsed: number; 120 | console: string; 121 | trx_id: string; 122 | block_num: number; 123 | block_time: string; 124 | producer_block_id: string | null; 125 | account_ram_deltas: AccountDelta[]; 126 | account_disk_deltas: AccountDelta[]; 127 | except: any; 128 | error_code: number | null; 129 | return_value?: any; 130 | return_value_hex_data?: string; 131 | return_value_data?: any; 132 | inline_traces?: ActionTrace[]; 133 | } 134 | export interface TransactionReceiptHeader { 135 | status: string; 136 | cpu_usage_us: number; 137 | net_usage_words: number; 138 | } 139 | export interface TransactionTrace { 140 | id: string; 141 | block_num: number; 142 | block_time: string; 143 | producer_block_id: string | null; 144 | receipt: TransactionReceiptHeader | null; 145 | elapsed: number; 146 | net_usage: number; 147 | scheduled: boolean; 148 | action_traces: ActionTrace[]; 149 | account_ram_delta: AccountDelta | null; 150 | except: string | null; 151 | error_code: number | null; 152 | bill_to_accounts: string[]; 153 | } 154 | export interface TransactResult { 155 | transaction_id: string; 156 | processed: TransactionTrace; 157 | } 158 | /** Optional query configuration object */ 159 | export interface QueryConfig { 160 | sign?: boolean; 161 | requiredKeys?: string[]; 162 | authorization?: Authorization[]; 163 | } 164 | /** 165 | * A Query may be any of the following: 166 | * * string: method 167 | * * [string, Query[]]: [method, filter] 168 | * * [string, Anyvar, Query[]]: [method, arg, filter] 169 | * * {method: string, arg?: Anyvar, filter?: Query[]} explicit form 170 | */ 171 | export declare type Query = string | [string, Query[]] | [string, Anyvar, Query[]] | { 172 | method: string; 173 | arg?: Anyvar; 174 | filter?: Query[]; 175 | }; 176 | export declare type ContextFreeGroupCallback = (index: { 177 | cfa: number; 178 | cfd: number; 179 | }) => { 180 | action?: SerializedAction; 181 | contextFreeAction?: SerializedAction; 182 | contextFreeData?: Uint8Array; 183 | }; 184 | export interface ActionSerializerType { 185 | [actionName: string]: any; 186 | } 187 | -------------------------------------------------------------------------------- /dist/ineryjs-api-interfaces.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * @module Javascript-API 4 | */ 5 | Object.defineProperty(exports, "__esModule", { value: true }); -------------------------------------------------------------------------------- /dist/ineryjs-api-interfaces.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ineryjs-api-interfaces.js","sourceRoot":"","sources":["../src/ineryjs-api-interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAgNF,CAAC"} -------------------------------------------------------------------------------- /dist/ineryjs-api.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @module API 3 | */ 4 | import { AbiProvider, ActionSerializerType, AuthorityProvider, BinaryAbi, CachedAbi, ContextFreeGroupCallback, Query, QueryConfig, SignatureProvider, TransactConfig, Transaction, TransactResult } from './ineryjs-api-interfaces'; 5 | import { JsonRpc } from './ineryjs-jsonrpc'; 6 | import { Abi, PushTransactionArgs, ReadOnlyTransactResult } from './ineryjs-rpc-interfaces'; 7 | import * as ser from './ineryjs-serialize'; 8 | export declare class Api { 9 | /** Issues RPC calls */ 10 | rpc: JsonRpc; 11 | /** Get subset of `availableKeys` needed to meet authorities in a `transaction` */ 12 | authorityProvider: AuthorityProvider; 13 | /** Supplies ABIs in raw form (binary) */ 14 | abiProvider: AbiProvider; 15 | /** Signs transactions */ 16 | signatureProvider: SignatureProvider; 17 | /** Identifies chain */ 18 | chainId: string; 19 | textEncoder: TextEncoder; 20 | textDecoder: TextDecoder; 21 | /** Converts abi files between binary and structured form (`abi.abi.json`) */ 22 | abiTypes: Map; 23 | /** Converts transactions between binary and structured form (`transaction.abi.json`) */ 24 | transactionTypes: Map; 25 | /** Holds information needed to serialize contract actions */ 26 | contracts: Map; 27 | /** Fetched abis */ 28 | cachedAbis: Map; 29 | /** 30 | * @param args 31 | * * `rpc`: Issues RPC calls 32 | * * `authorityProvider`: Get public keys needed to meet authorities in a transaction 33 | * * `abiProvider`: Supplies ABIs in raw form (binary) 34 | * * `signatureProvider`: Signs transactions 35 | * * `chainId`: Identifies chain 36 | * * `textEncoder`: `TextEncoder` instance to use. Pass in `null` if running in a browser 37 | * * `textDecoder`: `TextDecoder` instance to use. Pass in `null` if running in a browser 38 | */ 39 | constructor(args: { 40 | rpc: JsonRpc; 41 | authorityProvider?: AuthorityProvider; 42 | abiProvider?: AbiProvider; 43 | signatureProvider: SignatureProvider; 44 | chainId?: string; 45 | textEncoder?: TextEncoder; 46 | textDecoder?: TextDecoder; 47 | }); 48 | /** Decodes an abi as Uint8Array into json. */ 49 | rawAbiToJson(rawAbi: Uint8Array): Abi; 50 | /** Encodes a json abi as Uint8Array. */ 51 | jsonToRawAbi(jsonAbi: Abi): Uint8Array; 52 | /** Get abi in both binary and structured forms. Fetch when needed. */ 53 | getCachedAbi(accountName: string, reload?: boolean): Promise; 54 | /** Get abi in structured form. Fetch when needed. */ 55 | getAbi(accountName: string, reload?: boolean): Promise; 56 | /** Get abis needed by a transaction */ 57 | getTransactionAbis(transaction: Transaction, reload?: boolean): Promise; 58 | /** Get data needed to serialize actions in a contract */ 59 | getContract(accountName: string, reload?: boolean): Promise; 60 | /** Convert `value` to binary form. `type` must be a built-in abi type or in `transaction.abi.json`. */ 61 | serialize(buffer: ser.SerialBuffer, type: string, value: any): void; 62 | /** Convert data in `buffer` to structured form. `type` must be a built-in abi type or in `transaction.abi.json`. */ 63 | deserialize(buffer: ser.SerialBuffer, type: string): any; 64 | /** Convert a transaction to binary */ 65 | serializeTransaction(transaction: Transaction): Uint8Array; 66 | /** Serialize context-free data */ 67 | serializeContextFreeData(contextFreeData: Uint8Array[]): Uint8Array; 68 | /** Convert a transaction from binary. Leaves actions in hex. */ 69 | deserializeTransaction(transaction: Uint8Array): Transaction; 70 | private transactionExtensions; 71 | serializeTransactionExtensions(transaction: Transaction): [number, string][]; 72 | deserializeTransactionExtensions(data: [number, string][]): any[]; 73 | deleteTransactionExtensionObjects(transaction: Transaction): Transaction; 74 | /** Convert actions to hex */ 75 | serializeActions(actions: ser.Action[]): Promise; 76 | /** Convert actions from hex */ 77 | deserializeActions(actions: ser.Action[]): Promise; 78 | /** Convert a transaction from binary. Also deserializes actions. */ 79 | deserializeTransactionWithActions(transaction: Uint8Array | string): Promise; 80 | /** Deflate a serialized object */ 81 | deflateSerializedArray(serializedArray: Uint8Array): Uint8Array; 82 | /** Inflate a compressed serialized object */ 83 | inflateSerializedArray(compressedSerializedArray: Uint8Array): Uint8Array; 84 | /** 85 | * Create and optionally broadcast a transaction. 86 | * 87 | * Named Parameters: 88 | * `broadcast`: broadcast this transaction? 89 | * `sign`: sign this transaction? 90 | * `compression`: compress this transaction? 91 | * `readOnlyTrx`: read only transaction? 92 | * `returnFailureTraces`: return failure traces? (only available for read only transactions currently) 93 | * 94 | * If both `blocksBehind` and `expireSeconds` are present, 95 | * then fetch the block which is `blocksBehind` behind head block, 96 | * use it as a reference for TAPoS, and expire the transaction `expireSeconds` after that block's time. 97 | * 98 | * If both `useLastIrreversible` and `expireSeconds` are present, 99 | * then fetch the last irreversible block, use it as a reference for TAPoS, 100 | * and expire the transaction `expireSeconds` after that block's time. 101 | * 102 | * @returns node response if `broadcast`, `{signatures, serializedTransaction}` if `!broadcast` 103 | */ 104 | transact(transaction: Transaction, { broadcast, sign, readOnlyTrx, returnFailureTraces, requiredKeys, compression, blocksBehind, useLastIrreversible, expireSeconds }?: TransactConfig): Promise; 105 | query(account: string, short: boolean, query: Query, { sign, requiredKeys, authorization }: QueryConfig): Promise; 106 | /** Broadcast a signed transaction */ 107 | pushSignedTransaction({ signatures, serializedTransaction, serializedContextFreeData }: PushTransactionArgs, readOnlyTrx?: boolean, returnFailureTraces?: boolean): Promise; 108 | pushCompressedSignedTransaction({ signatures, serializedTransaction, serializedContextFreeData }: PushTransactionArgs, readOnlyTrx?: boolean, returnFailureTraces?: boolean): Promise; 109 | private generateTapos; 110 | private hasRequiredTaposFields; 111 | private tryGetBlockHeaderState; 112 | private tryGetBlockInfo; 113 | private tryRefBlockFromGetInfo; 114 | with(accountName: string): ActionBuilder; 115 | buildTransaction(cb?: (tx: TransactionBuilder) => void): TransactionBuilder | void; 116 | } 117 | export declare class TransactionBuilder { 118 | private api; 119 | private actions; 120 | private contextFreeGroups; 121 | constructor(api: Api); 122 | with(accountName: string): ActionBuilder; 123 | associateContextFree(contextFreeGroup: ContextFreeGroupCallback): TransactionBuilder; 124 | send(config?: TransactConfig): Promise; 125 | } 126 | export declare class ActionBuilder { 127 | private api; 128 | private readonly accountName; 129 | serializedData: ser.SerializedAction; 130 | constructor(api: Api, accountName: string); 131 | as(actorName?: string | ser.Authorization[]): ActionSerializerType; 132 | } 133 | -------------------------------------------------------------------------------- /dist/ineryjs-ecc-migration.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { PrivateKey, PublicKey } from './ineryjs-jssig'; 3 | import { ec as EC } from 'elliptic'; 4 | export declare const ecc: { 5 | initialize: () => void; 6 | unsafeRandomKey: () => void; 7 | randomKey: (cpuEntropyBits?: number, options?: { 8 | secureEnv?: boolean; 9 | ecOptions?: EC.GenKeyPairOptions; 10 | }) => Promise; 11 | seedPrivate: () => void; 12 | privateToPublic: (key: string, pubkey_prefix?: string) => string; 13 | isValidPublic: (pubkey: string, pubkey_prefix?: string) => boolean; 14 | isValidPrivate: (wif: string) => boolean; 15 | sign: (data: string | Buffer, privateKey: string | PrivateKey, encoding?: BufferEncoding) => string; 16 | signHash: (dataSha256: string | Buffer, privateKey: string | PrivateKey, encoding?: BufferEncoding) => string; 17 | verify: (signature: string, data: string, pubKey: string | PublicKey, encoding?: BufferEncoding, hashData?: boolean) => boolean; 18 | recover: (signature: string, data: string, encoding?: BufferEncoding) => string; 19 | recoverHash: (signature: string, dataSha256: string | Buffer, encoding?: BufferEncoding) => string; 20 | sha256: (data: string | Buffer, resultEncoding?: string, encoding?: string) => string | Buffer; 21 | }; 22 | -------------------------------------------------------------------------------- /dist/ineryjs-ecc-migration.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ecc = void 0; 4 | var ineryjs_jssig_1 = require("./ineryjs-jssig"); 5 | var ineryjs_key_conversions_1 = require("./ineryjs-key-conversions"); 6 | var ineryjs_numeric_1 = require("./ineryjs-numeric"); 7 | exports.ecc = { 8 | initialize: function () { return console.error('Method deprecated'); }, 9 | unsafeRandomKey: function () { return console.error('Method deprecated'); }, 10 | randomKey: function (cpuEntropyBits, options) { 11 | if (options === void 0) { options = {}; } 12 | if (cpuEntropyBits !== undefined) { 13 | console.warn('Argument `cpuEntropyBits` is deprecated, ' + 14 | 'use the options argument instead'); 15 | } 16 | var privateKey = ineryjs_key_conversions_1.generateKeyPair(ineryjs_numeric_1.KeyType.k1, options).privateKey; 17 | return Promise.resolve(privateKey.toLegacyString()); 18 | }, 19 | seedPrivate: function () { return console.error('Method deprecated'); }, 20 | privateToPublic: function (key, pubkey_prefix) { 21 | if (pubkey_prefix !== undefined) { 22 | console.warn('Argument `pubkey_prefix` is deprecated, ' + 23 | 'keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_ going forward'); 24 | } 25 | var privateKey = ineryjs_jssig_1.PrivateKey.fromString(key); 26 | var publicKey = privateKey.getPublicKey(); 27 | return publicKey.toLegacyString(); 28 | }, 29 | isValidPublic: function (pubkey, pubkey_prefix) { 30 | if (pubkey_prefix !== undefined) { 31 | console.warn('Argument `pubkey_prefix` is deprecated, ' + 32 | 'keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_ going forward'); 33 | } 34 | try { 35 | var publicKey = ineryjs_jssig_1.PublicKey.fromString(pubkey); 36 | return publicKey.isValid(); 37 | } 38 | catch (_a) { 39 | return false; 40 | } 41 | }, 42 | isValidPrivate: function (wif) { 43 | try { 44 | var privateKey = ineryjs_jssig_1.PrivateKey.fromString(wif); 45 | return privateKey.isValid(); 46 | } 47 | catch (_a) { 48 | return false; 49 | } 50 | }, 51 | sign: function (data, privateKey, encoding) { 52 | if (encoding === void 0) { encoding = 'utf8'; } 53 | var privKey = typeof privateKey === 'string' ? ineryjs_jssig_1.PrivateKey.fromString(privateKey) : privateKey; 54 | var signature = privKey.sign(data, true, encoding); 55 | return signature.toString(); 56 | }, 57 | signHash: function (dataSha256, privateKey, encoding) { 58 | if (encoding === void 0) { encoding = 'hex'; } 59 | var privKey = typeof privateKey === 'string' ? ineryjs_jssig_1.PrivateKey.fromString(privateKey) : privateKey; 60 | var signature = privKey.sign(dataSha256, false, encoding); 61 | return signature.toString(); 62 | }, 63 | verify: function (signature, data, pubKey, encoding, hashData) { 64 | if (encoding === void 0) { encoding = 'utf8'; } 65 | if (hashData === void 0) { hashData = true; } 66 | var publicKey = typeof pubKey === 'string' ? ineryjs_jssig_1.PublicKey.fromString(pubKey) : pubKey; 67 | var sig = ineryjs_jssig_1.Signature.fromString(signature); 68 | return sig.verify(data, publicKey, hashData, encoding); 69 | }, 70 | recover: function (signature, data, encoding) { 71 | if (encoding === void 0) { encoding = 'utf8'; } 72 | var sig = ineryjs_jssig_1.Signature.fromString(signature); 73 | var publicKey = sig.recover(data, true, encoding); 74 | return publicKey.toLegacyString(); 75 | }, 76 | recoverHash: function (signature, dataSha256, encoding) { 77 | if (encoding === void 0) { encoding = 'hex'; } 78 | var sig = ineryjs_jssig_1.Signature.fromString(signature); 79 | var publicKey = sig.recover(dataSha256, false, encoding); 80 | return publicKey.toLegacyString(); 81 | }, 82 | sha256: function (data, resultEncoding, encoding) { 83 | if (encoding !== undefined) { 84 | console.warn('Argument `encoding` is deprecated'); 85 | } 86 | if (resultEncoding !== undefined) { 87 | console.warn('Argument `resultEncoding` is deprecated'); 88 | } 89 | return require('./ineryjs-key-conversions').sha256(data); 90 | } 91 | }; -------------------------------------------------------------------------------- /dist/ineryjs-ecc-migration.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ineryjs-ecc-migration.js","sourceRoot":"","sources":["../src/ineryjs-ecc-migration.ts"],"names":[],"mappings":";;;AAAA,6CAA+D;AAC/D,iEAAwD;AACxD,iDAAwC;AAG3B,QAAA,GAAG,GAAG;IACf,UAAU,EAAE,cAAY,OAAA,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAlC,CAAkC;IAC1D,eAAe,EAAE,cAAY,OAAA,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAlC,CAAkC;IAC/D,SAAS,EAAE,UACP,cAAuB,EAAE,OAAuE;QAAvE,wBAAA,EAAA,YAAuE;QAEhG,IAAI,cAAc,KAAK,SAAS,EAAE;YAC9B,OAAO,CAAC,IAAI,CAAC,2CAA2C;gBACpD,kCAAkC,CAAC,CAAC;SAC3C;QAEO,IAAA,UAAU,GAAK,uCAAe,CAAC,uBAAO,CAAC,EAAE,EAAE,OAAO,CAAC,WAAzC,CAA0C;QAC5D,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,WAAW,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AAyB,EAAE,QAAgC;QAAhC,yBAAA,EAAA,gBAAgC;QACxF,IAAM,GAAG,GAAG,uBAAS,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC5C,IAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC3D,OAAO,SAAS,CAAC,cAAc,EAAE,CAAC;IACtC,CAAC;IACD,MAAM,EAAE,UAAC,IAAmB,EAAE,cAAuB,EAAE,QAAiB;QACpE,IAAI,QAAQ,KAAK,SAAS,EAAE;YACxB,OAAO,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;SACrD;QACD,IAAI,cAAc,KAAK,SAAS,EAAE;YAC9B,OAAO,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;SAC3D;QAED,OAAO,OAAO,CAAC,yBAAyB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;CACJ,CAAC"} -------------------------------------------------------------------------------- /dist/ineryjs-jsonrpc.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @module JSON-RPC 3 | */ 4 | import { AbiProvider, AuthorityProvider, AuthorityProviderArgs, BinaryAbi, TransactResult } from './ineryjs-api-interfaces'; 5 | import { AbiBinToJsonResult, AbiJsonToBinResult, GetAbiResult, GetAccountResult, GetAccountsByAuthorizersResult, GetActivatedProtocolFeaturesParams, GetActivatedProtocolFeaturesResult, GetBlockInfoResult, GetBlockResult, GetCodeResult, GetCodeHashResult, GetCurrencyStatsResult, GetInfoResult, GetProducerScheduleResult, GetProducersResult, GetRawCodeAndAbiResult, GetRawAbiResult, GetScheduledTransactionsResult, GetTableRowsResult, PushTransactionArgs, ReadOnlyTransactResult, GetBlockHeaderStateResult, GetTableByScopeResult, DBSizeGetResult, TraceApiGetBlockResult, GetActionsResult, GetTransactionResult, GetKeyAccountsResult, GetControlledAccountsResult } from './ineryjs-rpc-interfaces'; 6 | import { Authorization } from './ineryjs-serialize'; 7 | /** Make RPC calls */ 8 | export declare class JsonRpc implements AuthorityProvider, AbiProvider { 9 | endpoint: string; 10 | fetchBuiltin: (input?: any, init?: any) => Promise; 11 | /** 12 | * @param args 13 | * `fetch`: 14 | * browsers: leave `null` or `undefined` 15 | * node: provide an implementation 16 | */ 17 | constructor(endpoint: string, args?: { 18 | fetch?: (input?: any, init?: any) => Promise; 19 | }); 20 | /** Post `body` to `endpoint + path`. Throws detailed error information in `RpcError` when available. */ 21 | fetch(path: string, body: any): Promise; 22 | abi_bin_to_json(code: string, action: string, binargs: string): Promise; 23 | abi_json_to_bin(code: string, action: string, args: any[]): Promise; 24 | /** Raw call to `/v1/chain/get_abi` */ 25 | get_abi(accountName: string): Promise; 26 | /** Raw call to `/v1/chain/get_account` */ 27 | get_account(accountName: string): Promise; 28 | /** Raw call to `/v1/chain/get_accounts_by_authorizers` */ 29 | get_accounts_by_authorizers(accounts: Authorization[], keys: string[]): Promise; 30 | /** Raw call to `get_activated_protocol_features` */ 31 | get_activated_protocol_features({ limit, search_by_block_num, reverse, lower_bound, upper_bound, }: GetActivatedProtocolFeaturesParams): Promise; 32 | /** Raw call to `/v1/chain/get_block_header_state` */ 33 | get_block_header_state(blockNumOrId: number | string): Promise; 34 | /** Raw call to `/v1/chain/get_block_info` */ 35 | get_block_info(blockNum: number): Promise; 36 | /** Raw call to `/v1/chain/get_block` */ 37 | get_block(blockNumOrId: number | string): Promise; 38 | /** Raw call to `/v1/chain/get_code` */ 39 | get_code(accountName: string): Promise; 40 | /** Raw call to `/v1/chain/get_code_hash` */ 41 | get_code_hash(accountName: string): Promise; 42 | /** Raw call to `/v1/chain/get_currency_balance` */ 43 | get_currency_balance(code: string, account: string, symbol?: string): Promise; 44 | /** Raw call to `/v1/chain/get_currency_stats` */ 45 | get_currency_stats(code: string, symbol: string): Promise; 46 | /** Raw call to `/v1/chain/get_info` */ 47 | get_info(): Promise; 48 | /** Raw call to `/v1/chain/get_producer_schedule` */ 49 | get_producer_schedule(): Promise; 50 | /** Raw call to `/v1/chain/get_producers` */ 51 | get_producers(json?: boolean, lowerBound?: string, limit?: number): Promise; 52 | /** Raw call to `/v1/chain/get_raw_code_and_abi` */ 53 | get_raw_code_and_abi(accountName: string): Promise; 54 | /** calls `/v1/chain/get_raw_code_and_abi` and pulls out unneeded raw wasm code */ 55 | getRawAbi(accountName: string): Promise; 56 | /** Raw call to `/v1/chain/get_raw_abi` */ 57 | get_raw_abi(accountName: string): Promise; 58 | /** Raw call to `/v1/chain/get_scheduled_transactions` */ 59 | get_scheduled_transactions(json?: boolean, lowerBound?: string, limit?: number): Promise; 60 | /** Raw call to `/v1/chain/get_table_rows` */ 61 | get_table_rows({ json, code, scope, table, lower_bound, upper_bound, index_position, key_type, limit, reverse, show_payer, }: any): Promise; 62 | /** Raw call to `/v1/chain/get_kv_table_rows` */ 63 | get_kv_table_rows({ json, code, table, index_name, encode_type, index_value, lower_bound, upper_bound, limit, reverse, show_payer, }: any): Promise; 64 | /** Raw call to `/v1/chain/get_table_by_scope` */ 65 | get_table_by_scope({ code, table, lower_bound, upper_bound, limit, }: any): Promise; 66 | /** Get subset of `availableKeys` needed to meet authorities in `transaction`. Implements `AuthorityProvider` */ 67 | getRequiredKeys(args: AuthorityProviderArgs): Promise; 68 | /** Push a serialized transaction (replaced by send_transaction, but returned format has changed) */ 69 | push_transaction({ signatures, compression, serializedTransaction, serializedContextFreeData }: PushTransactionArgs): Promise; 70 | /** Raw call to `/v1/chain/push_ro_transaction */ 71 | push_ro_transaction({ signatures, compression, serializedTransaction }: PushTransactionArgs, returnFailureTraces?: boolean): Promise; 72 | push_transactions(transactions: PushTransactionArgs[]): Promise; 73 | /** Send a serialized transaction */ 74 | send_transaction({ signatures, compression, serializedTransaction, serializedContextFreeData }: PushTransactionArgs): Promise; 75 | /** Raw call to `/v1/db_size/get` */ 76 | db_size_get(): Promise; 77 | /** Raw call to `/v1/trace_api/get_block` */ 78 | trace_get_block(block_num: number): Promise; 79 | /** Raw call to `/v1/history/get_actions` */ 80 | history_get_actions(accountName: string, pos?: number, offset?: number): Promise; 81 | /** Raw call to `/v1/history/get_transaction` */ 82 | history_get_transaction(id: string, blockNumHint?: number): Promise; 83 | /** Raw call to `/v1/history/get_key_accounts` */ 84 | history_get_key_accounts(publicKey: string): Promise; 85 | /** Raw call to `/v1/history/get_controlled_accounts` */ 86 | history_get_controlled_accounts(controllingAccount: string): Promise; 87 | } 88 | -------------------------------------------------------------------------------- /dist/ineryjs-jssig.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @module JS-Sig 3 | */ 4 | import { ec } from 'elliptic'; 5 | import { SignatureProvider, SignatureProviderArgs } from './ineryjs-api-interfaces'; 6 | import { PushTransactionArgs } from './ineryjs-rpc-interfaces'; 7 | import { PrivateKey, PublicKey, Signature } from './ineryjs-key-conversions'; 8 | /** Construct the digest from transaction details */ 9 | declare const digestFromSerializedData: (chainId: string, serializedTransaction: Uint8Array, serializedContextFreeData?: Uint8Array, e?: ec) => string; 10 | /** Signs transactions using in-process private keys */ 11 | declare class JsSignatureProvider implements SignatureProvider { 12 | /** map public to private keys */ 13 | keys: Map; 14 | /** public keys */ 15 | availableKeys: string[]; 16 | /** @param privateKeys private keys to sign with */ 17 | constructor(privateKeys: string[]); 18 | /** Public keys associated with the private keys that the `SignatureProvider` holds */ 19 | getAvailableKeys(): Promise; 20 | /** Sign a transaction */ 21 | sign({ chainId, requiredKeys, serializedTransaction, serializedContextFreeData }: SignatureProviderArgs): Promise; 22 | } 23 | export { PrivateKey, PublicKey, Signature, digestFromSerializedData, JsSignatureProvider, }; 24 | -------------------------------------------------------------------------------- /dist/ineryjs-jssig.js: -------------------------------------------------------------------------------- 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 | var __values = (this && this.__values) || function(o) { 39 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 40 | if (m) return m.call(o); 41 | if (o && typeof o.length === "number") return { 42 | next: function () { 43 | if (o && i >= o.length) o = void 0; 44 | return { value: o && o[i++], done: !o }; 45 | } 46 | }; 47 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 48 | }; 49 | Object.defineProperty(exports, "__esModule", { value: true }); 50 | exports.JsSignatureProvider = exports.digestFromSerializedData = exports.Signature = exports.PublicKey = exports.PrivateKey = void 0; 51 | var elliptic_1 = require("elliptic"); 52 | var ineryjs_key_conversions_1 = require("./ineryjs-key-conversions"); 53 | Object.defineProperty(exports, "PrivateKey", { enumerable: true, get: function () { return ineryjs_key_conversions_1.PrivateKey; } }); 54 | Object.defineProperty(exports, "PublicKey", { enumerable: true, get: function () { return ineryjs_key_conversions_1.PublicKey; } }); 55 | Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return ineryjs_key_conversions_1.Signature; } }); 56 | var ineryjs_numeric_1 = require("./ineryjs-numeric"); 57 | var defaultEc = new elliptic_1.ec('secp256k1'); 58 | var digestFromSerializedData = function (chainId, serializedTransaction, serializedContextFreeData, e) { 59 | if (e === void 0) { e = defaultEc; } 60 | var signBuf = Buffer.concat([ 61 | Buffer.from(chainId, 'hex'), 62 | Buffer.from(serializedTransaction), 63 | Buffer.from(serializedContextFreeData ? 64 | new Uint8Array(e.hash().update(serializedContextFreeData).digest()) : 65 | new Uint8Array(32)), 66 | ]); 67 | return e.hash().update(signBuf).digest(); 68 | }; 69 | exports.digestFromSerializedData = digestFromSerializedData; 70 | /** 71 | * Signs transactions using in-process private keys 72 | * @class 73 | */ 74 | class JsSignatureProvider{ 75 | /** @param {Array} privateKeys private keys to sign with */ 76 | constructor(privateKeys) { 77 | var e_1, _a; 78 | /** @summary map public to private keys */ 79 | this.keys = new Map(); 80 | /** @summary public keys */ 81 | this.availableKeys = []; 82 | try { 83 | for (var privateKeys_1 = __values(privateKeys), privateKeys_1_1 = privateKeys_1.next(); !privateKeys_1_1.done; privateKeys_1_1 = privateKeys_1.next()) { 84 | var k = privateKeys_1_1.value; 85 | var priv = ineryjs_key_conversions_1.PrivateKey.fromString(k); 86 | var privElliptic = priv.toElliptic(); 87 | var pubStr = priv.getPublicKey().toString(); 88 | this.keys.set(pubStr, privElliptic); 89 | this.availableKeys.push(pubStr); 90 | } 91 | } 92 | catch (e_1_1) { e_1 = { error: e_1_1 }; } 93 | finally { 94 | try { 95 | if (privateKeys_1_1 && !privateKeys_1_1.done && (_a = privateKeys_1.return)) _a.call(privateKeys_1); 96 | } 97 | finally { if (e_1) throw e_1.error; } 98 | } 99 | } 100 | /** @summary Public keys associated with the private keys that the `SignatureProvider` holds */ 101 | getAvailableKeys() { 102 | return __awaiter(this, void 0, void 0, function () { 103 | return __generator(this, function (_a) { 104 | return [2 /*return*/, this.availableKeys]; 105 | }); 106 | }); 107 | }; 108 | /** @summary Sign a transaction 109 | * @param {SignArgs} _a 110 | * @returns {Promise} 111 | */ 112 | sign(_a) { 113 | var chainId = _a.chainId, requiredKeys = _a.requiredKeys, serializedTransaction = _a.serializedTransaction, serializedContextFreeData = _a.serializedContextFreeData; 114 | return __awaiter(this, void 0, void 0, function () { 115 | var digest, signatures, requiredKeys_1, requiredKeys_1_1, key, publicKey, ellipticPrivateKey, privateKey, signature; 116 | var e_2, _b; 117 | return __generator(this, function (_c) { 118 | digest = digestFromSerializedData(chainId, serializedTransaction, serializedContextFreeData, defaultEc); 119 | signatures = []; 120 | try { 121 | for (requiredKeys_1 = __values(requiredKeys), requiredKeys_1_1 = requiredKeys_1.next(); !requiredKeys_1_1.done; requiredKeys_1_1 = requiredKeys_1.next()) { 122 | key = requiredKeys_1_1.value; 123 | publicKey = ineryjs_key_conversions_1.PublicKey.fromString(key); 124 | ellipticPrivateKey = this.keys.get(ineryjs_numeric_1.convertLegacyPublicKey(key)); 125 | privateKey = ineryjs_key_conversions_1.PrivateKey.fromElliptic(ellipticPrivateKey, publicKey.getType()); 126 | signature = privateKey.sign(digest, false); 127 | signatures.push(signature.toString()); 128 | } 129 | } 130 | catch (e_2_1) { e_2 = { error: e_2_1 }; } 131 | finally { 132 | try { 133 | if (requiredKeys_1_1 && !requiredKeys_1_1.done && (_b = requiredKeys_1.return)) _b.call(requiredKeys_1); 134 | } 135 | finally { if (e_2) throw e_2.error; } 136 | } 137 | return [2 /*return*/, { signatures: signatures, serializedTransaction: serializedTransaction, serializedContextFreeData: serializedContextFreeData }]; 138 | }); 139 | }); 140 | }; 141 | } 142 | exports.JsSignatureProvider = JsSignatureProvider; -------------------------------------------------------------------------------- /dist/ineryjs-jssig.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ineryjs-jssig.js","sourceRoot":"","sources":["../src/ineryjs-jssig.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzC,qCAA8B;AAI9B,iEAIiC;AAoE7B,2FAvEA,kCAAU,OAuEA;AACV,0FAvEA,iCAAS,OAuEA;AACT,0FAvEA,iCAAS,OAuEA;AArEb,iDAAyD;AAEzD,4DAA4D;AAC5D,IAAM,SAAS,GAAG,IAAI,aAAE,CAAC,WAAW,CAAC,CAAC;AAEtC,oDAAoD;AACpD,IAAM,wBAAwB,GAAG,UAC7B,OAAe,EACf,qBAAiC,EACjC,yBAAsC,EACtC,CAAa;IAAb,kBAAA,EAAA,aAAa;IACb,IAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC;QAClC,MAAM,CAAC,IAAI,CACP,yBAAyB,CAAC,CAAC;YACvB,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YACrE,IAAI,UAAU,CAAC,EAAE,CAAC,CACzB;KACJ,CAAC,C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AAI,CAAC,IAAI,CAAC,GAAG,CAAC,sCAAsB,CAAC,GAAG,CAAC,CAAC,CAAC;wBAChE,UAAU,GAAG,kCAAU,CAAC,YAAY,CAAC,kBAAkB,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;wBAC9E,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;wBACjD,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;qBACzC;;;;;;;;;gBAED,sBAAO,EAAE,UAAU,YAAA,EAAE,qBAAqB,uBAAA,EAAE,yBAAyB,2BAAA,EAAE,EAAC;;;KAC3E;IACL,0BAAC;AAAD,CAAC,AAxCD,IAwCC;AAOG,kDAAmB"} -------------------------------------------------------------------------------- /dist/ineryjs-key-conversions.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { ec as EC } from 'elliptic'; 3 | import { KeyType } from './ineryjs-numeric'; 4 | import { PublicKey } from './PublicKey'; 5 | import { PrivateKey } from './PrivateKey'; 6 | export { PrivateKey } from './PrivateKey'; 7 | export { PublicKey } from './PublicKey'; 8 | export { Signature } from './Signature'; 9 | /** Construct the elliptic curve object based on key type */ 10 | export declare const constructElliptic: (type: KeyType) => EC; 11 | export declare const generateKeyPair: (type: KeyType, options?: { 12 | secureEnv?: boolean; 13 | ecOptions?: EC.GenKeyPairOptions; 14 | }) => { 15 | publicKey: PublicKey; 16 | privateKey: PrivateKey; 17 | }; 18 | export declare const sha256: (data: string | Buffer) => number[] | string; 19 | -------------------------------------------------------------------------------- /dist/ineryjs-key-conversions.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.sha256 = exports.generateKeyPair = exports.constructElliptic = exports.Signature = exports.PublicKey = exports.PrivateKey = void 0; 4 | var elliptic_1 = require("elliptic"); 5 | var hash = require("hash.js"); 6 | var ineryjs_numeric_1 = require("./ineryjs-numeric"); 7 | var PublicKey_1 = require("./PublicKey"); 8 | var PrivateKey_1 = require("./PrivateKey"); 9 | var PrivateKey_2 = require("./PrivateKey"); 10 | Object.defineProperty(exports, "PrivateKey", { enumerable: true, get: function () { return PrivateKey_2.PrivateKey; } }); 11 | var PublicKey_2 = require("./PublicKey"); 12 | Object.defineProperty(exports, "PublicKey", { enumerable: true, get: function () { return PublicKey_2.PublicKey; } }); 13 | var Signature_1 = require("./Signature"); 14 | Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return Signature_1.Signature; } }); 15 | /** Construct the elliptic curve object based on key type */ 16 | var constructElliptic = function (type) { 17 | if (type === ineryjs_numeric_1.KeyType.k1) { 18 | return new elliptic_1.ec('secp256k1'); 19 | } 20 | return new elliptic_1.ec('p256'); 21 | }; 22 | exports.constructElliptic = constructElliptic; 23 | var generateKeyPair = function (type, options) { 24 | if (options === void 0) { options = {}; } 25 | if (!options.secureEnv) { 26 | throw new Error('Key generation is completely INSECURE in production environments in the browser. ' + 27 | 'If you are absolutely certain this does NOT describe your environment, set `secureEnv` in your ' + 28 | 'options to `true`. If this does describe your environment and you set `secureEnv` to `true`, ' + 29 | 'YOU DO SO AT YOUR OWN RISK AND THE RISK OF YOUR USERS.'); 30 | } 31 | var ec; 32 | if (type === ineryjs_numeric_1.KeyType.k1) { 33 | ec = new elliptic_1.ec('secp256k1'); 34 | } 35 | else { 36 | ec = new elliptic_1.ec('p256'); 37 | } 38 | var ellipticKeyPair = ec.genKeyPair(options.ecOptions); 39 | var publicKey = PublicKey_1.PublicKey.fromElliptic(ellipticKeyPair, type, ec); 40 | var privateKey = PrivateKey_1.PrivateKey.fromElliptic(ellipticKeyPair, type, ec); 41 | return { publicKey: publicKey, privateKey: privateKey }; 42 | }; 43 | exports.generateKeyPair = generateKeyPair; 44 | var sha256 = function (data) { 45 | return hash.sha256().update(data).digest(); 46 | }; 47 | exports.sha256 = sha256; -------------------------------------------------------------------------------- /dist/ineryjs-key-conversions.js.map: -------------------------------------------------------------------------------- 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,SAAS,WAAA,EAAE,UAAU,YAAA,EAAC,CAAC;AACnC,CAAC,CAAC;AAnBW,QAAA,eAAe,mBAmB1B;AAEK,IAAM,MAAM,GAAG,UAAC,IAAmB;IACtC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC/C,CAAC,CAAC;AAFW,QAAA,MAAM,UAEjB"} -------------------------------------------------------------------------------- /dist/ineryjs-numeric.d.ts: -------------------------------------------------------------------------------- 1 | /** Is `bignum` a negative number? */ 2 | export declare const isNegative: (bignum: Uint8Array) => boolean; 3 | /** Negate `bignum` */ 4 | export declare const negate: (bignum: Uint8Array) => void; 5 | /** 6 | * Convert an unsigned decimal number in `s` to a bignum 7 | * 8 | * @param size bignum size (bytes) 9 | */ 10 | export declare const decimalToBinary: (size: number, s: string) => Uint8Array; 11 | /** 12 | * Convert a signed decimal number in `s` to a bignum 13 | * 14 | * @param size bignum size (bytes) 15 | */ 16 | export declare const signedDecimalToBinary: (size: number, s: string) => Uint8Array; 17 | /** 18 | * Convert `bignum` to an unsigned decimal number 19 | * 20 | * @param minDigits 0-pad result to this many digits 21 | */ 22 | export declare const binaryToDecimal: (bignum: Uint8Array, minDigits?: number) => string; 23 | /** 24 | * Convert `bignum` to a signed decimal number 25 | * 26 | * @param minDigits 0-pad result to this many digits 27 | */ 28 | export declare const signedBinaryToDecimal: (bignum: Uint8Array, minDigits?: number) => string; 29 | /** 30 | * Convert an unsigned base-58 number in `s` to a bignum 31 | * 32 | * @param size bignum size (bytes) 33 | */ 34 | export declare const base58ToBinary: (size: number, s: string) => Uint8Array; 35 | /** 36 | * Convert `bignum` to a base-58 number 37 | * 38 | * @param minDigits 0-pad result to this many digits 39 | */ 40 | export declare const binaryToBase58: (bignum: Uint8Array, minDigits?: number) => string; 41 | /** Convert an unsigned base-64 number in `s` to a bignum */ 42 | export declare const base64ToBinary: (s: string) => Uint8Array; 43 | /** Key types this library supports */ 44 | export declare enum KeyType { 45 | k1 = 0, 46 | r1 = 1, 47 | wa = 2 48 | } 49 | /** Public key data size, excluding type field */ 50 | export declare const publicKeyDataSize = 33; 51 | /** Private key data size, excluding type field */ 52 | export declare const privateKeyDataSize = 32; 53 | /** Signature data size, excluding type field */ 54 | export declare const signatureDataSize = 65; 55 | /** Public key, private key, or signature in binary form */ 56 | export interface Key { 57 | type: KeyType; 58 | data: Uint8Array; 59 | } 60 | /** Convert key in `s` to binary form */ 61 | export declare const stringToPublicKey: (s: string) => Key; 62 | /** Convert public `key` to legacy string (base-58) form */ 63 | export declare const publicKeyToLegacyString: (key: Key) => string; 64 | /** Convert `key` to string (base-58) form */ 65 | export declare const publicKeyToString: (key: Key) => string; 66 | /** If a key is in the legacy format (`INERY` prefix), then convert it to the new format (`PUB_K1_`). 67 | * Leaves other formats untouched 68 | */ 69 | export declare const convertLegacyPublicKey: (s: string) => string; 70 | /** If a key is in the legacy format (`INERY` prefix), then convert it to the new format (`PUB_K1_`). 71 | * Leaves other formats untouched 72 | */ 73 | export declare const convertLegacyPublicKeys: (keys: string[]) => string[]; 74 | /** Convert key in `s` to binary form */ 75 | export declare const stringToPrivateKey: (s: string) => Key; 76 | /** Convert private `key` to legacy string (base-58) form */ 77 | export declare const privateKeyToLegacyString: (key: Key) => string; 78 | /** Convert `key` to string (base-58) form */ 79 | export declare const privateKeyToString: (key: Key) => string; 80 | /** Convert key in `s` to binary form */ 81 | export declare const stringToSignature: (s: string) => Key; 82 | /** Convert `signature` to string (base-58) form */ 83 | export declare const signatureToString: (signature: Key) => string; 84 | -------------------------------------------------------------------------------- /dist/ineryjs-rpc-interfaces.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * @module RPC-API-Methods 4 | */ 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | -------------------------------------------------------------------------------- /dist/ineryjs-rpc-interfaces.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ineryjs-rpc-interfaces.js","sourceRoot":"","sources":["../src/ineryjs-rpc-interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAqSF,CAAC"} -------------------------------------------------------------------------------- /dist/ineryjs-rpcerror.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @module RPC-Error 3 | */ 4 | /** Holds detailed error information */ 5 | export declare class RpcError extends Error { 6 | /** Detailed error information */ 7 | json: any; 8 | details: any; 9 | constructor(json: any); 10 | } 11 | -------------------------------------------------------------------------------- /dist/ineryjs-rpcerror.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * @module RPC-Error 4 | */ 5 | var __extends = (this && this.__extends) || (function () { 6 | var extendStatics = function (d, b) { 7 | extendStatics = Object.setPrototypeOf || 8 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 9 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 10 | return extendStatics(d, b); 11 | }; 12 | return function (d, b) { 13 | if (typeof b !== "function" && b !== null) 14 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 15 | extendStatics(d, b); 16 | function __() { this.constructor = d; } 17 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 18 | }; 19 | })(); 20 | Object.defineProperty(exports, "__esModule", { value: true }); 21 | exports.RpcError = void 0; 22 | /** Holds detailed error information */ 23 | var RpcError = /** @class */ (function (_super) { 24 | __extends(RpcError, _super); 25 | function RpcError(json) { 26 | var _this = this; 27 | if (json.error && json.error.details && json.error.details.length && json.error.details[0].message) { 28 | _this = _super.call(this, json.error.details[0].message) || this; 29 | _this.details = json.error.details; 30 | } 31 | else if (json.processed && json.processed.except && json.processed.except.message) { 32 | _this = _super.call(this, json.processed.except.message) || this; 33 | _this.details = json.processed.except; 34 | } 35 | else if (json.result && json.result.except && json.result.except.message) { 36 | _this = _super.call(this, json.result.except.message) || this; 37 | _this.details = json.result.except; 38 | } 39 | else { 40 | _this = _super.call(this, json.message) || this; 41 | } 42 | Object.setPrototypeOf(_this, RpcError.prototype); 43 | _this.json = json; 44 | return _this; 45 | } 46 | return RpcError; 47 | }(Error)); 48 | exports.RpcError = RpcError; -------------------------------------------------------------------------------- /dist/ineryjs-rpcerror.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ineryjs-rpcerror.js","sourceRoot":"","sources":["../src/ineryjs-rpcerror.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,yCAAyC;;;;;;;;;;;;;;;;;;AAEzC,uCAAuC;AACvC;IAA8B,4BAAK;IAK/B,kBAAY,IAAS;QAArB,iBAeC;QAdG,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE;YAChG,QAAA,kBAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAC;YACrC,KAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;SACrC;aAAM,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE;YACjF,QAAA,kBAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,SAAC;YACrC,KAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;SACxC;aAAM,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;YACxE,QAAA,kBAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAC;YAClC,KAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;SACrC;aAAM;YACH,QAAA,kBAAM,IAAI,CAAC,OAAO,CAAC,SAAC;SACvB;QACD,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;QAChD,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACrB,CAAC;IACL,eAAC;AAAD,CAAC,AArBD,CAA8B,KAAK,GAqBlC;AArBY,4BAAQ"} -------------------------------------------------------------------------------- /dist/ineryjs-webauthn-sig.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @module WebAuthn-Sig 3 | */ 4 | import { SignatureProvider, SignatureProviderArgs } from './ineryjs-api-interfaces'; 5 | import { PushTransactionArgs } from './ineryjs-rpc-interfaces'; 6 | /** Signs transactions using WebAuthn */ 7 | export declare class WebAuthnSignatureProvider implements SignatureProvider { 8 | /** Map public key to credential ID (hex). User must populate this. */ 9 | keys: Map; 10 | /** Public keys that the `SignatureProvider` holds */ 11 | getAvailableKeys(): Promise; 12 | /** Sign a transaction */ 13 | sign({ chainId, requiredKeys, serializedTransaction, serializedContextFreeData }: SignatureProviderArgs): Promise; 14 | } 15 | -------------------------------------------------------------------------------- /dist/ineryjs-webauthn-sig.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ineryjs-webauthn-sig.js","sourceRoot":"","sources":["../src/ineryjs-webauthn-sig.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIzC,uCAAyC;AACzC,yCAA2C;AAC3C,qCAA8B;AAE9B,wCAAwC;AACxC;IAAA;QACI,sEAAsE;QAC/D,SAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IAyF5C,CAAC;IAvFG,qDAAqD;IACxC,oDAAgB,GAA7B;;;gBACI,sBAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAC;;;KACvC;IAED,y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BACrB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;wBACrB,OAAO,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC;wBACxE,OAAO,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC;wBAE/D,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC;4BAClC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;4BACxB,IAAI,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE;yBACvC,CAAC,CAAC;wBACH,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;;;;;;;;;;;;;;;6BAEzB,sBAAO,EAAE,UAAU,YAAA,EAAE,qBAAqB,uBAAA,EAAE,yBAAyB,2BAAA,EAAE,EAAC;;;;KAC3E;IACL,gCAAC;AAAD,CAAC,AA3FD,IA2FC;AA3FY,8DAAyB"} -------------------------------------------------------------------------------- /dist/rpc-web.d.ts: -------------------------------------------------------------------------------- 1 | import { JsonRpc } from './ineryjs-jsonrpc'; 2 | import { RpcError } from './ineryjs-rpcerror'; 3 | export { JsonRpc, RpcError }; 4 | -------------------------------------------------------------------------------- /dist/rpc-web.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.RpcError = exports.JsonRpc = void 0; 4 | var ineryjs_jsonrpc_1 = require("./ineryjs-jsonrpc"); 5 | Object.defineProperty(exports, "JsonRpc", { enumerable: true, get: function () { return ineryjs_jsonrpc_1.JsonRpc; } }); 6 | var ineryjs_rpcerror_1 = require("./ineryjs-rpcerror"); 7 | Object.defineProperty(exports, "RpcError", { enumerable: true, get: function () { return ineryjs_rpcerror_1.RpcError; } }); -------------------------------------------------------------------------------- /dist/rpc-web.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"rpc-web.js","sourceRoot":"","sources":["../src/rpc-web.ts"],"names":[],"mappings":";;;AAAA,iDAA0C;AAGjC,wFAHA,uBAAO,OAGA;AAFhB,mDAA4C;AAE1B,yFAFT,yBAAQ,OAES"} -------------------------------------------------------------------------------- /docs/RPC-API-Methods%0Acopyright%20defined%20in%20ineryjs_LICENSE.txtmodule_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Module: RPC-API-Methods 6 | copyright defined in ineryjs/LICENSE.txt 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 |

Module: RPC-API-Methods 22 | copyright defined in ineryjs/LICENSE.txt

23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
32 | 33 |
34 | 35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 |
44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
Source:
71 |
74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 |
82 | 83 | 84 | 85 | 86 |
87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 |
108 | 109 |
110 | 111 | 112 | 113 | 114 |
115 | 116 | 120 | 121 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /docs/fonts/Inconsolata-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/Inconsolata-Regular.ttf -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /docs/fonts/WorkSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/docs/fonts/WorkSans-Bold.ttf -------------------------------------------------------------------------------- /docs/module-API.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Module: API 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Module: API

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 | 32 | 33 |
34 | 35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
64 | 65 |
66 | 67 | 68 | 69 | 70 |
71 | 72 | 75 | 76 |
77 | 78 |
79 | Documentation generated by JSDoc 3.6.11 on Tue Jul 26 2022 11:18:42 GMT+0200 (Central European Summer Time) 80 |
81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/module-JsonRpc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Module: JsonRpc 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Module: JsonRpc

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 | 32 | 33 |
34 | 35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 |

Classes

50 | 51 |
52 |
JsonRpc
53 |
54 |
55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
71 | 72 |
73 | 74 | 75 | 76 | 77 |
78 | 79 | 82 | 83 |
84 | 85 |
86 | Documentation generated by JSDoc 3.6.11 on Tue Jul 26 2022 10:08:24 GMT+0200 (Central European Summer Time) 87 |
88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /docs/scripts/core.min.js: -------------------------------------------------------------------------------- 1 | var accordionLocalStorageKey="accordion-id",themeLocalStorageKey="theme",fontSizeLocalStorageKey="font-size",html=document.querySelector("html"),MAX_FONT_SIZE=30,MIN_FONT_SIZE=10,localStorage=window.localStorage;function getTheme(){return document.body.getAttribute("data-theme")}function updateTheme(e){var t=document.body,o=document.querySelectorAll(".theme-svg-use"),n="dark"===e?"#light-theme-icon":"#dark-theme-icon";t.setAttribute("data-theme",e),t.classList.remove("dark","light"),t.classList.add(e),o.forEach(function(e){e.setAttribute("xlink:href",n)}),localStorage.setItem(themeLocalStorageKey,e)}function toggleTheme(){updateTheme("dark"===document.body.getAttribute("data-theme")?"light":"dark")}function setAccordionIdToLocalStorage(e){var t=JSON.parse(localStorage.getItem(accordionLocalStorageKey));t[e]=e,localStorage.setItem(accordionLocalStorageKey,JSON.stringify(t))}function removeAccordionIdFromLocalStorage(e){var t=JSON.parse(localStorage.getItem(accordionLocalStorageKey));delete t[e],localStorage.setItem(accordionLocalStorageKey,JSON.stringify(t))}function getAccordionIdsFromLocalStorage(){return JSON.parse(localStorage.getItem(accordionLocalStorageKey))||{}}function toggleAccordion(e){"false"===e.getAttribute("data-isopen")?(e.setAttribute("data-isopen","true"),setAccordionIdToLocalStorage(e.id)):(e.setAttribute("data-isopen","false"),removeAccordionIdFromLocalStorage(e.id))}function initAccordion(){void 0!==localStorage.getItem(accordionLocalStorageKey)&&null!==localStorage.getItem(accordionLocalStorageKey)||localStorage.setItem(accordionLocalStorageKey,"{}");var e=document.querySelectorAll(".sidebar-section-title"),t=getAccordionIdsFromLocalStorage();e.forEach(function(e){e.addEventListener("click",function(){toggleAccordion(e)}),e.id in t&&toggleAccordion(e)})}function isSourcePage(){return Boolean(document.querySelector("#source-page"))}function bringElementIntoView(e,t=!0){var o,n,i,c;e&&(o=document.querySelector(".navbar-container"),n=document.querySelector(".main-content"),i=e.getBoundingClientRect().top,c=16,o&&(c+=o.scrollHeight),n&&n.scrollBy(0,i-c),t&&history.pushState(null,null,"#"+e.id))}function bringLinkToView(e){e.preventDefault(),e.stopPropagation();var e=e.currentTarget.getAttribute("href");!e||(e=document.getElementById(e.slice(1)))&&bringElementIntoView(e)}function bringIdToViewOnMount(){var e,t;isSourcePage()||""!==(e=window.location.hash)&&((t=document.getElementById(e.slice(1)))||(e=decodeURI(e),t=document.getElementById(e.slice(1))),t&&bringElementIntoView(t,!1))}function createAnchorElement(e){var t=document.createElement("a");return t.textContent="#",t.href="#"+e,t.classList.add("link-anchor"),t.onclick=bringLinkToView,t}function addAnchor(){var e=document.querySelector(".main-content").querySelector("section");[e.querySelectorAll("h1"),e.querySelectorAll("h2"),e.querySelectorAll("h3"),e.querySelectorAll("h4")].forEach(function(e){e.forEach(function(e){var t=createAnchorElement(e.id);e.classList.add("has-anchor"),e.append(t)})})}function copy(e){console.log(e);const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}function showTooltip(e){var t=document.getElementById(e);t.classList.add("show-tooltip"),setTimeout(function(){t.classList.remove("show-tooltip")},3e3)}function copyFunction(e){var t=document.getElementById(e);copy((t.querySelector(".linenums")||t.querySelector("code")).innerText.trim()),showTooltip("tooltip-"+e)}function hideTocOnSourcePage(){isSourcePage()&&(document.querySelector(".toc-container").style.display="none")}function getPreTopBar(e,t=""){e='";return'
'+('
'+t.toLocaleUpperCase()+"
")+e+"
"}function getPreDiv(){var e=document.createElement("div");return e.classList.add("pre-div"),e}function processAllPre(){var e=document.querySelectorAll("pre"),t=document.querySelector("#PeOAagUepe"),o=document.querySelector("#VuAckcnZhf"),n=0,i=0,c=(t&&(i=t.getBoundingClientRect().height),o&&(n=o.getBoundingClientRect().height),window.innerHeight-n-i-250);e.forEach(function(e,t){var o,n=e.parentNode;n&&"true"===n.getAttribute("data-skip-pre-process")||(n=getPreDiv(),o=getPreTopBar(t="ScDloZOMdL"+t,e.getAttribute("data-lang")||"code"),n.innerHTML=o,e.style.maxHeight=c+"px",e.id=t,e.classList.add("prettyprint"),e.parentNode.insertBefore(n,e),n.appendChild(e))})}function highlightAndBringLineIntoView(){var e=window.location.hash.replace("#line","");try{var t='[data-line-number="'+e+'"',o=document.querySelector(t);o.scrollIntoView(),o.parentNode.classList.add("selected")}catch(e){console.error(e)}}function getFontSize(){var e=16;try{e=Number.parseInt(html.style.fontSize.split("px")[0],10)}catch(e){console.log(e)}return e}function updateFontSize(e){html.style.fontSize=e+"px",localStorage.setItem(fontSizeLocalStorageKey,e);var t=document.querySelector("#b77a68a492f343baabea06fad81f651e");t&&(t.innerHTML=e)}function incrementFont(e){var t=getFontSize();t 3 | 8 |
9 | ${e} 10 |
11 | 16 | 21 | 22 | 23 | `}function initTooltip(){tippy(".theme-toggle",{content:"Toggle Theme",delay:500}),tippy(".search-button",{content:"Search",delay:500}),tippy(".font-size",{content:"Change font size",delay:500}),tippy(".codepen-button",{content:"Open code in CodePen",placement:"left"}),tippy(".copy-code",{content:"Copy this code",placement:"left"}),tippy(".font-size",{content:fontSizeTooltip(),trigger:"click",interactive:!0,allowHTML:!0,placement:"left"})}function fixTable(){var e,t=document.querySelectorAll("table");if(!(900{e=new URL(e.newURL);""!==e.hash&&bringIdToViewOnMount(e.hash)}); -------------------------------------------------------------------------------- /docs/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (() => { 3 | const source = document.getElementsByClassName('prettyprint source linenums'); 4 | let i = 0; 5 | let lineNumber = 0; 6 | let lineId; 7 | let lines; 8 | let totalLines; 9 | let anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = `line${lineNumber}`; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /docs/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /docs/scripts/resize.js: -------------------------------------------------------------------------------- 1 | /* global document */ 2 | // This file is @deprecated 3 | 4 | var NAVBAR_OPTIONS = {}; 5 | 6 | (function() { 7 | var NAVBAR_RESIZE_LOCAL_STORAGE_KEY = 'NAVBAR_RESIZE_LOCAL_STORAGE_KEY'; 8 | 9 | var navbar = document.querySelector('#navbar'); 10 | var footer = document.querySelector('#footer'); 11 | var mainSection = document.querySelector('#main'); 12 | // eslint-disable-next-line no-undef 13 | var localStorageResizeObject = JSON.parse( 14 | localStorage.getItem(NAVBAR_RESIZE_LOCAL_STORAGE_KEY) 15 | ); 16 | 17 | /** 18 | * Check whether we have any resize value in local storage or not. 19 | * If we have resize value then resize the navbar. 20 | **/ 21 | if (localStorageResizeObject) { 22 | navbar.style.width = localStorageResizeObject.width; 23 | mainSection.style.marginLeft = localStorageResizeObject.width; 24 | footer.style.marginLeft = localStorageResizeObject.width; 25 | } 26 | 27 | var navbarSlider = document.querySelector('#navbar-resize'); 28 | 29 | function resizeNavbar(event) { 30 | var pageX = event.pageX, 31 | pageXPlusPx = event.pageX + 'px', 32 | min = Number.parseInt(NAVBAR_OPTIONS.min, 10) || 300, 33 | max = Number.parseInt(NAVBAR_OPTIONS.max, 10) || 600; 34 | 35 | /** 36 | * Just to add some checks. If min is smaller then 10 then 37 | * user may accidentally end up reducing the size of navbar 38 | * less than 10. In that case user will not able to resize navbar 39 | * because navbar slider will be hidden. 40 | */ 41 | if (min < 10) { 42 | min = 10; 43 | } 44 | 45 | /** 46 | * Only resize if pageX in range between min and max 47 | * allowed value. 48 | */ 49 | if (min < pageX && pageX < max) { 50 | navbar.style.width = pageXPlusPx; 51 | mainSection.style.marginLeft = pageXPlusPx; 52 | footer.style.marginLeft = pageXPlusPx; 53 | } 54 | } 55 | 56 | function setupEventListeners() { 57 | // eslint-disable-next-line no-undef 58 | window.addEventListener('mousemove', resizeNavbar); 59 | // eslint-disable-next-line no-undef 60 | window.addEventListener('touchmove', resizeNavbar); 61 | } 62 | 63 | function afterRemovingEventListeners() { 64 | // eslint-disable-next-line no-undef 65 | localStorage.setItem( 66 | NAVBAR_RESIZE_LOCAL_STORAGE_KEY, 67 | JSON.stringify({ 68 | width: navbar.style.width 69 | }) 70 | ); 71 | } 72 | 73 | function removeEventListeners() { 74 | // eslint-disable-next-line no-undef 75 | window.removeEventListener('mousemove', resizeNavbar); 76 | // eslint-disable-next-line no-undef 77 | window.removeEventListener('touchend', resizeNavbar); 78 | afterRemovingEventListeners(); 79 | } 80 | 81 | navbarSlider.addEventListener('mousedown', setupEventListeners); 82 | navbarSlider.addEventListener('touchstart', setupEventListeners); 83 | // eslint-disable-next-line no-undef 84 | window.addEventListener('mouseup', removeEventListeners); 85 | })(); 86 | 87 | // eslint-disable-next-line no-unused-vars 88 | function setupResizeOptions(options) { 89 | NAVBAR_OPTIONS = options; 90 | } 91 | -------------------------------------------------------------------------------- /docs/scripts/search.js: -------------------------------------------------------------------------------- 1 | /* global document */ 2 | 3 | const searchId = 'LiBfqbJVcV'; 4 | const searchHash = '#' + searchId; 5 | const searchContainer = document.querySelector('#PkfLWpAbet'); 6 | const searchWrapper = document.querySelector('#iCxFxjkHbP'); 7 | const searchCloseButton = document.querySelector('#VjLlGakifb'); 8 | const searchInput = document.querySelector('#vpcKVYIppa'); 9 | const resultBox = document.querySelector('#fWwVHRuDuN'); 10 | 11 | function showResultText(text) { 12 | resultBox.innerHTML = `${text}`; 13 | } 14 | 15 | function hideSearch() { 16 | // eslint-disable-next-line no-undef 17 | if (window.location.hash === searchHash) { 18 | // eslint-disable-next-line no-undef 19 | history.go(-1); 20 | } 21 | 22 | // eslint-disable-next-line no-undef 23 | window.onhashchange = null; 24 | 25 | if (searchContainer) { 26 | searchContainer.style.display = 'none'; 27 | } 28 | } 29 | 30 | function listenCloseKey(event) { 31 | if (event.key === 'Escape') { 32 | hideSearch(); 33 | // eslint-disable-next-line no-undef 34 | window.removeEventListener('keyup', listenCloseKey); 35 | } 36 | } 37 | 38 | function showSearch() { 39 | try { 40 | // Closing mobile menu before opening 41 | // search box. 42 | // It is defined in core.js 43 | // eslint-disable-next-line no-undef 44 | hideMobileMenu(); 45 | } catch (error) { 46 | console.error(error); 47 | } 48 | 49 | // eslint-disable-next-line no-undef 50 | window.onhashchange = hideSearch; 51 | 52 | // eslint-disable-next-line no-undef 53 | if (window.location.hash !== searchHash) { 54 | // eslint-disable-next-line no-undef 55 | history.pushState(null, null, searchHash); 56 | } 57 | 58 | if (searchContainer) { 59 | searchContainer.style.display = 'flex'; 60 | // eslint-disable-next-line no-undef 61 | window.addEventListener('keyup', listenCloseKey); 62 | } 63 | 64 | if (searchInput) { 65 | searchInput.focus(); 66 | } 67 | } 68 | 69 | async function fetchAllData() { 70 | // eslint-disable-next-line no-undef 71 | const { hostname, protocol, port } = location; 72 | 73 | // eslint-disable-next-line no-undef 74 | const base = protocol + '//' + hostname + (port !== '' ? ':' + port : '') + baseURL; 75 | // eslint-disable-next-line no-undef 76 | const url = new URL('data/search.json', base); 77 | const result = await fetch(url); 78 | const { list } = await result.json(); 79 | 80 | return list; 81 | } 82 | 83 | // eslint-disable-next-line no-unused-vars 84 | function onClickSearchItem(event) { 85 | const target = event.currentTarget; 86 | 87 | if (target) { 88 | const href = target.getAttribute('href') || ''; 89 | let elementId = href.split('#')[1] || ''; 90 | let element = document.getElementById(elementId); 91 | 92 | if (!element) { 93 | elementId = decodeURI(elementId); 94 | element = document.getElementById(elementId); 95 | } 96 | 97 | if (element) { 98 | setTimeout(function() { 99 | // eslint-disable-next-line no-undef 100 | bringElementIntoView(element); // defined in core.js 101 | }, 100); 102 | } 103 | } 104 | } 105 | 106 | function buildSearchResult(result) { 107 | let output = ''; 108 | 109 | for (const res of result) { 110 | const { title, description } = res.item; 111 | 112 | const link = res.item.link.replace('.*/, ''); 113 | 114 | output += ` 115 | 116 |
${title}
117 |
${description || 'No description available.'}
118 |
119 | `; 120 | } 121 | 122 | return output; 123 | } 124 | 125 | function getSearchResult(list, keys, searchKey) { 126 | const defaultOptions = { 127 | shouldSort: true, 128 | threshold: 0.4, 129 | location: 0, 130 | distance: 100, 131 | maxPatternLength: 32, 132 | minMatchCharLength: 1, 133 | keys: keys 134 | }; 135 | 136 | const options = { ...defaultOptions }; 137 | 138 | // eslint-disable-next-line no-undef 139 | const searchIndex = Fuse.createIndex(options.keys, list); 140 | 141 | // eslint-disable-next-line no-undef 142 | const fuse = new Fuse(list, options, searchIndex); 143 | 144 | const result = fuse.search(searchKey); 145 | 146 | if (result.length > 20) { 147 | return result.slice(0, 20); 148 | } 149 | 150 | return result; 151 | } 152 | 153 | function debounce(func, wait, immediate) { 154 | let timeout; 155 | 156 | return function() { 157 | const args = arguments; 158 | 159 | clearTimeout(timeout); 160 | timeout = setTimeout(() => { 161 | timeout = null; 162 | if (!immediate) { 163 | // eslint-disable-next-line consistent-this, no-invalid-this 164 | func.apply(this, args); 165 | } 166 | }, wait); 167 | 168 | if (immediate && !timeout) { 169 | // eslint-disable-next-line consistent-this, no-invalid-this 170 | func.apply(this, args); 171 | } 172 | }; 173 | } 174 | 175 | let searchData; 176 | 177 | async function search(event) { 178 | const value = event.target.value; 179 | const keys = ['title', 'description']; 180 | 181 | if (!resultBox) { 182 | console.error('Search result container not found'); 183 | 184 | return; 185 | } 186 | 187 | if (!value) { 188 | showResultText('Type anything to view search result'); 189 | 190 | return; 191 | } 192 | 193 | if (!searchData) { 194 | showResultText('Loading...'); 195 | 196 | try { 197 | // eslint-disable-next-line require-atomic-updates 198 | searchData = await fetchAllData(); 199 | } catch (e) { 200 | console.log(e); 201 | showResultText('Failed to load result.'); 202 | 203 | return; 204 | } 205 | } 206 | 207 | const result = getSearchResult(searchData, keys, value); 208 | 209 | if (!result.length) { 210 | showResultText('No result found! Try some different combination.'); 211 | 212 | return; 213 | } 214 | 215 | // eslint-disable-next-line require-atomic-updates 216 | resultBox.innerHTML = buildSearchResult(result); 217 | } 218 | 219 | function onDomContentLoaded() { 220 | const searchButton = document.querySelectorAll('.search-button'); 221 | const debouncedSearch = debounce(search, 300); 222 | 223 | if (searchCloseButton) { 224 | searchCloseButton.addEventListener('click', hideSearch); 225 | } 226 | 227 | if (searchButton) { 228 | searchButton.forEach(function(item) { 229 | item.addEventListener('click', showSearch); 230 | }); 231 | } 232 | 233 | if (searchContainer) { 234 | searchContainer.addEventListener('click', hideSearch); 235 | } 236 | 237 | if (searchWrapper) { 238 | searchWrapper.addEventListener('click', function(event) { 239 | event.stopPropagation(); 240 | }); 241 | } 242 | 243 | if (searchInput) { 244 | searchInput.addEventListener('keyup', debouncedSearch); 245 | } 246 | 247 | // eslint-disable-next-line no-undef 248 | if (window.location.hash === searchHash) { 249 | showSearch(); 250 | } 251 | } 252 | 253 | // eslint-disable-next-line no-undef 254 | window.addEventListener('DOMContentLoaded', onDomContentLoaded); 255 | 256 | // eslint-disable-next-line no-undef 257 | window.addEventListener('hashchange', function() { 258 | // eslint-disable-next-line no-undef 259 | if (window.location.hash === searchHash) { 260 | showSearch(); 261 | } 262 | }); 263 | -------------------------------------------------------------------------------- /docs/scripts/search.min.js: -------------------------------------------------------------------------------- 1 | const searchId="LiBfqbJVcV",searchHash="#"+searchId,searchContainer=document.querySelector("#PkfLWpAbet"),searchWrapper=document.querySelector("#iCxFxjkHbP"),searchCloseButton=document.querySelector("#VjLlGakifb"),searchInput=document.querySelector("#vpcKVYIppa"),resultBox=document.querySelector("#fWwVHRuDuN");function showResultText(e){resultBox.innerHTML=`${e}`}function hideSearch(){window.location.hash===searchHash&&history.go(-1),window.onhashchange=null,searchContainer&&(searchContainer.style.display="none")}function listenCloseKey(e){"Escape"===e.key&&(hideSearch(),window.removeEventListener("keyup",listenCloseKey))}function showSearch(){try{hideMobileMenu()}catch(e){console.error(e)}window.onhashchange=hideSearch,window.location.hash!==searchHash&&history.pushState(null,null,searchHash),searchContainer&&(searchContainer.style.display="flex",window.addEventListener("keyup",listenCloseKey)),searchInput&&searchInput.focus()}async function fetchAllData(){var{hostname:e,protocol:t,port:n}=location,t=t+"//"+e+(""!==n?":"+n:"")+baseURL,e=new URL("data/search.json",t);const a=await fetch(e);n=(await a.json()).list;return n}function onClickSearchItem(t){const n=t.currentTarget;if(n){const a=n.getAttribute("href")||"";t=a.split("#")[1]||"";let e=document.getElementById(t);e||(t=decodeURI(t),e=document.getElementById(t)),e&&setTimeout(function(){bringElementIntoView(e)},100)}}function buildSearchResult(e){let t="";for(const s of e){var{title:n,description:a}=s.item,o=s.item.link.replace('.*/,"");t+=` 2 | 3 |
${n}
4 |
${a||"No description available."}
5 |
6 | `}return t}function getSearchResult(e,t,n){var t={...{shouldSort:!0,threshold:.4,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:t}},a=Fuse.createIndex(t.keys,e);const o=new Fuse(e,t,a),s=o.search(n);return 20{o=null,a||t.apply(this,e)},n),a&&!o&&t.apply(this,e)}}let searchData;async function search(e){e=e.target.value;if(resultBox)if(e){if(!searchData){showResultText("Loading...");try{searchData=await fetchAllData()}catch(e){return console.log(e),void showResultText("Failed to load result.")}}e=getSearchResult(searchData,["title","description"],e);e.length?resultBox.innerHTML=buildSearchResult(e):showResultText("No result found! Try some different combination.")}else showResultText("Type anything to view search result");else console.error("Search result container not found")}function onDomContentLoaded(){const e=document.querySelectorAll(".search-button");var t=debounce(search,300);searchCloseButton&&searchCloseButton.addEventListener("click",hideSearch),e&&e.forEach(function(e){e.addEventListener("click",showSearch)}),searchContainer&&searchContainer.addEventListener("click",hideSearch),searchWrapper&&searchWrapper.addEventListener("click",function(e){e.stopPropagation()}),searchInput&&searchInput.addEventListener("keyup",t),window.location.hash===searchHash&&showSearch()}window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",function(){window.location.hash===searchHash&&showSearch()}); -------------------------------------------------------------------------------- /docs/scripts/third-party/hljs-line-num.js: -------------------------------------------------------------------------------- 1 | !function(r,o){"use strict";var e,l="hljs-ln",s="hljs-ln-line",f="hljs-ln-code",c="hljs-ln-numbers",u="hljs-ln-n",h="data-line-number",n=/\r\n|\r|\n/g;function t(e){for(var n=e.toString(),t=e.anchorNode;"TD"!==t.nodeName;)t=t.parentNode;for(var r=e.focusNode;"TD"!==r.nodeName;)r=r.parentNode;var e=parseInt(t.dataset.lineNumber),o=parseInt(r.dataset.lineNumber);if(e==o)return n;var a,i=t.textContent,l=r.textContent;for(o{6}',[s,c,u,h,f,a+t.startFrom,0{1}',[l,o])}return e}function m(e){var n=e.className;if(/hljs-/.test(n)){for(var t=g(e.innerHTML),r=0,o="";r{1}\n',[n,0 th:last-child { border-right: 1px solid #ddd; } 224 | 225 | .ancestors, .attribs { color: #999; } 226 | .ancestors a, .attribs a 227 | { 228 | color: #999 !important; 229 | text-decoration: none; 230 | } 231 | 232 | .clear 233 | { 234 | clear: both; 235 | } 236 | 237 | .important 238 | { 239 | font-weight: bold; 240 | color: #950B02; 241 | } 242 | 243 | .yes-def { 244 | text-indent: -1000px; 245 | } 246 | 247 | .type-signature { 248 | color: #aaa; 249 | } 250 | 251 | .name, .signature { 252 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 253 | } 254 | 255 | .details { margin-top: 14px; border-left: 2px solid #DDD; } 256 | .details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } 257 | .details dd { margin-left: 70px; } 258 | .details ul { margin: 0; } 259 | .details ul { list-style-type: none; } 260 | .details li { margin-left: 30px; padding-top: 6px; } 261 | .details pre.prettyprint { margin: 0 } 262 | .details .object-value { padding-top: 0; } 263 | 264 | .description { 265 | margin-bottom: 1em; 266 | margin-top: 1em; 267 | } 268 | 269 | .code-caption 270 | { 271 | font-style: italic; 272 | font-size: 107%; 273 | margin: 0; 274 | } 275 | 276 | .source 277 | { 278 | border: 1px solid #ddd; 279 | width: 80%; 280 | overflow: auto; 281 | } 282 | 283 | .prettyprint.source { 284 | width: inherit; 285 | } 286 | 287 | .source code 288 | { 289 | font-size: 100%; 290 | line-height: 18px; 291 | display: block; 292 | padding: 4px 12px; 293 | margin: 0; 294 | background-color: #fff; 295 | color: #4D4E53; 296 | } 297 | 298 | .prettyprint code span.line 299 | { 300 | display: inline-block; 301 | } 302 | 303 | .prettyprint.linenums 304 | { 305 | padding-left: 70px; 306 | -webkit-user-select: none; 307 | -moz-user-select: none; 308 | -ms-user-select: none; 309 | user-select: none; 310 | } 311 | 312 | .prettyprint.linenums ol 313 | { 314 | padding-left: 0; 315 | } 316 | 317 | .prettyprint.linenums li 318 | { 319 | border-left: 3px #ddd solid; 320 | } 321 | 322 | .prettyprint.linenums li.selected, 323 | .prettyprint.linenums li.selected * 324 | { 325 | background-color: lightyellow; 326 | } 327 | 328 | .prettyprint.linenums li * 329 | { 330 | -webkit-user-select: text; 331 | -moz-user-select: text; 332 | -ms-user-select: text; 333 | user-select: text; 334 | } 335 | 336 | .params .name, .props .name, .name code { 337 | color: #4D4E53; 338 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 339 | font-size: 100%; 340 | } 341 | 342 | .params td.description > p:first-child, 343 | .props td.description > p:first-child 344 | { 345 | margin-top: 0; 346 | padding-top: 0; 347 | } 348 | 349 | .params td.description > p:last-child, 350 | .props td.description > p:last-child 351 | { 352 | margin-bottom: 0; 353 | padding-bottom: 0; 354 | } 355 | 356 | .disabled { 357 | color: #454545; 358 | } 359 | -------------------------------------------------------------------------------- /docs/styles/prettify-jsdoc.css: -------------------------------------------------------------------------------- 1 | /* JSDoc prettify.js theme */ 2 | 3 | /* plain text */ 4 | .pln { 5 | color: #000000; 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | /* string content */ 11 | .str { 12 | color: #006400; 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #000000; 20 | font-weight: bold; 21 | font-style: normal; 22 | } 23 | 24 | /* a comment */ 25 | .com { 26 | font-weight: normal; 27 | font-style: italic; 28 | } 29 | 30 | /* a type name */ 31 | .typ { 32 | color: #000000; 33 | font-weight: normal; 34 | font-style: normal; 35 | } 36 | 37 | /* a literal value */ 38 | .lit { 39 | color: #006400; 40 | font-weight: normal; 41 | font-style: normal; 42 | } 43 | 44 | /* punctuation */ 45 | .pun { 46 | color: #000000; 47 | font-weight: bold; 48 | font-style: normal; 49 | } 50 | 51 | /* lisp open bracket */ 52 | .opn { 53 | color: #000000; 54 | font-weight: bold; 55 | font-style: normal; 56 | } 57 | 58 | /* lisp close bracket */ 59 | .clo { 60 | color: #000000; 61 | font-weight: bold; 62 | font-style: normal; 63 | } 64 | 65 | /* a markup tag name */ 66 | .tag { 67 | color: #006400; 68 | font-weight: normal; 69 | font-style: normal; 70 | } 71 | 72 | /* a markup attribute name */ 73 | .atn { 74 | color: #006400; 75 | font-weight: normal; 76 | font-style: normal; 77 | } 78 | 79 | /* a markup attribute value */ 80 | .atv { 81 | color: #006400; 82 | font-weight: normal; 83 | font-style: normal; 84 | } 85 | 86 | /* a declaration */ 87 | .dec { 88 | color: #000000; 89 | font-weight: bold; 90 | font-style: normal; 91 | } 92 | 93 | /* a variable name */ 94 | .var { 95 | color: #000000; 96 | font-weight: normal; 97 | font-style: normal; 98 | } 99 | 100 | /* a function name */ 101 | .fun { 102 | color: #000000; 103 | font-weight: bold; 104 | font-style: normal; 105 | } 106 | 107 | /* Specify class=linenums on a pre to get line numbering */ 108 | ol.linenums { 109 | margin-top: 0; 110 | margin-bottom: 0; 111 | } 112 | -------------------------------------------------------------------------------- /docs/styles/prettify-tomorrow.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* Pretty printing styles. Used with prettify.js. */ 4 | /* SPAN elements with the classes below are added by prettyprint. */ 5 | /* plain text */ 6 | .pln { 7 | color: #4d4d4c; } 8 | 9 | @media screen { 10 | /* string content */ 11 | .str { 12 | color: #718c00; } 13 | 14 | /* a keyword */ 15 | .kwd { 16 | color: #8959a8; } 17 | 18 | /* a comment */ 19 | .com { 20 | color: #8e908c; } 21 | 22 | /* a type name */ 23 | .typ { 24 | color: #4271ae; } 25 | 26 | /* a literal value */ 27 | .lit { 28 | color: #f5871f; } 29 | 30 | /* punctuation */ 31 | .pun { 32 | color: #4d4d4c; } 33 | 34 | /* lisp open bracket */ 35 | .opn { 36 | color: #4d4d4c; } 37 | 38 | /* lisp close bracket */ 39 | .clo { 40 | color: #4d4d4c; } 41 | 42 | /* a markup tag name */ 43 | .tag { 44 | color: #c82829; } 45 | 46 | /* a markup attribute name */ 47 | .atn { 48 | color: #f5871f; } 49 | 50 | /* a markup attribute value */ 51 | .atv { 52 | color: #3e999f; } 53 | 54 | /* a declaration */ 55 | .dec { 56 | color: #f5871f; } 57 | 58 | /* a variable name */ 59 | .var { 60 | color: #c82829; } 61 | 62 | /* a function name */ 63 | .fun { 64 | color: #4271ae; } } 65 | /* Use higher contrast and text-weight for printable form. */ 66 | @media print, projection { 67 | .str { 68 | color: #060; } 69 | 70 | .kwd { 71 | color: #006; 72 | font-weight: bold; } 73 | 74 | .com { 75 | color: #600; 76 | font-style: italic; } 77 | 78 | .typ { 79 | color: #404; 80 | font-weight: bold; } 81 | 82 | .lit { 83 | color: #044; } 84 | 85 | .pun, .opn, .clo { 86 | color: #440; } 87 | 88 | .tag { 89 | color: #006; 90 | font-weight: bold; } 91 | 92 | .atn { 93 | color: #404; } 94 | 95 | .atv { 96 | color: #060; } } 97 | /* Style */ 98 | /* 99 | pre.prettyprint { 100 | background: white; 101 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 102 | font-size: 12px; 103 | line-height: 1.5; 104 | border: 1px solid #ccc; 105 | padding: 10px; } 106 | */ 107 | 108 | /* Specify class=linenums on a pre to get line numbering */ 109 | ol.linenums { 110 | margin-top: 0; 111 | margin-bottom: 0; } 112 | 113 | /* IE indents via margin-left */ 114 | li.L0, 115 | li.L1, 116 | li.L2, 117 | li.L3, 118 | li.L4, 119 | li.L5, 120 | li.L6, 121 | li.L7, 122 | li.L8, 123 | li.L9 { 124 | /* */ } 125 | 126 | /* Alternate shading for lines */ 127 | li.L1, 128 | li.L3, 129 | li.L5, 130 | li.L7, 131 | li.L9 { 132 | /* */ } 133 | -------------------------------------------------------------------------------- /jsdoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "source": { 3 | "include": ["dist/ineryjs-jsonrpc.js","dist/ineryjs-api.js","dist/ineryjs-rpc-interfaces.doc.js","dist/ineryjs-jssig.js","dist/inery-api-interfaces.doc.js"], 4 | "includePattern": ".js$", 5 | "excludePattern": "(node_modules/|docs)" 6 | }, 7 | "plugins": ["plugins/markdown","plugins/summarize"], 8 | "templates": { 9 | "cleverLinks": true, 10 | "monospaceLinks": true 11 | }, 12 | "opts": { 13 | "recurse": true, 14 | "destination": "./docs/", 15 | "readme": "./README-doc.md", 16 | "template": "./node_modules/clean-jsdoc-theme", 17 | "theme_opts": { 18 | "default_theme": "dark" 19 | }, 20 | "tutorials":"./tutorials" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ineryjs", 3 | "version": "1.0.0", 4 | "description": "Inery API", 5 | "main": "dist/index.js", 6 | "scripts": { 7 | "doc": "jsdoc -c jsdoc.json", 8 | "generate-docs": "jsdoc --configure jsdoc.json --verbose", 9 | "build-web": "webpack --config webpack.config.js" 10 | }, 11 | "author": "Inery", 12 | "license": "MIT", 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/inery-blockchain/ineryjs" 16 | }, 17 | "homepage": "https://github.com/inery-blockchain/ineryjs", 18 | "dependencies": { 19 | "bn.js": "^5.2.0", 20 | "elliptic": "^6.5.4", 21 | "hash.js": "^1.1.7", 22 | "node-fetch": "^2.6.7", 23 | "pako": "^2.0.3" 24 | }, 25 | "devDependencies": { 26 | "browser-fs-access": "^0.31.0", 27 | "browserify": "^17.0.0", 28 | "buffer": "^6.0.3", 29 | "clean-jsdoc-theme": "^4.1.7", 30 | "crypto-browserify": "^3.12.0", 31 | "https-browserify": "^1.0.0", 32 | "jsdoc": "^3.5.5", 33 | "node-util": "^0.0.1", 34 | "stream-http": "^3.2.0", 35 | "url": "^0.11.0", 36 | "webpack": "^5.74.0", 37 | "webpack-cli": "^4.10.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /template/README.md: -------------------------------------------------------------------------------- 1 | The default template for JSDoc 3 uses: [the Taffy Database library](http://taffydb.com/) and the [Underscore Template library](http://underscorejs.org/). 2 | 3 | 4 | ## Generating Typeface Fonts 5 | 6 | The default template uses the [OpenSans](https://www.google.com/fonts/specimen/Open+Sans) typeface. The font files can be regenerated as follows: 7 | 8 | 1. Open the [OpenSans page at Font Squirrel](). 9 | 2. Click on the 'Webfont Kit' tab. 10 | 3. Either leave the subset drop-down as 'Western Latin (Default)', or, if we decide we need more glyphs, than change it to 'No Subsetting'. 11 | 4. Click the 'DOWNLOAD @FONT-FACE KIT' button. 12 | 5. For each typeface variant we plan to use, copy the 'eot', 'svg' and 'woff' files into the 'templates/default/static/fonts' directory. 13 | -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /template/static/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inery-blockchain/ineryjs/c9ec3430b6a011adcf9bcf7aa4dcd6e87d0644ae/template/static/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /template/static/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (() => { 3 | const source = document.getElementsByClassName('prettyprint source linenums'); 4 | let i = 0; 5 | let lineNumber = 0; 6 | let lineId; 7 | let lines; 8 | let totalLines; 9 | let anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = `line${lineNumber}`; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /template/static/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /template/static/styles/jsdoc-default.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Open Sans'; 3 | font-weight: normal; 4 | font-style: normal; 5 | src: url('../fonts/OpenSans-Regular-webfont.eot'); 6 | src: 7 | local('Open Sans'), 8 | local('OpenSans'), 9 | url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), 10 | url('../fonts/OpenSans-Regular-webfont.woff') format('woff'), 11 | url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg'); 12 | } 13 | 14 | @font-face { 15 | font-family: 'Open Sans Light'; 16 | font-weight: normal; 17 | font-style: normal; 18 | src: url('../fonts/OpenSans-Light-webfont.eot'); 19 | src: 20 | local('Open Sans Light'), 21 | local('OpenSans Light'), 22 | url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'), 23 | url('../fonts/OpenSans-Light-webfont.woff') format('woff'), 24 | url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg'); 25 | } 26 | 27 | html 28 | { 29 | overflow: auto; 30 | background-color: #fff; 31 | font-size: 14px; 32 | } 33 | 34 | body 35 | { 36 | font-family: 'Open Sans', sans-serif; 37 | line-height: 1.5; 38 | color: #4d4e53; 39 | background-color: white; 40 | } 41 | 42 | a, a:visited, a:active { 43 | color: #0095dd; 44 | text-decoration: none; 45 | } 46 | 47 | a:hover { 48 | text-decoration: underline; 49 | } 50 | 51 | header 52 | { 53 | display: block; 54 | padding: 0px 4px; 55 | } 56 | 57 | tt, code, kbd, samp { 58 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 59 | } 60 | 61 | .class-description { 62 | font-size: 130%; 63 | line-height: 140%; 64 | margin-bottom: 1em; 65 | margin-top: 1em; 66 | } 67 | 68 | .class-description:empty { 69 | margin: 0; 70 | } 71 | 72 | #main { 73 | float: left; 74 | width: 70%; 75 | } 76 | 77 | article dl { 78 | margin-bottom: 40px; 79 | } 80 | 81 | article img { 82 | max-width: 100%; 83 | } 84 | 85 | section 86 | { 87 | display: block; 88 | background-color: #fff; 89 | padding: 12px 24px; 90 | border-bottom: 1px solid #ccc; 91 | margin-right: 30px; 92 | } 93 | 94 | .variation { 95 | display: none; 96 | } 97 | 98 | .signature-attributes { 99 | font-size: 60%; 100 | color: #aaa; 101 | font-style: italic; 102 | font-weight: lighter; 103 | } 104 | 105 | nav 106 | { 107 | display: block; 108 | float: right; 109 | margin-top: 28px; 110 | width: 30%; 111 | box-sizing: border-box; 112 | border-left: 1px solid #ccc; 113 | padding-left: 16px; 114 | } 115 | 116 | nav ul { 117 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; 118 | font-size: 100%; 119 | line-height: 17px; 120 | padding: 0; 121 | margin: 0; 122 | list-style-type: none; 123 | } 124 | 125 | nav ul a, nav ul a:visited, nav ul a:active { 126 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 127 | line-height: 18px; 128 | color: #4D4E53; 129 | } 130 | 131 | nav h3 { 132 | margin-top: 12px; 133 | } 134 | 135 | nav li { 136 | margin-top: 6px; 137 | } 138 | 139 | footer { 140 | display: block; 141 | padding: 6px; 142 | margin-top: 12px; 143 | font-style: italic; 144 | font-size: 90%; 145 | } 146 | 147 | h1, h2, h3, h4 { 148 | font-weight: 200; 149 | margin: 0; 150 | } 151 | 152 | h1 153 | { 154 | font-family: 'Open Sans Light', sans-serif; 155 | font-size: 48px; 156 | letter-spacing: -2px; 157 | margin: 12px 24px 20px; 158 | } 159 | 160 | h2, h3.subsection-title 161 | { 162 | font-size: 30px; 163 | font-weight: 700; 164 | letter-spacing: -1px; 165 | margin-bottom: 12px; 166 | } 167 | 168 | h3 169 | { 170 | font-size: 24px; 171 | letter-spacing: -0.5px; 172 | margin-bottom: 12px; 173 | } 174 | 175 | h4 176 | { 177 | font-size: 18px; 178 | letter-spacing: -0.33px; 179 | margin-bottom: 12px; 180 | color: #4d4e53; 181 | } 182 | 183 | h5, .container-overview .subsection-title 184 | { 185 | font-size: 120%; 186 | font-weight: bold; 187 | letter-spacing: -0.01em; 188 | margin: 8px 0 3px 0; 189 | } 190 | 191 | h6 192 | { 193 | font-size: 100%; 194 | letter-spacing: -0.01em; 195 | margin: 6px 0 3px 0; 196 | font-style: italic; 197 | } 198 | 199 | table 200 | { 201 | border-spacing: 0; 202 | border: 0; 203 | border-collapse: collapse; 204 | } 205 | 206 | td, th 207 | { 208 | border: 1px solid #ddd; 209 | margin: 0px; 210 | text-align: left; 211 | vertical-align: top; 212 | padding: 4px 6px; 213 | display: table-cell; 214 | } 215 | 216 | thead tr 217 | { 218 | background-color: #ddd; 219 | font-weight: bold; 220 | } 221 | 222 | th { border-right: 1px solid #aaa; } 223 | tr > th:last-child { border-right: 1px solid #ddd; } 224 | 225 | .ancestors, .attribs { color: #999; } 226 | .ancestors a, .attribs a 227 | { 228 | color: #999 !important; 229 | text-decoration: none; 230 | } 231 | 232 | .clear 233 | { 234 | clear: both; 235 | } 236 | 237 | .important 238 | { 239 | font-weight: bold; 240 | color: #950B02; 241 | } 242 | 243 | .yes-def { 244 | text-indent: -1000px; 245 | } 246 | 247 | .type-signature { 248 | color: #aaa; 249 | } 250 | 251 | .name, .signature { 252 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 253 | } 254 | 255 | .details { margin-top: 14px; border-left: 2px solid #DDD; } 256 | .details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } 257 | .details dd { margin-left: 70px; } 258 | .details ul { margin: 0; } 259 | .details ul { list-style-type: none; } 260 | .details li { margin-left: 30px; padding-top: 6px; } 261 | .details pre.prettyprint { margin: 0 } 262 | .details .object-value { padding-top: 0; } 263 | 264 | .description { 265 | margin-bottom: 1em; 266 | margin-top: 1em; 267 | } 268 | 269 | .code-caption 270 | { 271 | font-style: italic; 272 | font-size: 107%; 273 | margin: 0; 274 | } 275 | 276 | .source 277 | { 278 | border: 1px solid #ddd; 279 | width: 80%; 280 | overflow: auto; 281 | } 282 | 283 | .prettyprint.source { 284 | width: inherit; 285 | } 286 | 287 | .source code 288 | { 289 | font-size: 100%; 290 | line-height: 18px; 291 | display: block; 292 | padding: 4px 12px; 293 | margin: 0; 294 | background-color: #fff; 295 | color: #4D4E53; 296 | } 297 | 298 | .prettyprint code span.line 299 | { 300 | display: inline-block; 301 | } 302 | 303 | .prettyprint.linenums 304 | { 305 | padding-left: 70px; 306 | -webkit-user-select: none; 307 | -moz-user-select: none; 308 | -ms-user-select: none; 309 | user-select: none; 310 | } 311 | 312 | .prettyprint.linenums ol 313 | { 314 | padding-left: 0; 315 | } 316 | 317 | .prettyprint.linenums li 318 | { 319 | border-left: 3px #ddd solid; 320 | } 321 | 322 | .prettyprint.linenums li.selected, 323 | .prettyprint.linenums li.selected * 324 | { 325 | background-color: lightyellow; 326 | } 327 | 328 | .prettyprint.linenums li * 329 | { 330 | -webkit-user-select: text; 331 | -moz-user-select: text; 332 | -ms-user-select: text; 333 | user-select: text; 334 | } 335 | 336 | .params .name, .props .name, .name code { 337 | color: #4D4E53; 338 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 339 | font-size: 100%; 340 | } 341 | 342 | .params td.description > p:first-child, 343 | .props td.description > p:first-child 344 | { 345 | margin-top: 0; 346 | padding-top: 0; 347 | } 348 | 349 | .params td.description > p:last-child, 350 | .props td.description > p:last-child 351 | { 352 | margin-bottom: 0; 353 | padding-bottom: 0; 354 | } 355 | 356 | .disabled { 357 | color: #454545; 358 | } 359 | -------------------------------------------------------------------------------- /template/static/styles/prettify-jsdoc.css: -------------------------------------------------------------------------------- 1 | /* JSDoc prettify.js theme */ 2 | 3 | /* plain text */ 4 | .pln { 5 | color: #000000; 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | /* string content */ 11 | .str { 12 | color: #006400; 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #000000; 20 | font-weight: bold; 21 | font-style: normal; 22 | } 23 | 24 | /* a comment */ 25 | .com { 26 | font-weight: normal; 27 | font-style: italic; 28 | } 29 | 30 | /* a type name */ 31 | .typ { 32 | color: #000000; 33 | font-weight: normal; 34 | font-style: normal; 35 | } 36 | 37 | /* a literal value */ 38 | .lit { 39 | color: #006400; 40 | font-weight: normal; 41 | font-style: normal; 42 | } 43 | 44 | /* punctuation */ 45 | .pun { 46 | color: #000000; 47 | font-weight: bold; 48 | font-style: normal; 49 | } 50 | 51 | /* lisp open bracket */ 52 | .opn { 53 | color: #000000; 54 | font-weight: bold; 55 | font-style: normal; 56 | } 57 | 58 | /* lisp close bracket */ 59 | .clo { 60 | color: #000000; 61 | font-weight: bold; 62 | font-style: normal; 63 | } 64 | 65 | /* a markup tag name */ 66 | .tag { 67 | color: #006400; 68 | font-weight: normal; 69 | font-style: normal; 70 | } 71 | 72 | /* a markup attribute name */ 73 | .atn { 74 | color: #006400; 75 | font-weight: normal; 76 | font-style: normal; 77 | } 78 | 79 | /* a markup attribute value */ 80 | .atv { 81 | color: #006400; 82 | font-weight: normal; 83 | font-style: normal; 84 | } 85 | 86 | /* a declaration */ 87 | .dec { 88 | color: #000000; 89 | font-weight: bold; 90 | font-style: normal; 91 | } 92 | 93 | /* a variable name */ 94 | .var { 95 | color: #000000; 96 | font-weight: normal; 97 | font-style: normal; 98 | } 99 | 100 | /* a function name */ 101 | .fun { 102 | color: #000000; 103 | font-weight: bold; 104 | font-style: normal; 105 | } 106 | 107 | /* Specify class=linenums on a pre to get line numbering */ 108 | ol.linenums { 109 | margin-top: 0; 110 | margin-bottom: 0; 111 | } 112 | -------------------------------------------------------------------------------- /template/static/styles/prettify-tomorrow.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* Pretty printing styles. Used with prettify.js. */ 4 | /* SPAN elements with the classes below are added by prettyprint. */ 5 | /* plain text */ 6 | .pln { 7 | color: #4d4d4c; } 8 | 9 | @media screen { 10 | /* string content */ 11 | .str { 12 | color: #718c00; } 13 | 14 | /* a keyword */ 15 | .kwd { 16 | color: #8959a8; } 17 | 18 | /* a comment */ 19 | .com { 20 | color: #8e908c; } 21 | 22 | /* a type name */ 23 | .typ { 24 | color: #4271ae; } 25 | 26 | /* a literal value */ 27 | .lit { 28 | color: #f5871f; } 29 | 30 | /* punctuation */ 31 | .pun { 32 | color: #4d4d4c; } 33 | 34 | /* lisp open bracket */ 35 | .opn { 36 | color: #4d4d4c; } 37 | 38 | /* lisp close bracket */ 39 | .clo { 40 | color: #4d4d4c; } 41 | 42 | /* a markup tag name */ 43 | .tag { 44 | color: #c82829; } 45 | 46 | /* a markup attribute name */ 47 | .atn { 48 | color: #f5871f; } 49 | 50 | /* a markup attribute value */ 51 | .atv { 52 | color: #3e999f; } 53 | 54 | /* a declaration */ 55 | .dec { 56 | color: #f5871f; } 57 | 58 | /* a variable name */ 59 | .var { 60 | color: #c82829; } 61 | 62 | /* a function name */ 63 | .fun { 64 | color: #4271ae; } } 65 | /* Use higher contrast and text-weight for printable form. */ 66 | @media print, projection { 67 | .str { 68 | color: #060; } 69 | 70 | .kwd { 71 | color: #006; 72 | font-weight: bold; } 73 | 74 | .com { 75 | color: #600; 76 | font-style: italic; } 77 | 78 | .typ { 79 | color: #404; 80 | font-weight: bold; } 81 | 82 | .lit { 83 | color: #044; } 84 | 85 | .pun, .opn, .clo { 86 | color: #440; } 87 | 88 | .tag { 89 | color: #006; 90 | font-weight: bold; } 91 | 92 | .atn { 93 | color: #404; } 94 | 95 | .atv { 96 | color: #060; } } 97 | /* Style */ 98 | /* 99 | pre.prettyprint { 100 | background: white; 101 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 102 | font-size: 12px; 103 | line-height: 1.5; 104 | border: 1px solid #ccc; 105 | padding: 10px; } 106 | */ 107 | 108 | /* Specify class=linenums on a pre to get line numbering */ 109 | ol.linenums { 110 | margin-top: 0; 111 | margin-bottom: 0; } 112 | 113 | /* IE indents via margin-left */ 114 | li.L0, 115 | li.L1, 116 | li.L2, 117 | li.L3, 118 | li.L4, 119 | li.L5, 120 | li.L6, 121 | li.L7, 122 | li.L8, 123 | li.L9 { 124 | /* */ } 125 | 126 | /* Alternate shading for lines */ 127 | li.L1, 128 | li.L3, 129 | li.L5, 130 | li.L7, 131 | li.L9 { 132 | /* */ } 133 | -------------------------------------------------------------------------------- /template/tmpl/augments.tmpl: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 |
    8 |
  • 9 |
10 | 11 | -------------------------------------------------------------------------------- /template/tmpl/container.tmpl: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 |
23 | 24 |

26 | 30 |

32 | 33 |
34 | 35 | 36 | 37 | 38 |
39 | 40 | 41 | 42 |
43 | 44 |
45 |
46 | 47 | 48 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 |
59 | 60 | 61 | 62 | 63 | 64 |

Example 1? 's':'' ?>

65 | 66 | 67 | 68 |
69 | 70 | 71 |

Extends

72 | 73 | 74 | 75 | 76 | 77 |

Requires

78 | 79 |
    80 |
  • 81 |
82 | 83 | 84 | 88 |

Classes

89 | 90 |
91 |
92 |
93 |
94 | 95 | 96 | 100 |

Interfaces

101 | 102 |
103 |
104 |
105 |
106 | 107 | 108 | 112 |

Mixins

113 | 114 |
115 |
116 |
117 |
118 | 119 | 120 | 124 |

Namespaces

125 | 126 |
127 |
128 |
129 |
130 | 131 | 132 | 143 |

Members

144 | 145 | 146 | 147 | 148 | 149 | 150 | 154 |

Methods

155 | 156 | 157 | 158 | 159 | 160 | 161 | 165 |

Type Definitions

166 | 167 | 170 | 171 | 175 | 176 | 179 | 180 | 181 | 185 |

Events

186 | 187 | 188 | 189 | 190 | 191 |
192 | 193 |
194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /template/tmpl/details.tmpl: -------------------------------------------------------------------------------- 1 | " + data.defaultvalue + ""; 9 | defaultObjectClass = ' class="object-value"'; 10 | } 11 | ?> 12 | 16 | 17 |
Properties:
18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 |
Version:
27 |
28 | 29 | 30 | 31 |
Since:
32 |
33 | 34 | 35 | 36 |
Inherited From:
37 |
  • 38 | 39 |
40 | 41 | 42 | 43 |
Overrides:
44 |
  • 45 | 46 |
47 | 48 | 49 | 50 |
Implementations:
51 |
    52 | 53 |
  • 54 | 55 |
56 | 57 | 58 | 59 |
Implements:
60 |
    61 | 62 |
  • 63 | 64 |
65 | 66 | 67 | 68 |
Mixes In:
69 | 70 |
    71 | 72 |
  • 73 | 74 |
75 | 76 | 77 | 78 |
Deprecated:
  • Yes
82 | 83 | 84 | 85 |
Author:
86 |
87 |
    88 |
  • 89 |
90 |
91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 |
License:
100 |
101 | 102 | 103 | 104 |
Default Value:
105 |
    106 | > 107 |
108 | 109 | 110 | 111 |
Source:
112 |
  • 113 | , 114 |
115 | 116 | 117 | 118 |
Tutorials:
119 |
120 |
    121 |
  • 122 |
123 |
124 | 125 | 126 | 127 |
See:
128 |
129 |
    130 |
  • 131 |
132 |
133 | 134 | 135 | 136 |
To Do:
137 |
138 |
    139 |
  • 140 |
141 |
142 | 143 |
144 | -------------------------------------------------------------------------------- /template/tmpl/example.tmpl: -------------------------------------------------------------------------------- 1 | 2 |
3 | -------------------------------------------------------------------------------- /template/tmpl/examples.tmpl: -------------------------------------------------------------------------------- 1 | 8 |

9 | 10 |
11 | -------------------------------------------------------------------------------- /template/tmpl/exceptions.tmpl: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 |
7 |
8 | 9 |
10 |
11 |
12 |
13 |
14 |
15 | Type 16 |
17 |
18 | 19 |
20 |
21 |
22 |
23 |
24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
32 | 33 | -------------------------------------------------------------------------------- /template/tmpl/layout.tmpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: <?js= title ?> 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

21 | 22 | 23 |
24 | 25 | 28 | 29 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /template/tmpl/mainpage.tmpl: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 |

8 | 9 | 10 | 11 |
12 |
13 |
14 | 15 | -------------------------------------------------------------------------------- /template/tmpl/members.tmpl: -------------------------------------------------------------------------------- 1 | 5 |

6 | 7 | 8 |

9 | 10 | 11 | 12 |
13 | 14 |
15 | 16 | 17 | 18 |
Type:
19 |
    20 |
  • 21 | 22 |
  • 23 |
24 | 25 | 26 | 27 | 28 | 29 |
Fires:
30 |
    31 |
  • 32 |
33 | 34 | 35 | 36 |
Example 1? 's':'' ?>
37 | 38 | 39 | -------------------------------------------------------------------------------- /template/tmpl/method.tmpl: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 |

Constructor

8 | 9 | 10 | 11 |

13 | 14 | 15 | 16 |

17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 26 | 27 |
Extends:
28 | 29 | 30 | 31 | 32 |
Type:
33 |
    34 |
  • 35 | 36 |
  • 37 |
38 | 39 | 40 | 41 |
This:
42 |
43 | 44 | 45 | 46 |
Parameters:
47 | 48 | 49 | 50 | 51 | 52 | 53 |
Requires:
54 |
    55 |
  • 56 |
57 | 58 | 59 | 60 |
Fires:
61 |
    62 |
  • 63 |
64 | 65 | 66 | 67 |
Listens to Events:
68 |
    69 |
  • 70 |
71 | 72 | 73 | 74 |
Listeners of This Event:
75 |
    76 |
  • 77 |
78 | 79 | 80 | 81 |
Modifies:
82 | 1) { ?>
    84 |
  • 85 |
88 | 89 | 91 | 92 | 93 |
Throws:
94 | 1) { ?>
    96 |
  • 97 |
100 | 101 | 103 | 104 | 105 |
Returns:
106 | 1) { ?>
    108 |
  • 109 |
112 | 113 | 115 | 116 | 117 |
Yields:
118 | 1) { ?>
    120 |
  • 121 |
124 | 125 | 127 | 128 | 129 |
Example 1? 's':'' ?>
130 | 131 | 132 | -------------------------------------------------------------------------------- /template/tmpl/modifies.tmpl: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 |
7 |
8 | Type 9 |
10 |
11 | 12 |
13 |
14 | 15 | -------------------------------------------------------------------------------- /template/tmpl/params.tmpl: -------------------------------------------------------------------------------- 1 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 98 | 99 | 100 | 113 | 114 | 115 | 116 | 121 | 122 | 123 | 127 | 128 | 129 | 130 | 131 |
NameTypeAttributesDefaultDescription
94 | 95 | 96 | 97 | 101 | 102 | <optional>
103 | 104 | 105 | 106 | <nullable>
107 | 108 | 109 | 110 | <repeatable>
111 | 112 |
117 | 118 | 119 | 120 | 124 |
Properties
125 | 126 |
132 | -------------------------------------------------------------------------------- /template/tmpl/properties.tmpl: -------------------------------------------------------------------------------- 1 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 80 | 81 | 82 | 91 | 92 | 93 | 94 | 99 | 100 | 101 | 104 | 105 | 106 | 107 | 108 |
NameTypeAttributesDefaultDescription
76 | 77 | 78 | 79 | 83 | 84 | <optional>
85 | 86 | 87 | 88 | <nullable>
89 | 90 |
95 | 96 | 97 | 98 | 102 |
Properties
103 |
109 | -------------------------------------------------------------------------------- /template/tmpl/returns.tmpl: -------------------------------------------------------------------------------- 1 | 5 |
6 | 7 |
8 | 9 | 10 | 11 |
12 |
13 | Type 14 |
15 |
16 | 17 |
18 |
19 | -------------------------------------------------------------------------------- /template/tmpl/source.tmpl: -------------------------------------------------------------------------------- 1 | 4 |
5 |
6 |
7 |
8 |
-------------------------------------------------------------------------------- /template/tmpl/tutorial.tmpl: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 0) { ?> 5 |
    8 |
  • 9 |
10 | 11 | 12 |

13 |
14 | 15 |
16 | 17 |
18 | 19 |
20 | -------------------------------------------------------------------------------- /template/tmpl/type.tmpl: -------------------------------------------------------------------------------- 1 | 5 | 6 | | 7 | -------------------------------------------------------------------------------- /tutorials/Angular.md: -------------------------------------------------------------------------------- 1 | Add this dependencies in `package.json` 2 | ```json 3 | "dependencies":{ 4 | "browser-fs-access": "^0.31.0", 5 | "browserify": "^17.0.0", 6 | "buffer": "^6.0.3", 7 | "crypto-browserify": "^3.12.0", 8 | "node-util": "^0.0.1", 9 | "stream-http": "^3.2.0", 10 | "url": "^0.11.0", 11 | "https-browserify": "^1.0.0", 12 | "webpack": "^5.74.0", 13 | "webpack-cli": "^4.10.0" 14 | } 15 | ``` 16 | Add this in `tsconfig.json` 17 | ```json 18 | { 19 | "compilerOptions":{ 20 | "paths":{ 21 | "https":["none_modules/https-browserify"], 22 | "http":["node_modules/stream-http"], 23 | "util":["node_modules/node-util"], 24 | "fs":["node_modules/browser-fs-access"], 25 | "stream":["node_modules/stream-browserify"], 26 | "url":["node_modules/url"], 27 | "crypto":["node_modules/crypto-browserify"], 28 | "buffer":["node_modules/buffer"] 29 | } 30 | } 31 | } 32 | ``` 33 | Add this in `polyfills.ts` 34 | ```js 35 | (window as any)['global'] = window; 36 | (window as any).process={cwd:()=>"/"}; 37 | ``` 38 | -------------------------------------------------------------------------------- /tutorials/React.md: -------------------------------------------------------------------------------- 1 | Paste this in `package.json` file 2 | ```json 3 | "scripts":{ 4 | "start":"react-app-rewired start", 5 | "build": "react-app-rewired build", 6 | "test": "react-app-rewired test", 7 | "eject": "react-app-rewired eject" 8 | } 9 | ``` 10 | Add this dependencies in `package.json` 11 | ```json 12 | "dependencies":{ 13 | "browser-fs-access": "^0.31.0", 14 | "browserify": "^17.0.0", 15 | "buffer": "^6.0.3", 16 | "crypto-browserify": "^3.12.0", 17 | "node-util": "^0.0.1", 18 | "stream-http": "^3.2.0", 19 | "url": "^0.11.0", 20 | "https-browserify": "^1.0.0", 21 | "react-app-rewired": "^2.2.1", 22 | "webpack": "^5.74.0", 23 | "webpack-cli": "^4.10.0" 24 | } 25 | ``` 26 | In root project directory make file `config-overrides.js` and paste this code 27 | ```js 28 | const webpack = require('webpack'); 29 | module.exports = function override(config) { 30 | const fallback = config.resolve.fallback || {}; 31 | Object.assign(fallback, { 32 | https:require.resolve("https-browserify"), 33 | util:require.resolve("node-util"), 34 | crypto: require.resolve("crypto-browserify"), 35 | http: require.resolve("stream-http"), 36 | buffer: require.resolve("buffer"), 37 | url:require.resolve("url"), 38 | fs:require.resolve("browser-fs-access"), 39 | stream:require.resolve("stream-browserify") 40 | }); 41 | config.resolve.fallback = fallback; 42 | config.plugins = (config.plugins || []).concat([ 43 | new webpack.ProvidePlugin({ 44 | process: 'process/browser', 45 | Buffer: ['buffer', 'Buffer'] 46 | }) 47 | ]) 48 | return config; } 49 | ``` 50 | -------------------------------------------------------------------------------- /tutorials/Vue.md: -------------------------------------------------------------------------------- 1 | Add this dependencies in `package.json` 2 | ```json 3 | "dependencies":{ 4 | "browser-fs-access": "^0.31.0", 5 | "browserify": "^17.0.0", 6 | "buffer": "^6.0.3", 7 | "crypto-browserify": "^3.12.0", 8 | "node-util": "^0.0.1", 9 | "stream-http": "^3.2.0", 10 | "url": "^0.11.0", 11 | "https-browserify": "^1.0.0", 12 | "webpack": "^5.74.0", 13 | "webpack-cli": "^4.10.0", 14 | "node-polyfill-webpack-plugin": "^2.0.1" 15 | } 16 | ``` 17 | Paste this code in `vue.config.js` 18 | ```js 19 | const { defineConfig } = require('@vue/cli-service') 20 | const NodePolyfillPlugin = require("node-polyfill-webpack-plugin") 21 | module.exports = defineConfig({ 22 | transpileDependencies: true, 23 | configureWebpack:{ 24 | plugins:[ 25 | new NodePolyfillPlugin() 26 | ] 27 | } 28 | }) 29 | ``` -------------------------------------------------------------------------------- /tutorials/module-in-browser.md: -------------------------------------------------------------------------------- 1 | ### Get info example in browser 2 | ```html 3 | 4 | 5 | 6 | 12 | ``` -------------------------------------------------------------------------------- /tutorials/push-transaction.md: -------------------------------------------------------------------------------- 1 | ### Initial declaration 2 | ```js 3 | const {JsonRpc,JsSignatureProvider,Api}=require("ineryjs"); 4 | const rpc=new JsonRpc("https://myurl"); 5 | const signatureProvider=new JsSignatureProvider(["private key 1"]); 6 | const api=new Api({rpc,signatureProvider}); 7 | ``` 8 | ### Three ways to push transaction 9 | 1. ```js 10 | try{ 11 | console.log(await api.transact({ 12 | actions:[ 13 | { 14 | account:"account_name", 15 | name:"action_name", 16 | authorization:[ 17 | { 18 | actor:"actor_name", 19 | permission:"actor_permission" 20 | } 21 | ], 22 | data:{ 23 | ...data 24 | } 25 | } 26 | ] 27 | },{broadcast:true,sign:true})); 28 | } 29 | catch(error){ 30 | console.error(error); 31 | } 32 | ``` 33 | 2. ```js 34 | try{ 35 | console.log(await api.transact({ 36 | actions:[ 37 | api.with("account_name").as("actor_name").action_name(...data); 38 | ] 39 | })); 40 | } 41 | catch(error){ 42 | console.error(error); 43 | } 44 | ``` 45 | 3. ```js 46 | try{ 47 | const tx=api.buildTransaction(); 48 | tx.with("account_name").as("actor_name").action_name(...data); 49 | console.log(await tx.send()); 50 | } 51 | catch(error){ 52 | console.error(error); 53 | } 54 | ``` -------------------------------------------------------------------------------- /tutorials/tutorials.json: -------------------------------------------------------------------------------- 1 | { 2 | "module-in-browser":{ 3 | "title":"Module in browser" 4 | }, 5 | "push-transaction":{ 6 | "title":"Push transaction" 7 | }, 8 | "React":{ 9 | "title":"Using module with React" 10 | } 11 | , 12 | "Angular":{ 13 | "title":"Using module with Angular" 14 | }, 15 | "Vue":{ 16 | "title":"Using module with Vue" 17 | } 18 | } -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path=require("path"); 2 | module.exports={ 3 | mode:"production", 4 | entry: { 5 | ineryjs_api: './dist/ineryjs-api.js', 6 | ineryjs_jsonrpc: './dist/rpc-web.js', 7 | ineryjs_jssig: './dist/ineryjs-jssig.js', 8 | ineryjs_rpcerror: './dist/ineryjs-rpcerror.js' 9 | }, 10 | output: { 11 | filename: x => x.chunk.name.replace('_', '-') + '.min.js', 12 | library: '[name]', 13 | path: path.resolve(__dirname, 'dist-web'), 14 | }, 15 | resolve:{ 16 | extensions: ['.js'], 17 | fallback:{ 18 | https:require.resolve("https-browserify"), 19 | util:require.resolve("node-util"), 20 | crypto: require.resolve("crypto-browserify"), 21 | http: require.resolve("stream-http"), 22 | buffer: require.resolve("buffer"), 23 | url:require.resolve("url"), 24 | fs:require.resolve("browser-fs-access"), 25 | stream:require.resolve("stream-browserify") 26 | } 27 | } 28 | } --------------------------------------------------------------------------------