edge-currency-accountbased 4.25.2 → 4.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/android/src/main/assets/edge-currency-accountbased/4163.chunk.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/6845.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/8330.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/cardano.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/edge-currency-accountbased.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/ethereum.chunk.js +5 -5
- package/android/src/main/assets/edge-currency-accountbased/hedera.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/zcash.chunk.js +3 -3
- package/lib/cardano/CardanoEngine.js +43 -36
- package/lib/common/CurrencyEngine.js +1 -1
- package/lib/ethereum/EthereumNetwork.js +3 -2
- package/lib/ethereum/ethereumTypes.js +1 -0
- package/lib/ethereum/info/amoyInfo.js +1 -0
- package/lib/ethereum/info/arbitrumInfo.js +1 -0
- package/lib/ethereum/info/avalancheInfo.js +1 -0
- package/lib/ethereum/info/baseInfo.js +1 -0
- package/lib/ethereum/info/binancesmartchainInfo.js +1 -0
- package/lib/ethereum/info/bobevmInfo.js +1 -0
- package/lib/ethereum/info/celoInfo.js +1 -0
- package/lib/ethereum/info/ethDevInfo.js +1 -0
- package/lib/ethereum/info/ethereumInfo.js +1 -0
- package/lib/ethereum/info/ethereumclassicInfo.js +1 -0
- package/lib/ethereum/info/ethereumpowInfo.js +1 -0
- package/lib/ethereum/info/fantomInfo.js +1 -0
- package/lib/ethereum/info/filecoinFevmCalibrationInfo.js +1 -0
- package/lib/ethereum/info/filecoinFevmInfo.js +1 -0
- package/lib/ethereum/info/holeskyInfo.js +1 -0
- package/lib/ethereum/info/optimismInfo.js +1 -0
- package/lib/ethereum/info/polygonInfo.js +1 -0
- package/lib/ethereum/info/pulsechainInfo.js +1 -0
- package/lib/ethereum/info/rskInfo.js +1 -0
- package/lib/ethereum/info/sepoliaInfo.js +1 -0
- package/lib/ethereum/info/zksyncInfo.js +1 -0
- package/lib/hedera/HederaEngine.js +84 -42
- package/lib/hedera/hederaInfo.js +1 -1
- package/lib/piratechain/PiratechainEngine.js +26 -15
- package/lib/zcash/ZcashEngine.js +23 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 4.26.1 (2024-10-14)
|
|
6
|
+
|
|
7
|
+
- changed: (Zcash/Piratechain) Await synchronizer initialization in public methods instead of throwing `synchronizer undefined`error
|
|
8
|
+
- fixed: (Zcash/Piratechain) Don't save sensitive initializer object to engine
|
|
9
|
+
|
|
10
|
+
## 4.26.0 (2024-10-03)
|
|
11
|
+
|
|
12
|
+
- changed: Add redundancy to Cardano queries
|
|
13
|
+
- changed: Increase `MAX_TRANSACTIONS` to 2500.
|
|
14
|
+
- changed: (Hedera) Updated transaction query loop to account for mirror node limitations
|
|
15
|
+
- fixed: Correctly implement address query lookback times based on network block times.
|
|
16
|
+
- fixed: (AVAX) Increased query lookback for transaction history to 5 minutes to fix missing transaction confirmations.
|
|
17
|
+
- fixed: (Hedera) Initial sync ratio inaccuracy
|
|
18
|
+
|
|
5
19
|
## 4.25.2 (2024-09-30)
|
|
6
20
|
|
|
7
21
|
- fixed: (ALGO) Process unactivatedTokenIds routine immediately after activating a token to tighten race conditions
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[4163],{99649:function(j,k,u){"use strict";u.r(k),u.d(k,{PiratechainTools:function(){return A},makeCurrencyEngine:function(){return
|
|
2
|
-
${(0,v.T5)(t)}`)}catch(c){throw this.warn("FAILURE broadcastTx failed: ",c),c}return t})}getFreshAddress(){return h(this,null,function*(){const t=()=>h(this,null,function*(){
|
|
1
|
+
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[4163],{99649:function(j,k,u){"use strict";u.r(k),u.d(k,{PiratechainTools:function(){return A},makeCurrencyEngine:function(){return R},makeCurrencyTools:function(){return M},updateInfoPayload:function(){return $}});var y=u(66001),I=u(90749),D=u(48287),E=u(36856),b=u(96542),v=u(44276),g=u(62071),w=u(82671),P=u(65828),H=u(26277),z=Object.defineProperty,C=Object.getOwnPropertySymbols,B=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,x=Reflect.get,S=(s,t,e)=>t in s?z(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,K=(s,t)=>{for(var e in t||(t={}))N.call(t,e)&&S(s,e,t[e]);if(C)for(var e of C(t))O.call(t,e)&&S(s,e,t[e]);return s},m=(s,t,e)=>x(B(s),e,t),h=(s,t,e)=>new Promise((n,r)=>{var o=a=>{try{l(e.next(a))}catch(c){r(c)}},i=a=>{try{l(e.throw(a))}catch(c){r(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(o,i);l((e=e.apply(s,t)).next())});class p extends H.k{constructor(t,e,n,r,o){super(t,e,n,r);const{networkInfo:i}=t;this.pluginId=this.currencyInfo.pluginId,this.networkInfo=i,this.birthdayHeight=0,this.makeSynchronizer=o,this.synchronizerPromise=new Promise(l=>{this.synchronizerResolver=l}),this.queryMutex=!1,this.started=!1,this.progressRatio=0}setOtherData(t){this.otherData=(0,g.Gb)(t)}initData(){this.otherData.blockRange.first===0&&(this.otherData.blockRange={first:this.birthdayHeight,last:this.birthdayHeight}),this.initialNumBlocksToDownload=-1,this.synchronizerStatus="DISCONNECTED",this.availableZatoshi="0"}initSubscriptions(){this.synchronizer!=null&&(this.synchronizer.on("update",t=>h(this,null,function*(){const{lastDownloadedHeight:e,scanProgress:n,networkBlockHeight:r}=t;this.onUpdateBlockHeight(r),this.onUpdateProgress(e,n,r),yield this.queryAll()})),this.synchronizer.on("statusChanged",t=>h(this,null,function*(){this.synchronizerStatus=t.name,yield this.queryAll()})),this.synchronizer.on("error",t=>h(this,null,function*(){this.log.warn(`Synchronizer error: ${t.message}`),t.level==="critical"&&(yield this.killEngine(),this.lastUpdateFromSynchronizer=void 0,yield this.startEngine())})))}queryAll(){return h(this,null,function*(){if(this.lastUpdateFromSynchronizer=Date.now(),!this.queryMutex){this.queryMutex=!0;try{yield this.queryBalance(),yield this.queryTransactions(),this.onUpdateTransactions()}catch{}this.queryMutex=!1}})}onUpdateBlockHeight(t){this.walletLocalData.blockHeight!==t&&(this.walletLocalData.blockHeight=t,this.walletLocalDataDirty=!0,this.currencyEngineCallbacks.onBlockHeightChanged(this.walletLocalData.blockHeight))}onUpdateTransactions(){this.transactionsChangedArray.length>0&&(this.currencyEngineCallbacks.onTransactionsChanged(this.transactionsChangedArray),this.transactionsChangedArray=[])}onUpdateProgress(t,e,n){if(!this.addressesChecked&&!this.isSynced()){const r=e*.99,o=e*.8;this.tokenCheckBalanceStatus[this.currencyInfo.currencyCode]=r/100,this.tokenCheckTransactionsStatus[this.currencyInfo.currencyCode]=o/100;const i=(r+o)/2;i>this.progressRatio&&(this.progressRatio=i,this.log.warn(`Scan and download progress: ${Math.floor(i)}%`),this.updateOnAddressesChecked())}}startEngine(){return h(this,null,function*(){this.engineOn=!0,this.started=!0,yield m(p.prototype,this,"startEngine").call(this)})}isSynced(){return this.synchronizerStatus==="SYNCED"}queryBalance(){return h(this,null,function*(){if(!(!this.isSynced()||this.synchronizer==null))try{const t=yield this.synchronizer.getBalance();if(t.totalZatoshi==="-1")return;this.availableZatoshi=t.availableZatoshi,this.updateBalance(this.currencyInfo.currencyCode,t.totalZatoshi)}catch(t){this.warn("Failed to update balances",t),this.updateBalance(this.currencyInfo.currencyCode,"0")}})}queryTransactions(){return h(this,null,function*(){if(this.synchronizer!=null)try{let t=this.otherData.blockRange.first,e=this.otherData.blockRange.last;for(;this.isSynced()&&e<=this.walletLocalData.blockHeight;){if((yield this.synchronizer.getTransactions({first:t,last:e})).forEach(r=>this.processTransaction(r)),e===this.walletLocalData.blockHeight){t=this.walletLocalData.blockHeight,this.walletLocalDataDirty=!0,this.tokenCheckTransactionsStatus[this.currencyInfo.currencyCode]=1,this.updateOnAddressesChecked();break}t=e+1,e=e+this.networkInfo.transactionQueryLimit<this.walletLocalData.blockHeight?e+this.networkInfo.transactionQueryLimit:this.walletLocalData.blockHeight,this.otherData.blockRange={first:t,last:e},this.walletLocalDataDirty=!0}}catch(t){this.error(`Error querying ${this.currencyInfo.currencyCode} transactions `,t)}})}processTransaction(t){let e=t.value;const n=[];t.toAddress!=null?e=`-${(0,y.add)(e,this.networkInfo.defaultNetworkFee)}`:n.push(this.walletInfo.keys.publicKey);const r=t.memos.filter(i=>i!=="").map(i=>({memoName:"memo",type:"text",value:i})),o={blockHeight:t.minedHeight,currencyCode:this.currencyInfo.currencyCode,date:t.blockTimeInSeconds,isSend:e.startsWith("-"),memos:r,nativeAmount:e,networkFee:this.networkInfo.defaultNetworkFee,otherParams:{},ourReceiveAddresses:n,signedTx:"",tokenId:null,txid:t.rawTransactionId,walletId:this.walletId};this.addTransaction(this.currencyInfo.currencyCode,o)}syncNetwork(t){return h(this,null,function*(){if(!this.started)return 1e3;const e=(0,g.cl)(this.currencyInfo.pluginId)(t==null?void 0:t.privateKeys),{rpcNode:n}=this.networkInfo;this.birthdayHeight=e.birthdayHeight;try{this.synchronizerPromise=this.makeSynchronizer(K({mnemonicSeed:e.mnemonic,birthdayHeight:e.birthdayHeight,alias:P.xn.stringify(P.K3.parse(this.walletId))},n)),this.synchronizer=yield this.synchronizerPromise,this.synchronizerResolver(this.synchronizer)}catch(r){if(String(r)==="Invariant Violation: `new NativeEventEmitter()` requires a non-null argument.")this.log.warn("SDK not present");else throw r}return this.initData(),this.initSubscriptions(),yield new Promise(r=>{this.stopSyncing=r})})}killEngine(){return h(this,null,function*(){var t;this.synchronizerPromise=new Promise(e=>{this.synchronizerResolver=e}),this.started=!1,this.stopSyncing!=null&&(yield this.stopSyncing(1e3),this.stopSyncing=void 0),yield(t=this.synchronizer)==null?void 0:t.stop(),yield m(p.prototype,this,"killEngine").call(this)})}clearBlockchainCache(){return h(this,null,function*(){yield m(p.prototype,this,"clearBlockchainCache").call(this)})}resyncBlockchain(){return h(this,null,function*(){var t;yield m(p.prototype,this,"killEngine").call(this),yield this.clearBlockchainCache(),yield this.startEngine(),(t=this.synchronizer)==null||t.rescan().catch(e=>this.warn("resyncBlockchain failed: ",e)),this.initData(),this.progressRatio=0,this.synchronizerStatus="SYNCING"})}getMaxSpendable(){return h(this,null,function*(){const t=(0,y.sub)(this.availableZatoshi,this.networkInfo.defaultNetworkFee);if((0,y.lte)(t,"0"))throw new w.k5({tokenId:null});return t})}makeSpend(t){return h(this,null,function*(){var e;if(!this.isSynced())throw new Error("Cannot spend until wallet is synced");const{edgeSpendInfo:n,currencyCode:r}=this.makeSpendCheck(t),{memos:o=[],tokenId:i}=n,l=n.spendTargets[0],{publicAddress:a,nativeAmount:c}=l;if(a==null)throw new Error("makeSpend Missing publicAddress");if(c==null)throw new w.ef;if((0,y.eq)(c,"0"))throw new w.ef;const f=(0,y.add)(c,this.networkInfo.defaultNetworkFee);if((0,y.gt)(f,(e=this.walletLocalData.totalBalances[this.currencyInfo.currencyCode])!=null?e:"0"))throw new w.k5({tokenId:i});if((0,y.gt)(f,this.availableZatoshi))throw new w.k5({tokenId:i});const V=(0,y.mul)(f,"-1");return{blockHeight:0,currencyCode:r,date:0,isSend:!0,memos:o,nativeAmount:V,networkFee:this.networkInfo.defaultNetworkFee,ourReceiveAddresses:[],signedTx:"",tokenId:i,txid:"",walletId:this.walletId}})}signTx(t){return h(this,null,function*(){return t})}broadcastTx(t,e){return h(this,null,function*(){var n;const{memos:r}=t,o=(0,g.cl)(this.pluginId)(e==null?void 0:e.privateKeys);if(t.spendTargets==null||t.spendTargets.length!==1)throw new Error("Invalid spend targets");const i=((n=r[0])==null?void 0:n.type)==="text"?r[0].value:"",l=t.spendTargets[0],a={zatoshi:(0,y.sub)((0,y.abs)(t.nativeAmount),t.networkFee),toAddress:l.publicAddress,memo:i,mnemonicSeed:o.mnemonic};try{const f=yield(yield this.synchronizerPromise).sendToAddress(a);t.txid=f.txId,t.signedTx=f.raw,t.date=Date.now()/1e3,this.warn(`SUCCESS broadcastTx
|
|
2
|
+
${(0,v.T5)(t)}`)}catch(c){throw this.warn("FAILURE broadcastTx failed: ",c),c}return t})}getFreshAddress(){return h(this,null,function*(){const t=()=>h(this,null,function*(){const e=yield this.synchronizerPromise,{saplingAddress:n}=yield e.deriveUnifiedAddress();return this.otherData.cachedAddress=n,this.walletLocalDataDirty=!0,{publicAddress:n}});return this.otherData.cachedAddress==null?yield t():(t().catch(e=>{throw e}),{publicAddress:this.otherData.cachedAddress})})}}function R(s,t,e,n){return h(this,null,function*(){const r=(0,g.xH)(e),{makeSynchronizer:o}=s.nativeIo["edge-currency-accountbased"].piratechain,i=new p(s,t,r,n,o);return yield i.loadEngine(),i})}var T=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,F=(s,t)=>{var e={};for(var n in s)U.call(s,n)&&t.indexOf(n)<0&&(e[n]=s[n]);if(s!=null&&T)for(var n of T(s))t.indexOf(n)<0&&L.call(s,n)&&(e[n]=s[n]);return e},d=(s,t,e)=>new Promise((n,r)=>{var o=a=>{try{l(e.next(a))}catch(c){r(c)}},i=a=>{try{l(e.throw(a))}catch(c){r(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(o,i);l((e=e.apply(s,t)).next())});class A{constructor(t){const{builtinTokens:e,currencyInfo:n,io:r,networkInfo:o}=t;this.builtinTokens=e,this.currencyInfo=n,this.io=r,this.networkInfo=o;const i=t.nativeIo["edge-currency-accountbased"];if(i==null)throw new Error("Need opts");const{Tools:l}=i.piratechain;this.nativeTools=l}getDisplayPrivateKey(t){return d(this,null,function*(){const{pluginId:e}=this.currencyInfo,n=(0,g.cl)(e)(t.keys);return`Seed Phrase:
|
|
3
3
|
${n.mnemonic}
|
|
4
4
|
|
|
5
5
|
Birthday Height:
|
|
6
|
-
${n.birthdayHeight}`})}getDisplayPublicKey(t){return d(this,null,function*(){const{keys:e}=(0,
|
|
6
|
+
${n.birthdayHeight}`})}getDisplayPublicKey(t){return d(this,null,function*(){const{keys:e}=(0,g.xH)(t);return e.publicKey})}getNewWalletBirthdayBlockheight(){return d(this,null,function*(){return yield this.nativeTools.getBirthdayHeight(this.networkInfo.rpcNode.defaultHost,this.networkInfo.rpcNode.defaultPort)})}isValidAddress(t){return d(this,null,function*(){return yield this.nativeTools.isValidAddress(t)})}importPrivateKey(t){return d(this,arguments,function*(e,n={}){const{pluginId:r}=this.currencyInfo,o=(0,I.validateMnemonic)(e);if(e.split(" ").length!==24)throw new Error("Mnemonic must be 24 words");if(!o)throw new Error(`Invalid ${this.currencyInfo.currencyCode} mnemonic`);const i=yield this.getNewWalletBirthdayBlockheight();let l=i;const{birthdayHeight:a}=n;if(a!=null){(0,E.ym)(a);const c=parseInt(a);if(c>i)throw new Error("InvalidBirthdayHeight");l=c}return{[`${r}Mnemonic`]:e,[`${r}BirthdayHeight`]:l}})}createPrivateKey(t){return d(this,null,function*(){if(t!==this.currencyInfo.walletType)throw new Error("InvalidWalletType");const e=D.Buffer.from(this.io.random(32)).toString("hex"),n=(0,I.entropyToMnemonic)(e);return yield this.importPrivateKey(n)})}checkPublicKey(t){return d(this,null,function*(){try{return(0,g.QC)(t).publicKey.length>0}catch{return!1}})}derivePublicKey(t){return d(this,null,function*(){const{pluginId:e}=this.currencyInfo,n=(0,g.cl)(e)(t.keys);if(t.type!==this.currencyInfo.walletType)throw new Error("InvalidWalletType");const r=n.mnemonic;if(typeof r!="string")throw new Error("InvalidMnemonic");const o=yield this.nativeTools.deriveViewingKey(r,this.networkInfo.rpcNode.networkName);return{birthdayHeight:n.birthdayHeight,publicKey:o}})}parseUri(t,e,n){return d(this,null,function*(){const{pluginId:r}=this.currencyInfo,o={[r]:!0},{edgeParsedUri:i,edgeParsedUri:{publicAddress:l}}=yield(0,b.x)({currencyInfo:this.currencyInfo,uri:t,networks:o,builtinTokens:this.builtinTokens,currencyCode:e!=null?e:this.currencyInfo.currencyCode,customTokens:n});if(l==null||!(yield this.isValidAddress(l)))throw new Error("InvalidPublicAddressError");return i})}encodeUri(t){return d(this,arguments,function*(e,n=[]){const{pluginId:r}=this.currencyInfo,{nativeAmount:o,currencyCode:i,publicAddress:l}=e;if(!(yield this.isValidAddress(l)))throw new Error("InvalidPublicAddressError");let a;if(o!=null){const f=(0,v.FQ)(i!=null?i:this.currencyInfo.currencyCode,this.currencyInfo,n,this.builtinTokens);if(f==null)throw new Error("InternalErrorInvalidCurrencyCode");a=(0,y.div)(o,f.multiplier,18)}return(0,b.m)(e,`${r}`,a)})}}function M(s){return d(this,null,function*(){return new A(s)})}function $(s,t){return d(this,null,function*(){const e=F(t,[]);s.networkInfo=(0,v.wy)(s.networkInfo,e)})}},15340:function(){},79838:function(){}}]);
|