new Account(username, password, optionsopt) → {Account}
Create a new Account
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
username |
string |
Pass in your Email, Account ID, or a BIP39 Mnemonic |
||||||||||||||||||||||||||
password |
string |
Your Accounts password |
||||||||||||||||||||||||||
options |
Object |
<optional> |
Options about the Account being spawned Properties
|
- Source:
Returns:
- Type:
- Account
Methods
_handleWalletWebsocketUpdate(address)
Internal function used to handle Websocket updates streaming in from the Wallet
Parameters:
Name | Type | Description |
---|---|---|
address |
Address |
The Address that was updated |
- Source:
(async) create() → {Promise.<Object>}
Create a new Wallet and save it to the Storage Adapter
- Source:
Returns:
Returns a Promise that resolves if the wallet is created successfully.
- Type:
- Promise.<Object>
getPaymentBuilder(walletopt, artifactopt, fileopt, typeopt, coinopt, fiatopt) → {ArtifactPaymentBuilder}
Instantiate and Artifact payment builder so you can do cool stuff! All params are optional. Include what you need to use. Put undefined for those you don't need.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
wallet |
Wallet |
<optional> |
oip-HDMW |
|
artifact |
Artifact |
<optional> |
oip-Artifact |
|
file |
ArtifactFile | number |
<optional> |
an oip-ArtifactFile or the amount you want to pat |
|
type |
string |
<optional> |
'view', 'buy', or 'tip' |
|
coin |
string |
<optional> |
the coin you prefer to pay with (currently only supports one coin |
|
fiat |
string |
<optional> |
"usd" |
the fiat currency you deal with |
- Source:
Returns:
- Type:
- ArtifactPaymentBuilder
getSetting(setting_node) → {Object}
Get a specific setting
Parameters:
Name | Type | Description |
---|---|---|
setting_node |
string |
The Setting you wish to get |
- Source:
Returns:
Returns the requested setting_info
- Type:
- Object
(async) login() → {Promise}
Login to the Selected Account. This spawns and creates the oip-hdmw account.
- Source:
Returns:
Returns a Promise that resolves after logging in successfully.
- Type:
- Promise
logout()
Logout of the currently logged in Account
- Source:
onWalletWebsocketUpdate(subscriberFunction)
Subscribe to Wallet Websocket updates
Parameters:
Name | Type | Description |
---|---|---|
subscriberFunction |
function |
The function you want called when a Websocket update happens |
- Source:
payForArtifactFile(artifact, artifact_file, purchase_type, coinopt, fiatopt) → {Promise.<Transaction>}
Pay to View or Buy and Artifact File. This makes the purchase as well as saving that info to the wallet.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
artifact |
Artifact |
The Artifact from which you got the ArtifactFile from. This is used to lookup payment percentage information. |
|
artifact_file |
ArtifactFile |
The specific ArtifactFile that you wish to pay for |
|
purchase_type |
string |
Either |
|
coin |
string |
<optional> |
The Coin you wish to pay with |
fiat |
string |
<optional> |
A string containing information about the users source currency (i.e. "usd") |
- Source:
Returns:
Returns a Promise that will resolve to the payment transaction, or rejects if there is a payment error.
- Type:
- Promise.<Transaction>
sendArtifactTip(artifact, amount, coinopt, fiatopt) → {Promise.<Transaction>}
Send a tip to the Publisher for a specific Artifact
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
artifact |
Artifact |
The Artifact you wish to tip |
||
amount |
number |
The Amount in |
||
coin |
string |
<optional> |
The Coin you wish to pay with |
|
fiat |
string |
<optional> |
"usd" |
A string containing information about the users source currency (i.e. "usd") |
- Source:
Returns:
Returns a Promise that will resolve to the payment transaction, or rejects if there is a payment error.
- Type:
- Promise.<Transaction>
(async) setSetting(setting_node, setting_info) → {Promise.<Object>}
Set a setting on the Account
Parameters:
Name | Type | Description |
---|---|---|
setting_node |
string |
The Setting you wish to set |
setting_info |
Object |
What you wish to set the setting to |
- Source:
Returns:
Returns a Promise that will resolve with the Account Data after the new setting is saved to the StorageAdapter
- Type:
- Promise.<Object>
(async) store() → {Promise.<Object>}
Store changed information about the account to the StorageAdapter
- Source:
Returns:
Returns a Promise that will resolve to the Account Data if the account is saved successfully, or rejects if there was an error storing.
- Type:
- Promise.<Object>