Keep in mind our global object/provider is accessible from window.vectis
Enable connection
In order to allow a website to read user account information and prepare transaction is necessary call to enable method. This will create a popup asking for user authorization, in case the extension is locked, it will open the unlock popup in first instance.
exportinterfaceAminoSignResponse {/** * The sign doc that was signed. * This may be different from the input signDoc when the signer modifies * it as part of the signing process. */readonly signed:StdSignDoc;readonly signature:StdSignature;}
Note: It's necessary to enable a connection, before using this method.
interfaceSignDoc {/** * body_bytes is protobuf serialization of a TxBody that matches the * representation in TxRaw. */ bodyBytes:Uint8Array;/** * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the * representation in TxRaw. */ authInfoBytes:Uint8Array;/** * chain_id is the unique identifier of the chain this transaction targets. * It prevents signed transactions from being used on another chain by an * attacker */ chainId:string;/** account_number is the account number of the account in state */ accountNumber:Long;}
exportinterfaceDirectSignResponse {/** * The sign doc that was signed. * This may be different from the input signDoc when the signer modifies * it as part of the signing process. */readonly signed:SignDoc;readonly signature:StdSignature;}
Get Signer
In this field we could find different kind of signer and we are explain the difference among them.
As we saw previously there are different kind of encoding, there are direct or amino, so depending on what method is used will be possible to sign one kind of txs or another.
Get Accounts
When any of these methods are invoked, they return an object structure with two or three properties. All of them has one property in common which is getAccounts.
Note: This signer return three properties: signDirect, signAmino and getAccounts. Allowing to dApp or third party libraries select their preference in the signature.
Auto Signer
This method is a little bit different to the others because before to return a signer, the method evaluate what should return base on some internals parameters.
Ledger users only can use amino encoding, since the cosmos app doesn't support protobuf