Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wipe/load working #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions packages/ts-keepkey-sdk/__tests__/btc-get-address.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@ let run_test = async function () {
showDisplay: false
}

//push tx to api
// console.log(kk.instance.SignTransaction())
let timeStart = new Date().getTime()
let responseSign = await sdk.wallet.btcGetAddress({ bTCGetAddress: addressInfo })
console.log("responseSign: ", responseSign.data)
let timeEnd = new Date().getTime()
console.log("duration: ", (timeStart - timeEnd) / 1000)
for (let index = 0; index < 100; index++) {
//push tx to api
// console.log(kk.instance.SignTransaction())
console.log("Try: ", index)
let timeStart = new Date().getTime()
let responseSign = await sdk.wallet.btcGetAddress({ bTCGetAddress: addressInfo })
console.log("responseSign: ", responseSign.data)
let timeEnd = new Date().getTime()
console.log("duration: ", (timeStart - timeEnd) / 1000)
}



// let responseSign = await kk.instance.GetPublicKeys(null, { paths })
// console.log("responseSign: ", responseSign.data)
Expand Down
2 changes: 1 addition & 1 deletion packages/ts-keepkey-sdk/__tests__/load-seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let run_test = async function () {
if (!seed) throw Error("Must set seed in ENV file!")
let loadPayload = {
mnemonic: seed,
label: "testSeed",
label: "Test Seed",
passphrase: false,
pin: "1",
skipChecksum: true
Expand Down
16 changes: 16 additions & 0 deletions packages/ts-keepkey-sdk/__tests__/spam-btc-get-address.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { spawn } = require('node:child_process')

for (let index = 0; index < 100; index++) {
const btcGetAddress = spawn('node', ['./btc-get-address.js']);
btcGetAddress.stdout.on('data', (data) => {
console.log(`stdout ${index}: ${data}`);
});

btcGetAddress.stderr.on('data', (data) => {
console.error(`stderr ${index}: ${data}`);
});

btcGetAddress.on('close', (code) => {
console.log(`child process ${index} exited with code ${code}`);
});
}
25 changes: 25 additions & 0 deletions packages/ts-keepkey-sdk/__tests__/wipe-device.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const { getKeepKeySDK } = require("../lib")

let spec = 'http://localhost:1646/spec/swagger.json'

let run_test = async function () {
try {
let config = {
serviceKey: process.env['SERVICE_KEY'] || 'abc-123',
serviceName: process.env['SERVICE_NAME'] || 'KeepKey SDK Demo App',
serviceImageUrl: process.env['SERVICE_IMAGE_URL'] || 'https://github.com/BitHighlander/keepkey-desktop/raw/master/electron/icon.png',
spec
}
//init
const sdk = await getKeepKeySDK(config)
//push tx to api
// console.log(kk.instance.SignTransaction())
let responseSign = await sdk.developer.wipe()
console.log("responseSign: ", responseSign.data)

} catch (e) {
console.error(e)
}
}

run_test()
2 changes: 1 addition & 1 deletion packages/ts-keepkey-sdk/openapitools.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "6.2.0",
"generators": {
"sdk": {
"inputSpec": "/Users/seanluther/keepkey_work/keepkey-desktop/electron/api/dist/swagger.json",
"inputSpec": "http://localhost:1646/spec/swagger.json",
"generatorName": "typescript-fetch",
"output": "#{cwd}/src/generated",
"enablePostProcessFile": true,
Expand Down
129 changes: 65 additions & 64 deletions packages/ts-keepkey-sdk/src/generated/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,64 +1,65 @@
apis/ClientEndpointsApi.ts
apis/DeveloperEndpointsApi.ts
apis/DeviceInfoEndpointsApi.ts
apis/KeepKeySignTxEndpointsApi.ts
apis/KeepKeyWalletEndpointsApi.ts
apis/RawKeepKeyDeviceI0EndpointsApi.ts
apis/RecoveryEndpointsApi.ts
apis/index.ts
index.ts
models/BTCGetAddress.ts
models/BTCInputScriptType.ts
models/BTCSignedTx.ts
models/BinanceGetAddress.ts
models/CosmosGetAddress.ts
models/CosmosSignTx.ts
models/CosmosSignedTx.ts
models/CosmosStdTx.ts
models/CryptoPubKey.ts
models/ETHGetAddress.ts
models/ETHSignedMessage.ts
models/ETHSignedTx.ts
models/EosGetPublicKey.ts
models/GenericResponse.ts
models/GetEntropy.ts
models/GetFeatures.ts
models/GetPublicKey.ts
models/GetPublicKeys200ResponseInner.ts
models/LoadDevice.ts
models/ModelError.ts
models/Msg.ts
models/OsmosisGetAddress.ts
models/PairBody.ts
models/PairResponse.ts
models/Press.ts
models/PublicKey.ts
models/ReadDevice200Response.ts
models/RecoverDevice.ts
models/ResetDevice.ts
models/RippleGetAddress.ts
models/RipplePayment.ts
models/RippleSignTx.ts
models/RippleStdTx.ts
models/RippleTx.ts
models/SdkMsg.ts
models/SendCharacterProto.ts
models/SendPassphrase.ts
models/SendPin.ts
models/SignTransaction200Response.ts
models/SignedTx.ts
models/StdFee.ts
models/StdSignature.ts
models/ThorchainGetAddress.ts
models/ThorchainMsg.ts
models/ThorchainSignTx.ts
models/ThorchainStdFee.ts
models/ThorchainStdSignature.ts
models/ThorchainStdTx.ts
models/ThorchainTx.ts
models/UserType.ts
models/UserTypeAccountsInner.ts
models/WriteBody.ts
models/WriteDevice200Response.ts
models/index.ts
runtime.ts
.openapi-generator-ignore
apis/ClientEndpointsApi.ts
apis/DeveloperEndpointsApi.ts
apis/DeviceInfoEndpointsApi.ts
apis/KeepKeySignTxEndpointsApi.ts
apis/KeepKeyWalletEndpointsApi.ts
apis/RawKeepKeyDeviceI0EndpointsApi.ts
apis/RecoveryEndpointsApi.ts
apis/index.ts
index.ts
models/BTCGetAddress.ts
models/BTCInputScriptType.ts
models/BTCSignedTx.ts
models/BinanceGetAddress.ts
models/CosmosGetAddress.ts
models/CosmosSignTx.ts
models/CosmosSignedTx.ts
models/CosmosStdTx.ts
models/CryptoPubKey.ts
models/ETHGetAddress.ts
models/ETHSignedMessage.ts
models/ETHSignedTx.ts
models/EosGetPublicKey.ts
models/GenericResponse.ts
models/GetEntropy.ts
models/GetFeatures.ts
models/GetPublicKey.ts
models/GetPublicKeys200ResponseInner.ts
models/LoadDevice.ts
models/ModelError.ts
models/Msg.ts
models/OsmosisGetAddress.ts
models/PairBody.ts
models/PairResponse.ts
models/Press.ts
models/PublicKey.ts
models/ReadDevice200Response.ts
models/RecoverDevice.ts
models/ResetDevice.ts
models/RippleGetAddress.ts
models/RipplePayment.ts
models/RippleSignTx.ts
models/RippleStdTx.ts
models/RippleTx.ts
models/SdkMsg.ts
models/SendCharacterProto.ts
models/SendPassphrase.ts
models/SendPin.ts
models/SignTransaction200Response.ts
models/SignedTx.ts
models/StdFee.ts
models/StdSignature.ts
models/ThorchainGetAddress.ts
models/ThorchainMsg.ts
models/ThorchainSignTx.ts
models/ThorchainStdFee.ts
models/ThorchainStdSignature.ts
models/ThorchainStdTx.ts
models/ThorchainTx.ts
models/UserType.ts
models/UserTypeAccountsInner.ts
models/WriteBody.ts
models/WriteDevice200Response.ts
models/index.ts
runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* keepkey-desktop
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.14
* Contact: bithighlander@gmail.com
* The version of the OpenAPI document: 1.2.4
* Contact: support@keepkey.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* keepkey-desktop
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.14
* Contact: bithighlander@gmail.com
* The version of the OpenAPI document: 1.2.4
* Contact: support@keepkey.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down Expand Up @@ -86,10 +86,6 @@ export interface SoftResetRequest {
body: any | null;
}

export interface WipeRequest {
body: any | null;
}

/**
*
*/
Expand Down Expand Up @@ -580,17 +576,11 @@ export class DeveloperEndpointsApi extends runtime.BaseAPI {

/**
*/
async wipeRaw(requestParameters: WipeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<any>> {
if (requestParameters.body === null || requestParameters.body === undefined) {
throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling wipe.');
}

async wipeRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<any>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.apiKey) {
headerParameters["authorization"] = this.configuration.apiKey("authorization"); // api_key authentication
}
Expand All @@ -600,16 +590,15 @@ export class DeveloperEndpointsApi extends runtime.BaseAPI {
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: requestParameters.body as any,
}, initOverrides);

return new runtime.TextApiResponse(response) as any;
}

/**
*/
async wipe(requestParameters: WipeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<any> {
const response = await this.wipeRaw(requestParameters, initOverrides);
async wipe(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<any> {
const response = await this.wipeRaw(initOverrides);
return await response.value();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* keepkey-desktop
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.14
* Contact: bithighlander@gmail.com
* The version of the OpenAPI document: 1.2.4
* Contact: support@keepkey.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* keepkey-desktop
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.14
* Contact: bithighlander@gmail.com
* The version of the OpenAPI document: 1.2.4
* Contact: support@keepkey.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* keepkey-desktop
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.14
* Contact: bithighlander@gmail.com
* The version of the OpenAPI document: 1.2.4
* Contact: support@keepkey.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* keepkey-desktop
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.14
* Contact: bithighlander@gmail.com
* The version of the OpenAPI document: 1.2.4
* Contact: support@keepkey.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* keepkey-desktop
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.14
* Contact: bithighlander@gmail.com
* The version of the OpenAPI document: 1.2.4
* Contact: support@keepkey.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down Expand Up @@ -202,7 +202,7 @@ export class RecoveryEndpointsApi extends runtime.BaseAPI {

/**
*/
async pressRaw(requestParameters: PressRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<any>> {
async pressRaw(requestParameters: PressRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.press === null || requestParameters.press === undefined) {
throw new runtime.RequiredError('press','Required parameter requestParameters.press was null or undefined when calling press.');
}
Expand All @@ -225,14 +225,13 @@ export class RecoveryEndpointsApi extends runtime.BaseAPI {
body: PressToJSON(requestParameters.press),
}, initOverrides);

return new runtime.TextApiResponse(response) as any;
return new runtime.VoidApiResponse(response);
}

/**
*/
async press(requestParameters: PressRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<any> {
const response = await this.pressRaw(requestParameters, initOverrides);
return await response.value();
async press(requestParameters: PressRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.pressRaw(requestParameters, initOverrides);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/ts-keepkey-sdk/src/generated/models/BTCGetAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* keepkey-desktop
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.14
* Contact: bithighlander@gmail.com
* The version of the OpenAPI document: 1.2.4
* Contact: support@keepkey.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* keepkey-desktop
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.14
* Contact: bithighlander@gmail.com
* The version of the OpenAPI document: 1.2.4
* Contact: support@keepkey.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down
Loading