diff --git a/packages/aptos-keyring/build.sh b/packages/aptos-keyring/build.sh deleted file mode 100755 index 069cfd42..00000000 --- a/packages/aptos-keyring/build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -e - -cd $(dirname $0)/ - -if [ "$NODE_ENV" != "test" ]; then - if grep -Fq "SHOULD_BE_REPLACED" src/Secret.ts; then - echo -e "\nCredentials in src/Secret.ts should be replaced with real one.\n" - exit 1 - fi -fi -tsdx build diff --git a/packages/aptos-keyring/config.ts.example b/packages/aptos-keyring/config.ts.example deleted file mode 100644 index b1c042b9..00000000 --- a/packages/aptos-keyring/config.ts.example +++ /dev/null @@ -1,2 +0,0 @@ -export const MP_TOKEN = "$SHOULD_BE_REPLACED"; -export const MP_PROJECT_ID = "$SHOULD_BE_REPLACED"; diff --git a/packages/aptos-keyring/package.json b/packages/aptos-keyring/package.json index 0816a703..f06ff2f9 100644 --- a/packages/aptos-keyring/package.json +++ b/packages/aptos-keyring/package.json @@ -1,6 +1,6 @@ { "name": "@keystonehq/aptos-keyring", - "version": "0.6.2", + "version": "0.6.3", "description": "aptos-keyring interact with Keystone", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -10,9 +10,7 @@ "scripts": { "clean": "rm -rf ./dist", "start": "tsdx watch", - "ci:prepare": "./prepare.sh", - "copy:config": "cp ./config.ts ./src/Secret.ts", - "build": "npm run copy:config && ./build.sh" + "build": "tsdx build" }, "publishConfig": { "access": "public" @@ -31,6 +29,5 @@ "@types/uuid": "^8.3.1", "tsdx": "^0.14.1", "typescript": "^4.6.2" - }, - "gitHead": "83d8e223d29e5cc71dccc963388d65a87c894636" + } } diff --git a/packages/aptos-keyring/prepare.sh b/packages/aptos-keyring/prepare.sh deleted file mode 100755 index b214e06a..00000000 --- a/packages/aptos-keyring/prepare.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -echo 'export const MP_TOKEN = ""; -export const MP_PROJECT_ID = "";' > config.ts diff --git a/packages/aptos-keyring/src/BaseKeyring.ts b/packages/aptos-keyring/src/BaseKeyring.ts index b303873d..99c4151f 100644 --- a/packages/aptos-keyring/src/BaseKeyring.ts +++ b/packages/aptos-keyring/src/BaseKeyring.ts @@ -2,7 +2,6 @@ import * as uuid from "uuid"; import { InteractionProvider } from "./InteractionProvider"; import { CryptoMultiAccounts } from "@keystonehq/bc-ur-registry"; import { AptosSignRequest, SignType } from "@keystonehq/bc-ur-registry-aptos"; -import { Tracker } from './Tracker'; const keyringType = "QR Hardware Wallet Device"; @@ -32,7 +31,6 @@ export class BaseKeyring { protected keys: HDKey[]; protected name: string; protected device: string; - public isTracking: boolean; constructor() { //common props @@ -41,7 +39,6 @@ export class BaseKeyring { this.initialized = false; this.device = ""; this.xfp = ""; - this.isTracking = true; } protected requestSignature = async ( @@ -66,14 +63,6 @@ export class BaseKeyring { ); } } - if (this.isTracking) { - Tracker.track("sign", { - distinctId: this.device, - time: Date.now(), - xfp: this.xfp, - requestId: _requestId, - }); - } return { signature, authPubKey }; }; @@ -91,23 +80,16 @@ export class BaseKeyring { this.keys = keys.map((each, index) => ({ hdPath: each.getOrigin().getPath(), pubKey: each.getKey().toString("hex"), - index + index, })); this.initialized = true; - if (this.isTracking) { - Tracker.track("sync", { - distinctId: this.device, - time: Date.now(), - xfp: this.xfp, - }); - } } public syncKeyringData({ xfp, keys, name = "QR Hardware", - device + device, }: KeyringInitData): void { this.xfp = xfp; this.name = name; @@ -143,7 +125,7 @@ export class BaseKeyring { ) { const requestId = uuid.v4(); const key = this.getPubKeys().find( - key => this._ensureHex(key.pubKey) === this._ensureHex(authPubKey) + (key) => this._ensureHex(key.pubKey) === this._ensureHex(authPubKey) ); const accounts = senderAddress ? [Buffer.from(this._ensureHex(senderAddress).slice(2))] diff --git a/packages/aptos-keyring/src/DefaultInteractionProvider.ts b/packages/aptos-keyring/src/DefaultInteractionProvider.ts index 72d67b84..a621cb53 100644 --- a/packages/aptos-keyring/src/DefaultInteractionProvider.ts +++ b/packages/aptos-keyring/src/DefaultInteractionProvider.ts @@ -1,6 +1,6 @@ import { AptosSignature, - AptosSignRequest + AptosSignRequest, } from "@keystonehq/bc-ur-registry-aptos"; import { InteractionProvider } from "./InteractionProvider"; import sdk, { PlayStatus, ReadStatus, SupportedResult } from "@keystonehq/sdk"; @@ -27,10 +27,10 @@ export class DefaultInteractionProvider implements InteractionProvider { description: "Please scan the QR code displayed on your Keystone", renderInitial: { walletMode: "Aptos", - link: "https://keyst.one/defi" + link: "https://keyst.one/defi", }, URTypeErrorMessage: - "The scanned QR code is not the sync code from the Keystone hardware wallet. Please verify the code and try again" + "The scanned QR code is not the sync code from the Keystone hardware wallet. Please verify the code and try again", } ); if (decodedResult.status === ReadStatus.success) { @@ -50,7 +50,7 @@ export class DefaultInteractionProvider implements InteractionProvider { hasNext: true, title: requestTitle, description: requestDescription, - maxFragmentLength: 400 + maxFragmentLength: 400, }); if (status === PlayStatus.canceled) throw new Error("#ktek_error[play-cancel]: play canceled"); diff --git a/packages/aptos-keyring/src/InteractionProvider.ts b/packages/aptos-keyring/src/InteractionProvider.ts index 7db54432..d157c4b8 100644 --- a/packages/aptos-keyring/src/InteractionProvider.ts +++ b/packages/aptos-keyring/src/InteractionProvider.ts @@ -1,6 +1,6 @@ import { AptosSignature, - AptosSignRequest + AptosSignRequest, } from "@keystonehq/bc-ur-registry-aptos"; import { CryptoMultiAccounts } from "@keystonehq/bc-ur-registry"; diff --git a/packages/aptos-keyring/src/Tracker.ts b/packages/aptos-keyring/src/Tracker.ts deleted file mode 100644 index 500f7bb3..00000000 --- a/packages/aptos-keyring/src/Tracker.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { MP_TOKEN, MP_PROJECT_ID } from "./Secret"; - -interface MPPayload { - distinctId: string; - time: number; - requestId?: string; - xfp: string; -} -export class Tracker { - public static async track(event_name, payload: MPPayload) { - const url = `https://api.mixpanel.com/import?strict=1&project_id=${MP_PROJECT_ID}`; - const insertId = payload.requestId ? payload.requestId : payload.xfp; - const body = JSON.stringify([ - { - properties: { - distinct_id: payload.distinctId, - time: payload.time, - $insert_id: insertId, - xfp: payload.xfp, - }, - event: event_name, - }, - ]); - const options = { - method: "POST", - headers: { - Accept: "application/json", - "Content-Type": "application/json", - Authorization: `Basic ${MP_TOKEN}`, - }, - body, - }; - try { - const res = await fetch(url, options); - return await res.json(); - } catch (err) { - console.error("error:" + err); - } - } -}