export type Options = {
/** the base url of the thor node's thorREST API */
node: string
/**
* the expected network of the node url. defaults to 'main' if omitted.
* if it does not match with the actual network of the node url points to,
* all subsequent request will fail.
*/
network?: 'main' | 'test' | Connex.Thor.Block
/**
* designated signer, either builtin signer or a new signer function
* defaults to sync2 if omitted
*/
signer?: BuiltinSigner | Connex.NewSigner
}
Which makes developers explicitly declare the signer they wish to connect. Sync, Sync2, VeworldExteions or custom if signer creation function is supported.
new Connex({node: 'https://...', network: 'main'}) // defaults to sync2
new Connex({node: 'https://...', network: 'main', signer: Connex.BuiltinSigner.Sync}) // sync or vechainthor mobile wallet
new Connex({node: 'https://...', network: 'main', signer: Connex.BuiltinSigner.Sync2}) // sync2
new Connex({node: 'https://...', network: 'main', signer: Connex.BuiltinSigner.VeworldExtension}) // veworld extension
new Connex({node: 'https://...', network: 'main', signer: (genesisId)=>{return CustomConnexSigner({genesisId: genesisId})})
There is also another option, which is to enforce the signer as a arguments in the construction API
constructor(opts: Options, signer: BuiltinSigner | Connex.NewSigner = BuiltinSigner.Sync2)
new Connex({node: 'https://...', network: 'main'}, Connex.BuiltinSigner.VeworldExtension)
new Connex.Vendor('main', Connex.BuiltinSigner.Sync2)
This PR is on top of #147, changed the options to
Which makes developers explicitly declare the signer they wish to connect.
Sync
,Sync2
,VeworldExteions
or custom if signer creation function is supported.There is also another option, which is to enforce the signer as a arguments in the construction API