@rango-dev/provider-vultisig 0.5.2-next.0 → 0.5.2-next.2

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/dist/mod.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- declare const versions: () => readonly [readonly ["1.0.0", import("@hub3js/core").Provider<Record<"utxo", import("@hub3js/bip122").UtxoActions>>]];
2
- export { versions };
1
+ export { buildProvider } from './provider.js';
3
2
  export { WALLET_ID } from './constants.js';
4
3
  //# sourceMappingURL=mod.d.ts.map
package/dist/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,QAAQ,4HAC8C,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/mod.js CHANGED
@@ -1,2 +1,2 @@
1
- var w=Object.defineProperty;var e=(t,o)=>w(t,"name",{value:o,configurable:!0});var n=(t,o)=>()=>(t&&(o=t(t=0)),o);var B=(t,o)=>{for(var s in o)w(t,s,{get:o[s],enumerable:!0})};import{UTXO_NAMESPACE as y}from"@hub3js/namespaces";function d(){let{vultisig:t}=window;if(!t)return null;let o=new Map;return t.zcash&&o.set(y,t.zcash),o}function c(){let o=d()?.get(y);if(!o)throw new Error("Vultisig not injected. Please check your wallet.");return o}async function C(){return c().requestAccounts()}async function a(){return c().request({method:"get_accounts"})}var m=n(()=>{"use strict";e(d,"vultisig");e(c,"vultisigZcash");e(C,"requestZcashAccounts");e(a,"getZcashAccounts")});import{CAIP_ZCASH_CHAIN_ID as N,utils as R}from"@hub3js/bip122";function k(){return async()=>{let t=await C();return R.formatAccountsToCAIP(t,N)}}function q(){return async()=>(await a().catch(()=>[])).length>0}var l,v=n(()=>{"use strict";m();e(k,"connect");e(q,"canEagerConnect");l={connect:k,canEagerConnect:q}});import{builders as E}from"@hub3js/bip122";import{NamespaceBuilder as F}from"@hub3js/core";import*as S from"@hub3js/std/builders";import{standardizeAndThrowError as H}from"@hub3js/std/operators";var M,V,O,u,f=n(()=>{"use strict";v();p();M=E.connect().action(l.connect()).or(H).build(),V=E.canEagerConnect().action(l.canEagerConnect()).build(),O=S.disconnect().build(),u=new F("UTXO",i).action(M).action(O).action(V).build()});import{isZcashBlockchain as X}from"@rango-dev/internal-blockchains";import{SignerError as h,SignerErrorCode as b}from"rango-types";var g,T=n(()=>{"use strict";m();g=class{static{e(this,"Signer")}async signMessage(){throw h.UnimplementedError("signMessage")}async signAndSendTx(o){let{memo:s,fromWalletAddress:x,recipientAddress:j,amount:D,asset:L}=o;if(!X(L.blockchain))throw new Error(`You can not sign ${o.blockChain} using ZCash signer.`);let W=await a();if(x!==W[0])throw new Error("fromWalletAddress is not matched with the connected account");try{let r={method:"send_transaction",params:[{from:x,to:j,value:D,memo:s}]};return{hash:await c().request(r)}}catch(r){throw typeof r=="string"?new h(b.UNEXPECTED_BEHAVIOUR,r,void 0):new h(b.SEND_TX_ERROR,void 0,r)}}}});var P={};B(P,{Signer:()=>g,namespace:()=>u});var _=n(()=>{"use strict";f();T()});import{DefaultSignerFactory as z,TransactionType as G}from"rango-types";async function A(){let{Signer:t}=await Promise.resolve().then(()=>(_(),P)),o=new z;return o.registerSigner(G.TRANSFER,new t),o}var Z=n(()=>{"use strict";e(A,"getSigners")});import{CAIP_ZCASH_CHAIN_ID as Y,isChainSupported as $}from"@hub3js/bip122";var i,I,p=n(()=>{"use strict";Z();i="vultisig",I={name:"Vultisig",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/vultisig/icon.svg",extensions:{chrome:"https://chromewebstore.google.com/detail/vultisig-extension/ggafhcdaplkhmmnlbfjpnnkepdfjaelb",homepage:"https://vultisig.com/"},properties:[{name:"namespaces",value:{selection:"multiple",data:[{label:"Zcash",value:"UTXO",id:"ZCASH",isChainSupported:$([Y])}]}},{name:"signers",value:{getSigners:async()=>A()}}]}});import{defineVersions as K}from"@hub3js/core/utils";p();f();m();import{ProviderBuilder as J}from"@hub3js/core";var U=e(()=>new J(i).init(function(t){let[,o]=t.state();d()&&(o("installed",!0),console.debug("[vultisig] instance detected.",t))}).config("metadata",I).add("utxo",u).build(),"buildProvider");p();var Wt=e(()=>K().version("1.0.0",U()).build(),"versions");export{i as WALLET_ID,Wt as versions};
1
+ var w=Object.defineProperty;var o=(t,e)=>w(t,"name",{value:e,configurable:!0});var n=(t,e)=>()=>(t&&(e=t(t=0)),e);var W=(t,e)=>{for(var s in e)w(t,s,{get:e[s],enumerable:!0})};import{UTXO_NAMESPACE as y}from"@hub3js/namespaces";function d(){let{vultisig:t}=window;if(!t)return null;let e=new Map;return t.zcash&&e.set(y,t.zcash),e}function c(){let e=d()?.get(y);if(!e)throw new Error("Vultisig not injected. Please check your wallet.");return e}async function C(){return c().requestAccounts()}async function a(){return c().request({method:"get_accounts"})}var m=n(()=>{"use strict";o(d,"vultisig");o(c,"vultisigZcash");o(C,"requestZcashAccounts");o(a,"getZcashAccounts")});import{CAIP_ZCASH_CHAIN_ID as B,utils as N}from"@hub3js/bip122";function R(){return async()=>{let t=await C();return N.formatAccountsToCAIP(t,B)}}function k(){return async()=>(await a().catch(()=>[])).length>0}var l,E=n(()=>{"use strict";m();o(R,"connect");o(k,"canEagerConnect");l={connect:R,canEagerConnect:k}});import{builders as S}from"@hub3js/bip122";import{NamespaceBuilder as q}from"@hub3js/core";import*as v from"@hub3js/std/builders";import{standardizeAndThrowError as F}from"@hub3js/std/operators";var H,M,O,u,f=n(()=>{"use strict";E();p();H=S.connect().action(l.connect()).or(F).build(),M=S.canEagerConnect().action(l.canEagerConnect()).build(),O=v.disconnect().build(),u=new q("UTXO",i).action(H).action(O).action(M).build()});import{isZcashBlockchain as V}from"@rango-dev/internal-blockchains";import{SignerError as h,SignerErrorCode as b}from"rango-types";var g,T=n(()=>{"use strict";m();g=class{static{o(this,"Signer")}async signMessage(){throw h.UnimplementedError("signMessage")}async signAndSendTx(e){let{memo:s,fromWalletAddress:x,recipientAddress:U,amount:j,asset:D}=e;if(!V(D.blockchain))throw new Error(`You can not sign ${e.blockChain} using ZCash signer.`);let L=await a();if(x!==L[0])throw new Error("fromWalletAddress is not matched with the connected account");try{let r={method:"send_transaction",params:[{from:x,to:U,value:j,memo:s}]};return{hash:await c().request(r)}}catch(r){throw typeof r=="string"?new h(b.UNEXPECTED_BEHAVIOUR,r,void 0):new h(b.SEND_TX_ERROR,void 0,r)}}}});var P={};W(P,{Signer:()=>g,namespace:()=>u});var _=n(()=>{"use strict";f();T()});import{DefaultSignerFactory as X,TransactionType as z}from"rango-types";async function A(){let{Signer:t}=await Promise.resolve().then(()=>(_(),P)),e=new X;return e.registerSigner(z.TRANSFER,new t),e}var Z=n(()=>{"use strict";o(A,"getSigners")});import{CAIP_ZCASH_CHAIN_ID as G,isChainSupported as Y}from"@hub3js/bip122";var i,I,p=n(()=>{"use strict";Z();i="vultisig",I={name:"Vultisig",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/vultisig/icon.svg",extensions:{chrome:"https://chromewebstore.google.com/detail/vultisig-extension/ggafhcdaplkhmmnlbfjpnnkepdfjaelb",homepage:"https://vultisig.com/"},properties:[{name:"namespaces",value:{selection:"multiple",data:[{label:"Zcash",value:"UTXO",id:"ZCASH",isChainSupported:Y([G])}]}},{name:"signers",value:{getSigners:async()=>A()}}]}});p();f();m();import{ProviderBuilder as $}from"@hub3js/core";var J=o(()=>new $(i).init(function(t){let[,e]=t.state();d()&&(e("installed",!0),console.debug("[vultisig] instance detected.",t))}).config("metadata",I).add("utxo",u).build(),"buildProvider");p();export{i as WALLET_ID,J as buildProvider};
2
2
  //# sourceMappingURL=mod.js.map
package/dist/mod.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/utils.ts", "../src/actions/utxo.ts", "../src/namespaces/utxo/namespace.ts", "../src/namespaces/utxo/singer.ts", "../src/namespaces/utxo/mod.ts", "../src/signer.ts", "../src/constants.ts", "../src/mod.ts", "../src/provider.ts"],
4
- "sourcesContent": ["import type { Provider, VultisigZcashProviderApi } from './types.js';\n\nimport { UTXO_NAMESPACE } from '@hub3js/namespaces';\n\nexport function vultisig(): Provider | null {\n const { vultisig } = window;\n if (!vultisig) {\n return null;\n }\n\n const instances: Provider = new Map();\n\n if (vultisig.zcash) {\n instances.set(UTXO_NAMESPACE, vultisig.zcash);\n }\n\n return instances;\n}\n\nexport function vultisigZcash(): VultisigZcashProviderApi {\n const instances = vultisig();\n const zcashInstance = instances?.get(UTXO_NAMESPACE);\n\n if (!zcashInstance) {\n throw new Error('Vultisig not injected. Please check your wallet.');\n }\n\n return zcashInstance;\n}\n\nexport async function requestZcashAccounts(): Promise<string[]> {\n return vultisigZcash().requestAccounts();\n}\n\n// `get_accounts` is the silent variant \u2014 it never opens the wallet.\nexport async function getZcashAccounts(): Promise<string[]> {\n return vultisigZcash().request({ method: 'get_accounts' });\n}\n", "import type { UtxoActions } from '@hub3js/bip122';\nimport type {\n CanEagerConnect,\n Context,\n FunctionWithContext,\n} from '@hub3js/core';\n\nimport { CAIP_ZCASH_CHAIN_ID, utils } from '@hub3js/bip122';\n\nimport { getZcashAccounts, requestZcashAccounts } from '../utils.js';\n\nexport function connect(): FunctionWithContext<\n UtxoActions['connect'],\n Context\n> {\n return async () => {\n const accounts = await requestZcashAccounts();\n\n return utils.formatAccountsToCAIP(accounts, CAIP_ZCASH_CHAIN_ID);\n };\n}\n\nexport function canEagerConnect(): CanEagerConnect<UtxoActions> {\n return async () => {\n const accounts = await getZcashAccounts().catch(() => []);\n return accounts.length > 0;\n };\n}\n\nexport const utxoActions = { connect, canEagerConnect };\n", "import type { UtxoActions } from '@hub3js/bip122';\n\nimport { builders } from '@hub3js/bip122';\nimport { NamespaceBuilder } from '@hub3js/core';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { utxoActions } from '../../actions/utxo.js';\nimport { WALLET_ID } from '../../constants.js';\n\nconst connect = builders\n .connect()\n .action(utxoActions.connect())\n .or(standardizeAndThrowError)\n .build();\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(utxoActions.canEagerConnect())\n .build();\n\nconst disconnect = commonBuilders.disconnect<UtxoActions>().build();\n\nexport const namespace = new NamespaceBuilder<UtxoActions>('UTXO', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n", "import type { SendTransactionArgs } from '../../types.js';\nimport type { Transfer } from 'rango-types/mainApi';\n\nimport { isZcashBlockchain } from '@rango-dev/internal-blockchains';\nimport { type GenericSigner, SignerError, SignerErrorCode } from 'rango-types';\n\nimport { getZcashAccounts, vultisigZcash } from '../../utils.js';\n\nexport class Signer implements GenericSigner<Transfer> {\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: Transfer): Promise<{ hash: string }> {\n const { memo, fromWalletAddress, recipientAddress, amount, asset } = tx;\n\n // TODO: check should be performed on the blockchain field of transaction instead of asset, but currently it is not available in the transaction object\n if (!isZcashBlockchain(asset.blockchain)) {\n throw new Error(`You can not sign ${tx.blockChain} using ZCash signer.`);\n }\n\n const accounts = await getZcashAccounts();\n\n if (fromWalletAddress !== accounts[0]) {\n throw new Error(\n 'fromWalletAddress is not matched with the connected account'\n );\n }\n\n try {\n const transactionRequest: SendTransactionArgs = {\n method: 'send_transaction',\n params: [\n {\n from: fromWalletAddress,\n to: recipientAddress,\n value: amount,\n memo,\n },\n ],\n };\n\n const response = await vultisigZcash().request(transactionRequest);\n return { hash: response };\n } catch (error) {\n if (typeof error === 'string') {\n throw new SignerError(\n SignerErrorCode.UNEXPECTED_BEHAVIOUR,\n error,\n undefined\n );\n }\n throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, error);\n }\n }\n}\n", "export { namespace } from './namespace.js';\nexport { Signer } from './singer.js';\n", "import type { SignerFactory } from 'rango-types';\n\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default async function getSigners(): Promise<SignerFactory> {\n const { Signer: UtxoSigner } = await import('./namespaces/utxo/mod.js');\n const signers = new DefaultSignerFactory();\n\n signers.registerSigner(TxType.TRANSFER, new UtxoSigner());\n return signers;\n}\n", "import type { ProviderMetadata } from '@hub3js/core';\n\nimport {\n CAIP_ZCASH_CHAIN_ID,\n isChainSupported as isBip122ChainSupported,\n} from '@hub3js/bip122';\n\nimport getSigners from './signer.js';\n\nexport const WALLET_ID = 'vultisig';\n\nexport const info: ProviderMetadata = {\n name: 'Vultisig',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/vultisig/icon.svg',\n extensions: {\n chrome:\n 'https://chromewebstore.google.com/detail/vultisig-extension/ggafhcdaplkhmmnlbfjpnnkepdfjaelb',\n homepage: 'https://vultisig.com/',\n },\n properties: [\n {\n name: 'namespaces',\n value: {\n selection: 'multiple',\n data: [\n {\n label: 'Zcash',\n value: 'UTXO',\n id: 'ZCASH',\n isChainSupported: isBip122ChainSupported([CAIP_ZCASH_CHAIN_ID]),\n },\n ],\n },\n },\n {\n name: 'signers',\n value: { getSigners: async () => getSigners() },\n },\n ],\n};\n", "import { defineVersions } from '@hub3js/core/utils';\n\nimport { buildProvider } from './provider.js';\n\nconst versions = () =>\n defineVersions().version('1.0.0', buildProvider()).build();\n\nexport { versions };\nexport { WALLET_ID } from './constants.js';\n", "import { ProviderBuilder } from '@hub3js/core';\n\nimport { info, WALLET_ID } from './constants.js';\nimport { namespace as utxo } from './namespaces/utxo/namespace.js';\nimport { vultisig } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n if (vultisig()) {\n setState('installed', true);\n console.debug('[vultisig] instance detected.', context);\n }\n })\n .config('metadata', info)\n .add('utxo', utxo)\n .build();\n\nexport { buildProvider };\n"],
5
- "mappings": "gLAEA,OAAS,kBAAAA,MAAsB,qBAExB,SAASC,GAA4B,CAC1C,GAAM,CAAE,SAAAA,CAAS,EAAI,OACrB,GAAI,CAACA,EACH,OAAO,KAGT,IAAMC,EAAsB,IAAI,IAEhC,OAAID,EAAS,OACXC,EAAU,IAAIF,EAAgBC,EAAS,KAAK,EAGvCC,CACT,CAEO,SAASC,GAA0C,CAExD,IAAMC,EADYH,EAAS,GACM,IAAID,CAAc,EAEnD,GAAI,CAACI,EACH,MAAM,IAAI,MAAM,kDAAkD,EAGpE,OAAOA,CACT,CAEA,eAAsBC,GAA0C,CAC9D,OAAOF,EAAc,EAAE,gBAAgB,CACzC,CAGA,eAAsBG,GAAsC,CAC1D,OAAOH,EAAc,EAAE,QAAQ,CAAE,OAAQ,cAAe,CAAC,CAC3D,CArCA,IAAAI,EAAAC,EAAA,kBAIgBC,EAAAR,EAAA,YAeAQ,EAAAN,EAAA,iBAWMM,EAAAJ,EAAA,wBAKAI,EAAAH,EAAA,sBC5BtB,OAAS,uBAAAI,EAAqB,SAAAC,MAAa,iBAIpC,SAASC,GAGd,CACA,MAAO,UAAY,CACjB,IAAMC,EAAW,MAAMC,EAAqB,EAE5C,OAAOH,EAAM,qBAAqBE,EAAUH,CAAmB,CACjE,CACF,CAEO,SAASK,GAAgD,CAC9D,MAAO,WACY,MAAMC,EAAiB,EAAE,MAAM,IAAM,CAAC,CAAC,GACxC,OAAS,CAE7B,CA3BA,IA6BaC,EA7BbC,EAAAC,EAAA,kBASAC,IAEgBC,EAAAT,EAAA,WAWAS,EAAAN,EAAA,mBAOHE,EAAc,CAAE,QAAAL,EAAS,gBAAAG,CAAgB,IC3BtD,OAAS,YAAAO,MAAgB,iBACzB,OAAS,oBAAAC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BC,IAJA,IAAMC,GAAWC,EAAA,IACfC,EAAe,EAAE,QAAQ,QAASC,EAAc,CAAC,EAAE,MAAM,EAD1C",
6
- "names": ["UTXO_NAMESPACE", "vultisig", "instances", "vultisigZcash", "zcashInstance", "requestZcashAccounts", "getZcashAccounts", "init_utils", "__esmMin", "__name", "CAIP_ZCASH_CHAIN_ID", "utils", "connect", "accounts", "requestZcashAccounts", "canEagerConnect", "getZcashAccounts", "utxoActions", "init_utxo", "__esmMin", "init_utils", "__name", "builders", "NamespaceBuilder", "commonBuilders", "standardizeAndThrowError", "connect", "canEagerConnect", "disconnect", "namespace", "init_namespace", "__esmMin", "init_utxo", "init_constants", "utxoActions", "WALLET_ID", "isZcashBlockchain", "SignerError", "SignerErrorCode", "Signer", "init_singer", "__esmMin", "init_utils", "__name", "tx", "memo", "fromWalletAddress", "recipientAddress", "amount", "asset", "accounts", "getZcashAccounts", "transactionRequest", "vultisigZcash", "error", "mod_exports", "__export", "Signer", "namespace", "init_mod", "__esmMin", "init_namespace", "init_singer", "DefaultSignerFactory", "TxType", "getSigners", "UtxoSigner", "signers", "init_signer", "__esmMin", "__name", "CAIP_ZCASH_CHAIN_ID", "isBip122ChainSupported", "WALLET_ID", "info", "init_constants", "__esmMin", "init_signer", "getSigners", "defineVersions", "init_constants", "init_namespace", "init_utils", "ProviderBuilder", "buildProvider", "__name", "ProviderBuilder", "WALLET_ID", "context", "setState", "vultisig", "info", "namespace", "init_constants", "versions", "__name", "defineVersions", "buildProvider"]
3
+ "sources": ["../src/utils.ts", "../src/actions/utxo.ts", "../src/namespaces/utxo/namespace.ts", "../src/namespaces/utxo/singer.ts", "../src/namespaces/utxo/mod.ts", "../src/signer.ts", "../src/constants.ts", "../src/provider.ts", "../src/mod.ts"],
4
+ "sourcesContent": ["import type { Provider, VultisigZcashProviderApi } from './types.js';\n\nimport { UTXO_NAMESPACE } from '@hub3js/namespaces';\n\nexport function vultisig(): Provider | null {\n const { vultisig } = window;\n if (!vultisig) {\n return null;\n }\n\n const instances: Provider = new Map();\n\n if (vultisig.zcash) {\n instances.set(UTXO_NAMESPACE, vultisig.zcash);\n }\n\n return instances;\n}\n\nexport function vultisigZcash(): VultisigZcashProviderApi {\n const instances = vultisig();\n const zcashInstance = instances?.get(UTXO_NAMESPACE);\n\n if (!zcashInstance) {\n throw new Error('Vultisig not injected. Please check your wallet.');\n }\n\n return zcashInstance;\n}\n\nexport async function requestZcashAccounts(): Promise<string[]> {\n return vultisigZcash().requestAccounts();\n}\n\n// `get_accounts` is the silent variant \u2014 it never opens the wallet.\nexport async function getZcashAccounts(): Promise<string[]> {\n return vultisigZcash().request({ method: 'get_accounts' });\n}\n", "import type { UtxoActions } from '@hub3js/bip122';\nimport type {\n CanEagerConnect,\n Context,\n FunctionWithContext,\n} from '@hub3js/core';\n\nimport { CAIP_ZCASH_CHAIN_ID, utils } from '@hub3js/bip122';\n\nimport { getZcashAccounts, requestZcashAccounts } from '../utils.js';\n\nexport function connect(): FunctionWithContext<\n UtxoActions['connect'],\n Context\n> {\n return async () => {\n const accounts = await requestZcashAccounts();\n\n return utils.formatAccountsToCAIP(accounts, CAIP_ZCASH_CHAIN_ID);\n };\n}\n\nexport function canEagerConnect(): CanEagerConnect<UtxoActions> {\n return async () => {\n const accounts = await getZcashAccounts().catch(() => []);\n return accounts.length > 0;\n };\n}\n\nexport const utxoActions = { connect, canEagerConnect };\n", "import type { UtxoActions } from '@hub3js/bip122';\n\nimport { builders } from '@hub3js/bip122';\nimport { NamespaceBuilder } from '@hub3js/core';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { utxoActions } from '../../actions/utxo.js';\nimport { WALLET_ID } from '../../constants.js';\n\nconst connect = builders\n .connect()\n .action(utxoActions.connect())\n .or(standardizeAndThrowError)\n .build();\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(utxoActions.canEagerConnect())\n .build();\n\nconst disconnect = commonBuilders.disconnect<UtxoActions>().build();\n\nexport const namespace = new NamespaceBuilder<UtxoActions>('UTXO', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n", "import type { SendTransactionArgs } from '../../types.js';\nimport type { Transfer } from 'rango-types/mainApi';\n\nimport { isZcashBlockchain } from '@rango-dev/internal-blockchains';\nimport { type GenericSigner, SignerError, SignerErrorCode } from 'rango-types';\n\nimport { getZcashAccounts, vultisigZcash } from '../../utils.js';\n\nexport class Signer implements GenericSigner<Transfer> {\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: Transfer): Promise<{ hash: string }> {\n const { memo, fromWalletAddress, recipientAddress, amount, asset } = tx;\n\n // TODO: check should be performed on the blockchain field of transaction instead of asset, but currently it is not available in the transaction object\n if (!isZcashBlockchain(asset.blockchain)) {\n throw new Error(`You can not sign ${tx.blockChain} using ZCash signer.`);\n }\n\n const accounts = await getZcashAccounts();\n\n if (fromWalletAddress !== accounts[0]) {\n throw new Error(\n 'fromWalletAddress is not matched with the connected account'\n );\n }\n\n try {\n const transactionRequest: SendTransactionArgs = {\n method: 'send_transaction',\n params: [\n {\n from: fromWalletAddress,\n to: recipientAddress,\n value: amount,\n memo,\n },\n ],\n };\n\n const response = await vultisigZcash().request(transactionRequest);\n return { hash: response };\n } catch (error) {\n if (typeof error === 'string') {\n throw new SignerError(\n SignerErrorCode.UNEXPECTED_BEHAVIOUR,\n error,\n undefined\n );\n }\n throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, error);\n }\n }\n}\n", "export { namespace } from './namespace.js';\nexport { Signer } from './singer.js';\n", "import type { SignerFactory } from 'rango-types';\n\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default async function getSigners(): Promise<SignerFactory> {\n const { Signer: UtxoSigner } = await import('./namespaces/utxo/mod.js');\n const signers = new DefaultSignerFactory();\n\n signers.registerSigner(TxType.TRANSFER, new UtxoSigner());\n return signers;\n}\n", "import type { ProviderMetadata } from '@hub3js/core';\n\nimport {\n CAIP_ZCASH_CHAIN_ID,\n isChainSupported as isBip122ChainSupported,\n} from '@hub3js/bip122';\n\nimport getSigners from './signer.js';\n\nexport const WALLET_ID = 'vultisig';\n\nexport const info: ProviderMetadata = {\n name: 'Vultisig',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/vultisig/icon.svg',\n extensions: {\n chrome:\n 'https://chromewebstore.google.com/detail/vultisig-extension/ggafhcdaplkhmmnlbfjpnnkepdfjaelb',\n homepage: 'https://vultisig.com/',\n },\n properties: [\n {\n name: 'namespaces',\n value: {\n selection: 'multiple',\n data: [\n {\n label: 'Zcash',\n value: 'UTXO',\n id: 'ZCASH',\n isChainSupported: isBip122ChainSupported([CAIP_ZCASH_CHAIN_ID]),\n },\n ],\n },\n },\n {\n name: 'signers',\n value: { getSigners: async () => getSigners() },\n },\n ],\n};\n", "import { ProviderBuilder } from '@hub3js/core';\n\nimport { info, WALLET_ID } from './constants.js';\nimport { namespace as utxo } from './namespaces/utxo/namespace.js';\nimport { vultisig } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n if (vultisig()) {\n setState('installed', true);\n console.debug('[vultisig] instance detected.', context);\n }\n })\n .config('metadata', info)\n .add('utxo', utxo)\n .build();\n\nexport { buildProvider };\n", "export { buildProvider } from './provider.js';\nexport { WALLET_ID } from './constants.js';\n"],
5
+ "mappings": "gLAEA,OAAS,kBAAAA,MAAsB,qBAExB,SAASC,GAA4B,CAC1C,GAAM,CAAE,SAAAA,CAAS,EAAI,OACrB,GAAI,CAACA,EACH,OAAO,KAGT,IAAMC,EAAsB,IAAI,IAEhC,OAAID,EAAS,OACXC,EAAU,IAAIF,EAAgBC,EAAS,KAAK,EAGvCC,CACT,CAEO,SAASC,GAA0C,CAExD,IAAMC,EADYH,EAAS,GACM,IAAID,CAAc,EAEnD,GAAI,CAACI,EACH,MAAM,IAAI,MAAM,k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,iBALP,IASaC,EAEAC,EAXbC,EAAAC,EAAA,kBAOAC,IAEaJ,EAAY,WAEZC,EAAyB,CACpC,KAAM,WACN,KAAM,yFACN,WAAY,CACV,OACE,+FACF,SAAU,uBACZ,EACA,WAAY,CACV,CACE,KAAM,aACN,MAAO,CACL,UAAW,WACX,KAAM,CACJ,CACE,MAAO,QACP,MAAO,OACP,GAAI,QACJ,iBAAkBF,EAAuB,CAACD,CAAmB,CAAC,CAChE,CACF,CACF,CACF,EACA,CACE,KAAM,UACN,MAAO,CAAE,WAAY,SAAYO,EAAW,CAAE,CAChD,CACF,CACF,ICrCAC,IACAC,IACAC,IAJA,OAAS,mBAAAC,MAAuB,eAMhC,IAAMC,EAAgBC,EAAA,IACpB,IAAIC,EAAgBC,CAAS,EAC1B,KAAK,SAAUC,EAAS,CACvB,GAAM,CAAC,CAAEC,CAAQ,EAAID,EAAQ,MAAM,EAC/BE,EAAS,IACXD,EAAS,YAAa,EAAI,EAC1B,QAAQ,MAAM,gCAAiCD,CAAO,EAE1D,CAAC,EACA,OAAO,WAAYG,CAAI,EACvB,IAAI,OAAQC,CAAI,EAChB,MAAM,EAXW,iBCLtBC",
6
+ "names": ["UTXO_NAMESPACE", "vultisig", "instances", "vultisigZcash", "zcashInstance", "requestZcashAccounts", "getZcashAccounts", "init_utils", "__esmMin", "__name", "CAIP_ZCASH_CHAIN_ID", "utils", "connect", "accounts", "requestZcashAccounts", "canEagerConnect", "getZcashAccounts", "utxoActions", "init_utxo", "__esmMin", "init_utils", "__name", "builders", "NamespaceBuilder", "commonBuilders", "standardizeAndThrowError", "connect", "canEagerConnect", "disconnect", "namespace", "init_namespace", "__esmMin", "init_utxo", "init_constants", "utxoActions", "WALLET_ID", "isZcashBlockchain", "SignerError", "SignerErrorCode", "Signer", "init_singer", "__esmMin", "init_utils", "__name", "tx", "memo", "fromWalletAddress", "recipientAddress", "amount", "asset", "accounts", "getZcashAccounts", "transactionRequest", "vultisigZcash", "error", "mod_exports", "__export", "Signer", "namespace", "init_mod", "__esmMin", "init_namespace", "init_singer", "DefaultSignerFactory", "TxType", "getSigners", "UtxoSigner", "signers", "init_signer", "__esmMin", "__name", "CAIP_ZCASH_CHAIN_ID", "isBip122ChainSupported", "WALLET_ID", "info", "init_constants", "__esmMin", "init_signer", "getSigners", "init_constants", "init_namespace", "init_utils", "ProviderBuilder", "buildProvider", "__name", "ProviderBuilder", "WALLET_ID", "context", "setState", "vultisig", "info", "namespace", "init_constants"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/provider-vultisig",
3
- "version": "0.5.2-next.0",
3
+ "version": "0.5.2-next.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/mod.ts",
@@ -22,13 +22,13 @@
22
22
  "lint": "eslint \"**/*.{ts,tsx}\""
23
23
  },
24
24
  "dependencies": {
25
- "@hub3js/bip122": "^0.2.1",
26
- "@hub3js/core": "^0.62.0",
27
- "@hub3js/namespaces": "^0.5.1",
28
- "@hub3js/std": "^0.4.0",
29
- "@rango-dev/internal-blockchains": "^0.2.2-next.0",
30
- "@rango-dev/wallets-core": "^0.62.2-next.0",
31
- "rango-types": "^0.5.0"
25
+ "@hub3js/bip122": "^0.3.0",
26
+ "@hub3js/core": "^0.63.0",
27
+ "@hub3js/namespaces": "^0.6.0",
28
+ "@hub3js/std": "^0.5.0",
29
+ "@rango-dev/internal-blockchains": "^0.2.2-next.1",
30
+ "@rango-dev/wallets-core": "^0.62.2-next.1",
31
+ "rango-types": "^0.6.0"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
package/src/mod.ts CHANGED
@@ -1,9 +1,2 @@
1
- import { defineVersions } from '@hub3js/core/utils';
2
-
3
- import { buildProvider } from './provider.js';
4
-
5
- const versions = () =>
6
- defineVersions().version('1.0.0', buildProvider()).build();
7
-
8
- export { versions };
1
+ export { buildProvider } from './provider.js';
9
2
  export { WALLET_ID } from './constants.js';