diff --git a/apps/portfolio/package.json b/apps/portfolio/package.json index 7400040..e26e584 100644 --- a/apps/portfolio/package.json +++ b/apps/portfolio/package.json @@ -1,6 +1,6 @@ { "name": "keepkey-portfolio-v6", - "version": "0.1.15", + "version": "0.1.20", "private": true, "scripts": { "dev": "next dev", diff --git a/apps/portfolio/src/components/keepkey/Transfer.tsx b/apps/portfolio/src/components/keepkey/Transfer.tsx index faf5ca6..2efd028 100644 --- a/apps/portfolio/src/components/keepkey/Transfer.tsx +++ b/apps/portfolio/src/components/keepkey/Transfer.tsx @@ -34,7 +34,7 @@ import { StepSelectFees } from "./steps/StepSelectFees"; import { StepConfirmTx } from "./steps/StepConfirmTx"; import { StepSignTx } from "./steps/StepSignTx"; import { StepBroadcastTx } from "./steps/StepBroadcastTx"; - +const TAG = " | Transfer | " // --------------------------- // Context and Provider // --------------------------- @@ -188,85 +188,113 @@ function TransferProvider({ app, children }: { app: any; children: React.ReactNo }, [app]); const buildTx = useCallback(async () => { - setIsSubmitting(true); - setUnsignedTx(null); - setSignedTx(null); - setBroadcastResult(null); - setTxHash(''); - - let outputs: { address?: string; amount?: string; opReturn?: string }[] = []; - - if (!batchEnabled) { - // Single - if (!recipient || !validateAddress(recipient)) { - toaster.create({ - title: 'Error', - description: 'A valid recipient address is required.', - duration: 5000, - }); - setIsSubmitting(false); - return; + let tag = TAG + " | buildTx | " + try{ + console.log(tag,"buildTx clicked!!!! ") + // + setIsSubmitting(true); + setUnsignedTx(null); + setSignedTx(null); + setBroadcastResult(null); + setTxHash(''); + + let outputs: { address?: string; amount?: string; opReturn?: string }[] = []; + + if (!batchEnabled) { + console.log(tag," Not a Batch TX") + // Single + // if (!recipient || !validateAddress(recipient)) { + // toaster.create({ + // title: 'Error', + // description: 'A valid recipient address is required.', + // duration: 5000, + // }); + // setIsSubmitting(false); + // return; + // } + // if (!inputAmount && !isMax) { + // toaster.create({ + // title: 'Error', + // description: 'Please enter an amount.', + // duration: 5000, + // }); + // setIsSubmitting(false); + // return; + // } + + let params = { address: recipient, amount: inputAmount } + console.log(tag," params: ",params) + + outputs.push(params); + } else { + console.log(tag," Batch TX! ") + // Batch + const cleaned = batchOutputs.filter(o => o.recipient && validateAddress(o.recipient) && o.amount); + if (cleaned.length === 0) { + toaster.create({ + title: 'Error', + description: 'At least one valid batch output is required.', + duration: 5000, + }); + setIsSubmitting(false); + return; + } + outputs = cleaned.map(o => ({ address: o.recipient, amount: o.amount })); } - if (!inputAmount && !isMax) { - toaster.create({ - title: 'Error', - description: 'Please enter an amount.', - duration: 5000, - }); - setIsSubmitting(false); - return; + + if (opReturnEnabled && opReturnData.trim() !== '') { + outputs.push({ opReturn: opReturnData.trim() }); } - outputs.push({ address: recipient, amount: inputAmount }); - } else { - // Batch - const cleaned = batchOutputs.filter(o => o.recipient && validateAddress(o.recipient) && o.amount); - if (cleaned.length === 0) { + const sendPayload = { + caip: caip, + to:outputs[0].address, + amount:outputs[0].amount, + feeLevel:5, //TODO fee level + isMax, + }; + console.log(tag,"sendPayload: ",sendPayload) + // Simulate building tx + // await new Promise(res => setTimeout(res, 1000)); + + try { + console.log(tag,"sendPayload: ",sendPayload) + + /* + const sendPayload = { + caip, + isMax: true, + to: FAUCET_ADDRESS, + amount: balance, + feeLevel: 5 // Options + }; + + */ + + let unsignedTxResult = await app.buildTx(sendPayload); + console.log(tag,"unsignedTxResult: ",unsignedTxResult) + + let transactionState: any = { + method: 'transfer', + caip, + params: sendPayload, + unsignedTx: unsignedTxResult, + signedTx: null, + state: 'unsigned', + context: app.assetContext, + }; + setUnsignedTx(transactionState); + } catch (error) { toaster.create({ - title: 'Error', - description: 'At least one valid batch output is required.', + title: 'Transaction Failed', + description: 'An error occurred during the transaction.', duration: 5000, }); + } finally { setIsSubmitting(false); - return; } - outputs = cleaned.map(o => ({ address: o.recipient, amount: o.amount })); - } - - if (opReturnEnabled && opReturnData.trim() !== '') { - outputs.push({ opReturn: opReturnData.trim() }); - } - - const sendPayload = { - caip: caip, - outputs, - feeLevel, - isMax, - }; - - // Simulate building tx - await new Promise(res => setTimeout(res, 1000)); - - try { - let unsignedTxResult = await app.buildTx(sendPayload); - let transactionState: any = { - method: 'transfer', - caip, - params: sendPayload, - unsignedTx: unsignedTxResult, - signedTx: null, - state: 'unsigned', - context: app.assetContext, - }; - setUnsignedTx(transactionState); - } catch (error) { - toaster.create({ - title: 'Transaction Failed', - description: 'An error occurred during the transaction.', - duration: 5000, - }); - } finally { - setIsSubmitting(false); + }catch(e){ + console.error(e) } }, [app, recipient, inputAmount, isMax, batchEnabled, batchOutputs, opReturnEnabled, opReturnData, feeLevel, caip]); @@ -285,13 +313,31 @@ function TransferProvider({ app, children }: { app: any; children: React.ReactNo }, [app, caip, unsignedTx]); const broadcastTx = useCallback(async () => { - if (!signedTx) return; - try { - let broadcast = await app.broadcastTx(caip, signedTx); - const finalTxHash = broadcast.txHash || broadcast.txid; - setTxHash(finalTxHash); - setBroadcastResult(broadcast); - } catch (error) { + let tag = TAG + " | broadcastTx | " + try{ + if (!signedTx) { + console.error(tag,"No signedTx") + toaster.create({ + title: 'Broadcast Failed', + description: 'Unable to sign! tx not built!.', + duration: 5000, + }); + throw Error('Unable to sign!') + } + try { + let broadcast = await app.broadcastTx(caip, signedTx); + console.log(tag,"broadcast: ",broadcast) + const finalTxHash = broadcast.txHash || broadcast.txid; + setTxHash(finalTxHash); + setBroadcastResult(broadcast); + } catch (error) { + toaster.create({ + title: 'Broadcast Failed', + description: 'An error occurred during the broadcast.', + duration: 5000, + }); + } + }catch(e){ toaster.create({ title: 'Broadcast Failed', description: 'An error occurred during the broadcast.', diff --git a/apps/portfolio/src/components/keepkey/steps/StepBroadcastTx.tsx b/apps/portfolio/src/components/keepkey/steps/StepBroadcastTx.tsx index a1c6a81..696a105 100644 --- a/apps/portfolio/src/components/keepkey/steps/StepBroadcastTx.tsx +++ b/apps/portfolio/src/components/keepkey/steps/StepBroadcastTx.tsx @@ -11,14 +11,15 @@ export function StepBroadcastTx() { signedTx, broadcastResult, txHash, - explorerTxLink + explorerTxLink, + broadcastTx } = useTransferContext(); return ( <> {signedTx && !broadcastResult && ( - + )} @@ -41,11 +42,11 @@ export function StepBroadcastTx() { )} - - - - - + {/**/} + {/* */} + {/* */} + {/* */} + {/**/} ); } diff --git a/apps/portfolio/src/components/keepkey/steps/StepSelectFees.tsx b/apps/portfolio/src/components/keepkey/steps/StepSelectFees.tsx index 38ba8b4..037de5d 100644 --- a/apps/portfolio/src/components/keepkey/steps/StepSelectFees.tsx +++ b/apps/portfolio/src/components/keepkey/steps/StepSelectFees.tsx @@ -25,14 +25,14 @@ export function StepSelectFees() { Build Transaction - - - - - - - - + {/**/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/**/} ); } diff --git a/e2e/swaps/e2e-swap-suite/CHANGELOG.md b/e2e/swaps/e2e-swap-suite/CHANGELOG.md index e291b0b..de43b98 100644 --- a/e2e/swaps/e2e-swap-suite/CHANGELOG.md +++ b/e2e/swaps/e2e-swap-suite/CHANGELOG.md @@ -1,5 +1,48 @@ # @coinmasters/e2e-transfer-dogecoin +## 1.8.26 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.26 + +## 1.8.25 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.25 + +## 1.8.24 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.24 + +## 1.8.23 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.23 + +## 1.8.22 + +### Patch Changes + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.22 + ## 1.8.21 ### Patch Changes diff --git a/e2e/swaps/e2e-swap-suite/package.json b/e2e/swaps/e2e-swap-suite/package.json index 800af19..fd4d9fa 100644 --- a/e2e/swaps/e2e-swap-suite/package.json +++ b/e2e/swaps/e2e-swap-suite/package.json @@ -1,6 +1,6 @@ { "name": "@coinmasters/e2e-swap-suite", - "version": "1.8.21", + "version": "1.8.26", "main": "./lib/index.js", "types": "./lib/index.d.ts", "scripts": { diff --git a/e2e/transfers/e2e-transfer-suite/CHANGELOG.md b/e2e/transfers/e2e-transfer-suite/CHANGELOG.md index e59ebc6..d14c22b 100644 --- a/e2e/transfers/e2e-transfer-suite/CHANGELOG.md +++ b/e2e/transfers/e2e-transfer-suite/CHANGELOG.md @@ -1,5 +1,50 @@ # @coinmasters/e2e-transfer-dogecoin +## 1.8.26 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.26 + +## 1.8.25 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.25 + +## 1.8.24 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.24 + +## 1.8.23 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.23 + +## 1.8.22 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.22 + ## 1.8.21 ### Patch Changes diff --git a/e2e/transfers/e2e-transfer-suite/package.json b/e2e/transfers/e2e-transfer-suite/package.json index 0b7db1b..6e7f227 100644 --- a/e2e/transfers/e2e-transfer-suite/package.json +++ b/e2e/transfers/e2e-transfer-suite/package.json @@ -1,6 +1,6 @@ { "name": "@coinmasters/e2e-transfer-suite", - "version": "1.8.21", + "version": "1.8.26", "main": "./lib/index.js", "types": "./lib/index.d.ts", "scripts": { diff --git a/e2e/transfers/e2e-transfer-suite/src/index.ts b/e2e/transfers/e2e-transfer-suite/src/index.ts index 006f93f..4db2029 100644 --- a/e2e/transfers/e2e-transfer-suite/src/index.ts +++ b/e2e/transfers/e2e-transfer-suite/src/index.ts @@ -49,8 +49,8 @@ const test_service = async function (this: any) { //get all blockchains - // let spec = 'https://pioneers.dev/spec/swagger.json' - let spec = 'http://127.0.0.1:9001/spec/swagger.json' + let spec = 'https://pioneers.dev/spec/swagger.json' + // let spec = 'http://127.0.0.1:9001/spec/swagger.json' let chains = [ @@ -66,12 +66,12 @@ const test_service = async function (this: any) { // 'ARB', // 'AVAX', // 'BSC', - // 'XRP', + // 'XRP', //BROKE unable to broadcast // 'ETH', - // 'MAYA', //MARKET INFO BROKE + 'MAYA', //Amount is wrong // // 'GNO', // 'BCH', - 'BTC', + // 'BTC', ] const allByCaip = chains.map(chainStr => { @@ -276,14 +276,12 @@ const test_service = async function (this: any) { log.info(tag,'Balance: ', balance) assert(balance, `${tag} Balance not found for ${caip}`); log.info(tag, 'Balance before: ', balance); - let balanceBefore = balance.balance; + let balanceBefore = balance; + if(balanceBefore === 0) throw Error("YOU ARE BROKE!") if (balanceBefore < TEST_AMOUNT) { log.info(tag, 'Balance already drained! (or dust): ', balanceBefore); continue } - - - assert(blockchain) @@ -360,7 +358,7 @@ const test_service = async function (this: any) { log.info(tag, 'signedTx: ', signedTx); //broadcast - let broadcast = await app.broadcastTx(caipToNetworkId(caip), signedTx); + let broadcast = await app.broadcastTx(caip, signedTx); assert(broadcast) log.info(tag, 'broadcast: ', broadcast); diff --git a/e2e/wallets/bip85-subaccounts/CHANGELOG.md b/e2e/wallets/bip85-subaccounts/CHANGELOG.md index ca0af87..77788f5 100644 --- a/e2e/wallets/bip85-subaccounts/CHANGELOG.md +++ b/e2e/wallets/bip85-subaccounts/CHANGELOG.md @@ -1,5 +1,48 @@ # @coinmasters/integration-coins +## 1.8.26 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.26 + +## 1.8.25 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.25 + +## 1.8.24 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.24 + +## 1.8.23 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.23 + +## 1.8.22 + +### Patch Changes + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.22 + ## 1.8.21 ### Patch Changes diff --git a/e2e/wallets/bip85-subaccounts/package.json b/e2e/wallets/bip85-subaccounts/package.json index 1c744a3..c5c532a 100644 --- a/e2e/wallets/bip85-subaccounts/package.json +++ b/e2e/wallets/bip85-subaccounts/package.json @@ -1,6 +1,6 @@ { "name": "@coinmasters/bip85-subaccounts", - "version": "1.8.21", + "version": "1.8.26", "main": "./lib/index.js", "types": "./lib/index.d.ts", "scripts": { diff --git a/e2e/wallets/intergration-coins/CHANGELOG.md b/e2e/wallets/intergration-coins/CHANGELOG.md index bbb9e49..676af89 100644 --- a/e2e/wallets/intergration-coins/CHANGELOG.md +++ b/e2e/wallets/intergration-coins/CHANGELOG.md @@ -1,5 +1,50 @@ # @coinmasters/integration-coins +## 1.8.26 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.26 + +## 1.8.25 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.25 + +## 1.8.24 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.24 + +## 1.8.23 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.23 + +## 1.8.22 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.22 + ## 1.8.21 ### Patch Changes diff --git a/e2e/wallets/intergration-coins/package.json b/e2e/wallets/intergration-coins/package.json index 414440f..9989fd1 100644 --- a/e2e/wallets/intergration-coins/package.json +++ b/e2e/wallets/intergration-coins/package.json @@ -1,6 +1,6 @@ { "name": "@coinmasters/integration-coins", - "version": "1.8.21", + "version": "1.8.26", "main": "./lib/index.js", "types": "./lib/index.d.ts", "scripts": { diff --git a/e2e/wallets/intergration-coins/src/index.ts b/e2e/wallets/intergration-coins/src/index.ts index 24da9a2..bdeb977 100644 --- a/e2e/wallets/intergration-coins/src/index.ts +++ b/e2e/wallets/intergration-coins/src/index.ts @@ -84,14 +84,14 @@ const test_service = async function (this: any) { // 'AVAX', //fast // 'BASE', //fast // 'BSC', //fast - 'BTC', + // 'BTC', // 'BCH', // 'GAIA', // 'OSMO', // 'XRP', // 'DOGE', // 'DASH', - // 'MAYA', + 'MAYA', // 'LTC', // 'THOR' ] @@ -137,104 +137,104 @@ const test_service = async function (this: any) { //add paths to keepkey //add account 0 p2sh segwit - paths.push({ - note: 'Bitcoin account 0 segwit (p2sh)', - networks: ['bip122:000000000019d6689c085ae165831e93'], - script_type: 'p2sh-p2wpkh', - available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], - type: 'xpub', - addressNList: [0x80000000 + 49, 0x80000000 + 0, 0x80000000 + 0], - addressNListMaster: [0x80000000 + 49, 0x80000000 + 0, 0x80000000 + 0, 0, 0], - curve: 'secp256k1', - showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it - }); - - //add account1 - paths.push({ - note: 'Bitcoin account 0 Native Segwit (Bech32)', - blockchain: 'bitcoin', - symbol: 'BTC', - symbolSwapKit: 'BTC', - networks: ['bip122:000000000019d6689c085ae165831e93'], - script_type: 'p2wpkh', //bech32 - available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], - type: 'zpub', - addressNList: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1], - addressNListMaster: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1, 0, 0], - curve: 'secp256k1', - showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it - }); - - paths.push({ - note: 'Bitcoin account 1 legacy', - networks: ['bip122:000000000019d6689c085ae165831e93'], - script_type: 'p2pkh', - available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], - type: 'xpub', - addressNList: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 1], - addressNListMaster: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 1, 0, 0], - curve: 'secp256k1', - showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it - }); - - //add account1 - paths.push({ - note: 'Bitcoin account 1 Native Segwit (Bech32)', - blockchain: 'bitcoin', - symbol: 'BTC', - symbolSwapKit: 'BTC', - networks: ['bip122:000000000019d6689c085ae165831e93'], - script_type: 'p2wpkh', //bech32 - available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], - type: 'zpub', - addressNList: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1], - addressNListMaster: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1, 0, 0], - curve: 'secp256k1', - showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it - }); - - paths.push({ - note: 'Bitcoin account 1 legacy', - networks: ['bip122:000000000019d6689c085ae165831e93'], - script_type: 'p2pkh', - available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], - type: 'xpub', - addressNList: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 2], - addressNListMaster: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 2, 0, 0], - curve: 'secp256k1', - showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it - }); - - //add account3 - paths.push({ - note: 'Bitcoin account 1 Native Segwit (Bech32)', - blockchain: 'bitcoin', - symbol: 'BTC', - symbolSwapKit: 'BTC', - networks: ['bip122:000000000019d6689c085ae165831e93'], - script_type: 'p2wpkh', //bech32 - available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], - type: 'zpub', - addressNList: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1], - addressNListMaster: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1, 0, 0], - curve: 'secp256k1', - showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it - }); - - paths.push({ - note: 'Bitcoin account 3 legacy', - blockchain: 'bitcoin', - symbol: 'BTC', - symbolSwapKit: 'BTC', - networks: ['bip122:000000000019d6689c085ae165831e93'], - script_type: 'p2pkh', - available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], - type: 'xpub', - addressNList: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 3], - addressNListMaster: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 3, 0, 0], - curve: 'secp256k1', - showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it - }); + // paths.push({ + // note: 'Bitcoin account 0 segwit (p2sh)', + // networks: ['bip122:000000000019d6689c085ae165831e93'], + // script_type: 'p2sh-p2wpkh', + // available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], + // type: 'xpub', + // addressNList: [0x80000000 + 49, 0x80000000 + 0, 0x80000000 + 0], + // addressNListMaster: [0x80000000 + 49, 0x80000000 + 0, 0x80000000 + 0, 0, 0], + // curve: 'secp256k1', + // showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it + // }); + // + // //add account1 + // paths.push({ + // note: 'Bitcoin account 0 Native Segwit (Bech32)', + // blockchain: 'bitcoin', + // symbol: 'BTC', + // symbolSwapKit: 'BTC', + // networks: ['bip122:000000000019d6689c085ae165831e93'], + // script_type: 'p2wpkh', //bech32 + // available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], + // type: 'zpub', + // addressNList: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1], + // addressNListMaster: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1, 0, 0], + // curve: 'secp256k1', + // showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it + // }); + // + // paths.push({ + // note: 'Bitcoin account 1 legacy', + // networks: ['bip122:000000000019d6689c085ae165831e93'], + // script_type: 'p2pkh', + // available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], + // type: 'xpub', + // addressNList: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 1], + // addressNListMaster: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 1, 0, 0], + // curve: 'secp256k1', + // showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it + // }); + // + // //add account1 + // paths.push({ + // note: 'Bitcoin account 1 Native Segwit (Bech32)', + // blockchain: 'bitcoin', + // symbol: 'BTC', + // symbolSwapKit: 'BTC', + // networks: ['bip122:000000000019d6689c085ae165831e93'], + // script_type: 'p2wpkh', //bech32 + // available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], + // type: 'zpub', + // addressNList: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1], + // addressNListMaster: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1, 0, 0], + // curve: 'secp256k1', + // showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it + // }); + // + // paths.push({ + // note: 'Bitcoin account 1 legacy', + // networks: ['bip122:000000000019d6689c085ae165831e93'], + // script_type: 'p2pkh', + // available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], + // type: 'xpub', + // addressNList: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 2], + // addressNListMaster: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 2, 0, 0], + // curve: 'secp256k1', + // showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it + // }); + // + // //add account3 + // paths.push({ + // note: 'Bitcoin account 1 Native Segwit (Bech32)', + // blockchain: 'bitcoin', + // symbol: 'BTC', + // symbolSwapKit: 'BTC', + // networks: ['bip122:000000000019d6689c085ae165831e93'], + // script_type: 'p2wpkh', //bech32 + // available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], + // type: 'zpub', + // addressNList: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1], + // addressNListMaster: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 1, 0, 0], + // curve: 'secp256k1', + // showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it + // }); + // + // paths.push({ + // note: 'Bitcoin account 3 legacy', + // blockchain: 'bitcoin', + // symbol: 'BTC', + // symbolSwapKit: 'BTC', + // networks: ['bip122:000000000019d6689c085ae165831e93'], + // script_type: 'p2pkh', + // available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'], + // type: 'xpub', + // addressNList: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 3], + // addressNListMaster: [0x80000000 + 44, 0x80000000 + 0, 0x80000000 + 3, 0, 0], + // curve: 'secp256k1', + // showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it + // }); // if(blockchains.includes('bip122:000000000019d6689c085ae165831e93')){ @@ -308,8 +308,6 @@ const test_service = async function (this: any) { // await app.getGasAssets() // await app.getPubkeys() // await app.getBalances() - - //clear cache // log.info(tag,"resultInit: ",resultInit) @@ -328,7 +326,6 @@ const test_service = async function (this: any) { } log.info(tag,' ****** Validated Assets for caips ******') - let pubkeys if(app.pubkeys.length === 0){ log.info(tag,'cache is empty refreshing... ') @@ -338,7 +335,6 @@ const test_service = async function (this: any) { log.info(tag,'cache found! ', pubkeys.length) } - log.info(tag,"pubkeys: ",pubkeys.length) assert(pubkeys) assert(pubkeys[0]) diff --git a/packages/pioneer/pioneer-react/CHANGELOG.md b/packages/pioneer/pioneer-react/CHANGELOG.md index a003937..112b1da 100644 --- a/packages/pioneer/pioneer-react/CHANGELOG.md +++ b/packages/pioneer/pioneer-react/CHANGELOG.md @@ -1,5 +1,48 @@ # @coinmasters/pioneer-react +## 0.8.26 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.26 + +## 0.8.25 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.25 + +## 0.8.24 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.24 + +## 0.8.23 + +### Patch Changes + +- bump + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.23 + +## 0.8.22 + +### Patch Changes + +- Updated dependencies []: + - @coinmasters/pioneer-sdk@4.8.22 + ## 0.8.21 ### Patch Changes diff --git a/packages/pioneer/pioneer-react/package.json b/packages/pioneer/pioneer-react/package.json index b22fb55..7a3771c 100644 --- a/packages/pioneer/pioneer-react/package.json +++ b/packages/pioneer/pioneer-react/package.json @@ -1,6 +1,6 @@ { "name": "@coinmasters/pioneer-react", - "version": "0.8.21", + "version": "0.8.26", "author": "swapkit-oss-team", "description": "Pioneer-sdk react provider", "devDependencies": { diff --git a/packages/pioneer/pioneer-sdk/CHANGELOG.md b/packages/pioneer/pioneer-sdk/CHANGELOG.md index 1f17a32..e0988f2 100644 --- a/packages/pioneer/pioneer-sdk/CHANGELOG.md +++ b/packages/pioneer/pioneer-sdk/CHANGELOG.md @@ -1,5 +1,35 @@ # @coinmasters/pioneer-sdk +## 4.8.26 + +### Patch Changes + +- bump + +## 4.8.25 + +### Patch Changes + +- bump + +## 4.8.24 + +### Patch Changes + +- bump + +## 4.8.23 + +### Patch Changes + +- bump + +## 4.8.22 + +### Patch Changes + +- bump + ## 4.8.21 ### Patch Changes diff --git a/packages/pioneer/pioneer-sdk/package.json b/packages/pioneer/pioneer-sdk/package.json index eddb34d..8bb0a66 100644 --- a/packages/pioneer/pioneer-sdk/package.json +++ b/packages/pioneer/pioneer-sdk/package.json @@ -1,7 +1,7 @@ { "author": "highlander", "name": "@coinmasters/pioneer-sdk", - "version": "4.8.21", + "version": "4.8.26", "dependencies": { "@coinmasters/api": "workspace:*", "@coinmasters/tokens": "workspace:*", diff --git a/packages/pioneer/pioneer-sdk/src/TransactionManager.ts b/packages/pioneer/pioneer-sdk/src/TransactionManager.ts index 6413528..f2630cf 100644 --- a/packages/pioneer/pioneer-sdk/src/TransactionManager.ts +++ b/packages/pioneer/pioneer-sdk/src/TransactionManager.ts @@ -261,7 +261,17 @@ export class TransactionManager { let responseSign = await this.keepKeySdk.xrp.xrpSignTransaction(unsignedTx); console.log(tag, 'responseSign: ', responseSign); if (typeof responseSign === 'string') responseSign = JSON.parse(responseSign); - signedTx = responseSign.serializedTx; + console.log(tag, 'responseSign.value: ', responseSign.value); + console.log(tag, 'responseSign.value.signatures: ', responseSign.value.signatures); + console.log(tag, 'responseSign.value.signatures: ', responseSign.value.signatures[0]); + console.log( + tag, + 'responseSign.value.signatures: ', + responseSign.value.signatures[0].serializedTx, + ); + + // Access serializedTx from signatures array + signedTx = responseSign.value.signatures[0].serializedTx; } else { throw new Error(`Unsupported OTHER CAIP: ${caip}`); } diff --git a/packages/pioneer/pioneer-sdk/src/txbuilder/createUnsignedRippleTx.ts b/packages/pioneer/pioneer-sdk/src/txbuilder/createUnsignedRippleTx.ts index cbd2691..859e5b0 100644 --- a/packages/pioneer/pioneer-sdk/src/txbuilder/createUnsignedRippleTx.ts +++ b/packages/pioneer/pioneer-sdk/src/txbuilder/createUnsignedRippleTx.ts @@ -50,9 +50,18 @@ export async function createUnsignedRippleTx( desttag = '0'; } - //format amount - amount = amount * 1000000; - amount = amount.toString(); + console.log(tag, 'amount:', amount); + if(isMax){ + //balance - 1 (min) - fee + amount = (Number(accountInfo.Balance) - 1000000) - 1; + amount = amount.toString() + } else { + //format amount + amount = amount * 1000000; + amount = amount.toString(); + } + + let tx = { type: 'auth/StdTx', diff --git a/packages/pioneer/pioneer-sdk/src/txbuilder/createUnsignedTendermintTx.ts b/packages/pioneer/pioneer-sdk/src/txbuilder/createUnsignedTendermintTx.ts index b242b1b..cde8aae 100644 --- a/packages/pioneer/pioneer-sdk/src/txbuilder/createUnsignedTendermintTx.ts +++ b/packages/pioneer/pioneer-sdk/src/txbuilder/createUnsignedTendermintTx.ts @@ -122,12 +122,13 @@ export async function createUnsignedTendermintTx( case 'cosmos:mayachain-mainnet-v1': { if (isMax) { - const fee = fees[networkId] * 1e6; // Convert fee to smallest unit - amount = Math.max(0, amount * 1e6 - fee); // Adjust amount for fees if isMax + const fee = Math.floor(fees[networkId] * 1e10); // Convert fee to smallest unit and floor to int + amount = Math.max(0, Math.floor(balanceInfo.data * 1e10) - fee); // Floor to ensure no decimals } else { - amount = amount * 1e4; // Convert amount to smallest unit + amount = Math.max(Math.floor(amount * 1e10), 0); // Floor the multiplication result } - asset = 'cacao'; + + console.log(tag, `amount: ${amount}, isMax: ${isMax}, fee: ${fees[networkId]}`) return to ? mayachainTransferTemplate({ account_number, @@ -143,7 +144,7 @@ export async function createUnsignedTendermintTx( }, from_address: fromAddress, to_address: to, - asset, + asset: 'MAYA.CACAO', amount: amount.toString(), memo, sequence, @@ -161,7 +162,7 @@ export async function createUnsignedTendermintTx( ], }, from_address: fromAddress, - asset, + asset: 'MAYA.CACAO', amount: amount.toString(), memo, sequence,