0.7.6 • Published 1 year ago

lamden_wallet_controller v0.7.6

Weekly downloads
15
License
ISC
Repository
github
Last release
1 year ago

lamden_wallet_controller 0.6.3

An ES6 helper Class for handling the Lamden Wallet's broswer event interface.

walletController.js

constructor(connectionRequest)

Lamden Wallet Controller Class

This Class interfaces with the Lamden Wallet's content script. It provids helper methods for creating a connection, getting wallet info, sending transactions and retreiving tx information.

The connection information for your DAPP can be supplied now or later by calling "sendConnection" manually.

IMPORTANT: The window object needs to be available when creating this instance as it will attempt to create listeners.

Parameters
NameTypeDescription
connectionRequestObjectA connection request objectOptional
connectionRequest.appNamestringThe name of your dApp 
connectionRequest.versionstringConnection version. Older version will be over-written in the uers's wallet. 
connectionRequest.contractNamestringThe smart contract your DAPP will transact to 
connectionRequest.networkTypestringWhich Lamden network the approval is for (mainnet or testnet) are the only options 
connectionRequest.networkNamestringName of a Lamden Network, leave blank for legacy Lamden, use "arko" for the new Lamden NetworkOptional
connectionRequest.logostringThe reletive path of an image on your webserver to use as a logo for your Lamden Wallet Linked Account 
connectionRequest.backgroundstringThe reletive path of an image on your webserver to use as a background for your Lamden Wallet Linked AccountOptional
connectionRequest.charms.namestringCharm nameOptional
connectionRequest.charms.variableNamestringSmart contract variable to pull data fromOptional
connectionRequest.charms.keystringKey assoicated to the value you want to lookupOptional
connectionRequest.charms.formatAsstringWhat format the data isOptional
connectionRequest.charms.iconPathstringAn icon to display along with your charmOptional
Returns
  • WalletController

getInfo()

Creates a "lamdenWalletGetInfo" CustomEvent to ask the Lamden Wallet for the current information. This will fire the "newInfo" events.on event

Returns
  • Void

walletIsInstalled()

Check if the Lamden Wallet extention is installed in the user's broswer.

This will fire the "newInfo" events.on event

Returns
  • Promise Wallet is Installed.

storeConnectionRequest(connectionRequest)

Store connectionRequest information but don't sent If the connectionRequest object wasn't supplied to the construtor then it can be supplied or updated here

Parameters
NameTypeDescription
connectionRequestObjectA connection request object 
Returns

sendConnection(connectionRequest)

Send a connection to the Lamden Wallet for approval. If the connectionRequest object wasn't supplied to the construtor then it must be supplied here.

This will fire the "newInfo" events.on event

Parameters
NameTypeDescription
connectionRequestObjectA connection request objectOptional
connectionRequest.appNamestringThe name of your dApp 
connectionRequest.versionstringConnection version. Older version will be over-written in the uers's wallet. 
connectionRequest.contractNamestringThe smart contract your dApp will transact through 
connectionRequest.networkTypestringWhich Lamden network the approval is for (Mainnet or testnet) 
connectionRequest.networkNamestringName of a Lamden Network, leave blank for legacy Lamden, use "arko" for the new Lamden NetworkOptional
connectionRequest.backgroundstringA reletive path to an image to override the default lamden wallet account backgroundOptional
connectionRequest.logostringA reletive path to an image to use as a logo in the Lamden Wallet 
connectionRequest.charms.namestringCharm nameOptional
connectionRequest.charms.variableNamestringSmart contract variable to pull data fromOptional
connectionRequest.charms.keystringKey assoicated to the value you want to lookupOptional
connectionRequest.charms.formatAsstringWhat format the data isOptional
connectionRequest.charms.iconPathstringAn icon to display along with your charmOptional
Returns
  • Promise The User's Lamden Wallet Account details or errors from the wallet

sendTransaction(tx, callback)

Creates a "lamdenWalletSendTx" event to send a transaction request to the Lamden Wallet. If a callback is specified here then it will be called with the transaction result.

This will fire the "txStatus" events.on event

Parameters
NameTypeDescription
txObjectA connection request object 
tx.networkTypestringWhich Lamden network the tx is for (Mainnet or testnet) 
tx.networkNamestringName of a Lamden Network, leave blank for legacy Lamden, use "arko" for the new Lamden NetworkOptional
tx.stampLimitstringThe max Stamps this tx is allowed to use. Cannot be more but can be less. 
tx.methodNamestringThe method on your approved smart contract to call 
tx.kwargsObjectA keyword object to supply arguments to your method 
callbackFunctionA function that will called and passed the tx results.Optional
Returns
  • Void

constructor(connectionRequest)

Wallet Connection Request Class

Validates and stores the information from a connectionRequest object. See WalletController constructor for connection request params.

Parameters
NameTypeDescription
connectionRequestObject- request object 
Returns
  • WalletConnectionRequest

getInfo()

Get a JSON string of the approval request information

Returns
  • string - JSON string of all request information

Documentation generated with doxdox.

0.7.6

1 year ago

0.7.5

1 year ago

0.7.2

1 year ago

0.7.1

1 year ago

0.7.4

1 year ago

0.6.5

1 year ago

0.7.3

1 year ago

0.7.0

1 year ago

0.6.4

2 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago