-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from phantasma-io/dev
Merge Ledger Changes
- Loading branch information
Showing
306 changed files
with
22,381 additions
and
20,097 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.DS_Store | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
!.env.example | ||
|
||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ['eslint:recommended', 'prettier'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint'], | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2020, | ||
}, | ||
env: { | ||
browser: true, | ||
es2017: true, | ||
node: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.DS_Store | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
!.env.example | ||
|
||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"semi": true, | ||
"trailingComma": "es5", | ||
"singleQuote": true, | ||
"printWidth": 100, | ||
"tabWidth": 2, | ||
"useTabs": false | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
export * from "./rpc/phantasma"; | ||
export * from "./vm/index"; | ||
export * from "./tx/index"; | ||
export * from "./utils/index"; | ||
export * from "./types/index"; | ||
export * from "./interfaces/index"; | ||
export * from './rpc/phantasma'; | ||
export * from './vm/index'; | ||
export * from './tx/index'; | ||
export * from './utils/index'; | ||
export * from './types/index'; | ||
export * from './interfaces/index'; | ||
export * from './ledger/index'; | ||
export * from './link/index'; | ||
//# sourceMappingURL=index.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Address } from '../types'; | ||
/** | ||
* Gets the address from a private key. | ||
* @param privateKey The private key as a string. | ||
* @returns The address as a string. | ||
*/ | ||
export declare const GetAddressFromPrivateKey: (privateKey: string) => string; | ||
/** | ||
* Gets the address from a public key. | ||
* @param publicKey The public key as a string. | ||
* @returns The address as a string. | ||
*/ | ||
export declare const GetAddressFromPublicKey: (publicKey: string) => string; | ||
/** | ||
* Gets the address from a public key. | ||
* @param publicKey Public key as a string. | ||
* @returns Address | ||
*/ | ||
export declare const GetAddressPublicKeyFromPublicKey: (publicKey: string) => Address; | ||
//# sourceMappingURL=Address-Transcode.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetAddressPublicKeyFromPublicKey = exports.GetAddressFromPublicKey = exports.GetAddressFromPrivateKey = void 0; | ||
var bs58 = __importStar(require("bs58")); | ||
var types_1 = require("../types"); | ||
/** | ||
* Gets the address from a private key. | ||
* @param privateKey The private key as a string. | ||
* @returns The address as a string. | ||
*/ | ||
var GetAddressFromPrivateKey = function (privateKey) { | ||
var keys = types_1.PhantasmaKeys.fromWIF(privateKey); | ||
var publicKey = keys.Address.Text; | ||
return publicKey; | ||
}; | ||
exports.GetAddressFromPrivateKey = GetAddressFromPrivateKey; | ||
/** | ||
* Gets the address from a public key. | ||
* @param publicKey The public key as a string. | ||
* @returns The address as a string. | ||
*/ | ||
var GetAddressFromPublicKey = function (publicKey) { | ||
// Assuming Base16.decodeUint8Array is a function that decodes a base16 string to Uint8Array | ||
var pubKeyBytes = types_1.Base16.decodeUint8Array(publicKey); | ||
// Create a new array and set the first two elements | ||
var addrArray = new Uint8Array(34); | ||
addrArray[0] = 1; | ||
// Copy 32 bytes from the 2nd position of pubKeyBytes to addrArray, starting from the 3rd position of addrArray | ||
addrArray.set(pubKeyBytes.slice(0, 32), 2); | ||
return 'P' + bs58.encode(addrArray); | ||
}; | ||
exports.GetAddressFromPublicKey = GetAddressFromPublicKey; | ||
/** | ||
* Gets the address from a public key. | ||
* @param publicKey Public key as a string. | ||
* @returns Address | ||
*/ | ||
var GetAddressPublicKeyFromPublicKey = function (publicKey) { | ||
var pubKeyBytes = types_1.Base16.decodeUint8Array(publicKey); | ||
// Create a new array and set the first two elements | ||
var addrArray = new Uint8Array(34); | ||
addrArray[0] = 1; | ||
// Copy 32 bytes from the 2nd position of pubKeyBytes to addrArray, starting from the 3rd position of addrArray | ||
addrArray.set(pubKeyBytes.slice(0, 32), 2); | ||
return types_1.Address.FromPublickKey(addrArray); | ||
}; | ||
exports.GetAddressPublicKeyFromPublicKey = GetAddressPublicKeyFromPublicKey; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { LedgerConfig } from './interfaces/LedgerConfig'; | ||
import { LedgerDeviceInfoResponse } from './interfaces/LedgerDeviceInfoResponse'; | ||
/** | ||
* | ||
* @param number | ||
* @param length | ||
* @returns | ||
*/ | ||
export declare const LeftPad: (number: any, length: any) => string; | ||
/** | ||
* | ||
* @param balance | ||
* @param decimals | ||
* @returns | ||
*/ | ||
export declare const ToWholeNumber: (balance: any, decimals: any) => string; | ||
/** | ||
* Get the device info from the ledger. | ||
* @param config | ||
* @returns | ||
*/ | ||
export declare const GetLedgerDeviceInfo: (config: LedgerConfig) => Promise<LedgerDeviceInfoResponse>; | ||
/** | ||
* Get Ledger Account Signer | ||
* @param config | ||
* @param accountIx | ||
* @returns | ||
*/ | ||
export declare const GetLedgerAccountSigner: (config: LedgerConfig, accountIx: any) => Promise<any>; | ||
/** | ||
* GetBalanceFromLedger | ||
* @param config | ||
* @param options | ||
* @returns | ||
*/ | ||
export declare const GetBalanceFromLedger: (config: LedgerConfig, options: any) => Promise<any>; | ||
/** | ||
* Get Addres from Ledger | ||
* @param config | ||
* @param options | ||
* @returns | ||
*/ | ||
export declare const GetAddressFromLedeger: (config: LedgerConfig, options: any) => Promise<string | import("..").PublicKeyResponse>; | ||
/** | ||
* SendTransactionLedger | ||
* @param config | ||
* @param script | ||
* @returns | ||
*/ | ||
export declare function SendTransactionLedger(config: LedgerConfig, script: string): Promise<any>; | ||
/** | ||
* | ||
* @param config | ||
* @param privateKey | ||
* @returns | ||
*/ | ||
export declare const GetBalanceFromPrivateKey: (config: any, privateKey: any) => Promise<any>; | ||
/** | ||
* | ||
* @param config | ||
* @param mnemonic | ||
* @param index | ||
* @returns | ||
*/ | ||
export declare const GetBalanceFromMnemonic: (config: LedgerConfig, mnemonic: string, index: any) => Promise<any>; | ||
//# sourceMappingURL=Ledger-Commands.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.