README
ara-contracts
Blockchain interactions in Ara modules.
Overview
This repository contains all contracts deployed by Ara. There are five global contracts used throughout the entire network:
AraToken.sol
- The Ara ERC20 token contract
Network | Type | Address | Verified Source |
---|---|---|---|
Ropsten | Proxy | 0x06be7386f99c38d26d53d83cbf1b9f438930694b |
https://ropsten.etherscan.io/address/0x06be7386f99c38d26d53d83cbf1b9f438930694b#code |
Ropsten | Implementation | 0xc349b831e83248368aa69c42fa717f700fecb8ce |
https://ropsten.etherscan.io/address/0xc349b831e83248368aa69c42fa717f700fecb8ce#code |
Mainnet | Proxy | 0xa92e7c82b11d10716ab534051b271d2f6aef7df5 |
https://etherscan.io/address/0xa92e7c82b11d10716ab534051b271d2f6aef7df5#code |
Mainnet | Implementation | 0xb8ca408aff631b65021850cd7ebf8eac7f3c0312 |
https://etherscan.io/address/0xb8ca408aff631b65021850cd7ebf8eac7f3c0312#code |
AFS.sol
- TheAFS
standard contract defines the API for interacting withAFS
s on the blockchain (see the accompanying RFC). The currentAFS Standard
version is4
. Future Standards are not necessarily sequential or superseding in nature and may exist in parallel (e.g., anotherAFS Standard
may be namedecommerce
which can be used for an entirely different class ofAFS
s). In order to estimate costs for interacting with the Standard without needing to deploy a proxy beforehand, we additionally deploy a version of allAFS Standard
s withoutmodifiers
which are named${version name}_estimate
. The currentAFS Estimate Standard
version is4_estimate
.
Network | Version | Address | Verified Source |
---|---|---|---|
Ropsten | 6 |
0x54a206a07e18a1fed118e3f946db4e3b7de35049 |
https://ropsten.etherscan.io/address/0x54a206a07e18a1fed118e3f946db4e3b7de35049#code |
Ropsten | 6_estimate |
0x5437dF777Fa849dadD67A7F7fD88F9deB657166A |
https://ropsten.etherscan.io/address/0x5437df777fa849dadd67a7f7fd88f9deb657166a#code |
Mainnet | 2 |
0x7bd36ca16161d8290986d4dca8265c2b5ca340fe |
https://etherscan.io/address/0x7bd36ca16161d8290986d4dca8265c2b5ca340fe#code |
Mainnet | 2_estimate |
0x39798776e91874583abf1e36c77a49446a8f3cea |
https://etherscan.io/address/0x39798776e91874583abf1e36c77a49446a8f3cea#code |
Library.sol
- The contract where content ownership across the network is consolidated and tracked
Network | Type | Address | Verified Source |
---|---|---|---|
Ropsten | Proxy | 0xec26659b209e9e89a23d26298ba0359b1b6c7f76 |
https://ropsten.etherscan.io/address/0xec26659b209e9e89a23d26298ba0359b1b6c7f76#code |
Ropsten | Implementation | 0x991198dac7e5aa586ed129735e142c01ad81ed69 |
https://ropsten.etherscan.io/address/0x991198dac7e5aa586ed129735e142c01ad81ed69#code |
Mainnet | Proxy | 0xC04B27294bb3d1abaAC39F2F97B4A95810bA91dd |
https://etherscan.io/address/0xc04b27294bb3d1abaac39f2f97b4a95810ba91dd#code |
Mainnet | Implementation | 0x991198dac7e5aa586ed129735e142c01ad81ed69 |
https://etherscan.io/address/0xfdb1b5adf9cc13d8434f3d493f345a8bc46afcdc#code |
Registry.sol
- The contract whereAFS
proxies andAFS
standards are created, linked, and tracked
Network | Type | Address | Verified Source |
---|---|---|---|
Ropsten | Proxy | 0xdb8f8d6cc69a346d608e64c2ddb5b3ed7e4b32d6 |
https://ropsten.etherscan.io/address/0xdb8f8d6cc69a346d608e64c2ddb5b3ed7e4b32d6#code |
Ropsten | Implementation | 0xbbc4d435c7426cef12c4b6d4d12552a1e7de24ef |
https://ropsten.etherscan.io/address/0xbbc4d435c7426cef12c4b6d4d12552a1e7de24ef#code |
Mainnet | Proxy | 0x17a6033535b1ab8cbbb430c62782d164d8f6ac45 |
https://etherscan.io/address/0x17a6033535b1ab8cbbb430c62782d164d8f6ac45#code |
Mainnet | Implementation | 0x814F2ca790454c795F5e515A394CbFB7bE499737 |
https://etherscan.io/address/0x814f2ca790454c795f5e515a394cbfb7be499737#code |
AraRegistry.sol
- The contract used to deploy the Library, Registry, and AraToken contracts
Network | Type | Address | Verified Source |
---|---|---|---|
Ropsten | Implementation | 0x6bda4b9fcb082e72b30081393d4ae7b05360e517 |
https://ropsten.etherscan.io/address/0x6bda4b9fcb082e72b30081393d4ae7b05360e517#code |
Mainnet | Implementation | 0xf8314584346fc84e96b36113784f6b562e5b01af |
https://etherscan.io/address/0xf8314584346fc84e96b36113784f6b562e5b01af#code |
This repository also provides programmatic (see the API section) and command-line interfaces (see the Usage section) for interacting with the contracts.
AFS Proxies
In addition to these global contracts, Ara deploys a proxy contract for each individual AFS
that gets committed to the blockchain (see ara-filesystem
and proxy architecture). This contract serves as the storage layer for AFS
s on the blockchain, while the AFS Standard
serves as the API (business logic layer) for interacting with AFS
s on the blockchain.
Stability
Stability: 2 - Stable. Compatibility with the npm ecosystem is a high priority.
Although the API is stable, this project is still in alpha development and is not yet ready to be used in a production environment.
Dependencies
Installation
$ npm install arablocks/ara-contracts --save
Usage
See CLI Usage docs here.
Ara Privatenet
The contracts in this repository are currently deployed on Ara Privatenet and Ethereum Ropsten Testnet. You must be connected to one of these networks in order to be on the same network as the rest of the Ara team during development and to use the addresses in constants.js
. You may run a local Ganache instance for local development.
API
Any value inputted into token functions must be strings to avoid precision error All transaction callbacks (
onhash
,onreceipt
,onconfirmation
,onerror
, andonmined
) are optional. For more information, seeara-util
.
Purchase
Registry
- async registry.proxyExists(contentDid)
- async registry.getProxyAddress(contentDid)
- async registry.upgradeProxy(opts)
- async registry.deployProxy(opts)
- async registry.getProxyVersion(contentDid)
- async registry.getLatestStandard()
- async registry.getStandard(version)
- async registry.deployNewStandard(opts)
Library
- async library.getLibrary(requesterDid)
- async library.getLibrarySize(requesterDid)
- async library.getLibraryItem(opts)
- async library.hasPurchased(opts)
Rewards
- async rewards.submit(opts)
- async rewards.allocate(opts)
- async rewards.redeem(opts)
- async rewards.getBudget(opts)
- async rewards.getJobOwner(opts)
- async rewards.getRewardsBalance(opts)
Token
- async token.balanceOf(did, keyringOpts)
- async token.totalSupply()
- async token.allowance(opts)
- async token.transfer(opts)
- async token.approve(opts)
- async token.transferFrom(opts)
- async token.increaseApproval(opts)
- async token.decreaseApproval(opts)
- async token.modifyDeposit(opts)
- async token.getAmountDeposited(did, keyringOpts)
- token.constrainTokenValue(val)
- token.expandTokenValue(val)
Ownership
- async ownership.approveOwnershipTransfer(opts)
- async ownership.revokeOwnershipRequest(opts)
- async ownership.requestOwnership(opts)
- async ownership.hasRequested(opts)
- async ownership.getOwner(contentDid)
async purchase(opts)
Purchases an AFS
and adds it to the requester's library.
opts
requesterDid
- TheDID
of the person making the purchasecontentDid
- TheDID
of the content being purchasedpassword
- The requester's passwordbudget
- The budget in Ara to allocate for the initial download jobgasPrice
- Optional gas price in GWeiapprove
- Optional boolean indicating whether to send the Approve transaction prior to the Purchase transactionkeyringOpts
- Optional keyring optionsapproveCallbacks
- Optional callbacks for the Approve transactiononhash
onreceipt
onconfirmation
onerror
onmined
purchaseCallbacks
- Optional callbacks for the Purchase transactiononhash
onreceipt
onconfirmation
onerror
onmined
Returns object
:
receipt
- Transaction receiptjobId
- The job ID generated for the initial download
const requesterDid = 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
const contentDid = 'did:ara:114045f3883a21735188bb02de024a4e1451cb96c5dcc80bdfa1b801ecf81b85'
const budget = 100
const { receipt, jobId } = await purchase({
requesterDid,
contentDid,
password,
budget
})
async registry.proxyExists(contentDid)
Checks if the proxy for a content DID
exists.
contentDid
- TheDID
of the content to check
Returns a boolean
indicating whether a proxy contract exists for a contentDid
.
const exists = await registry.proxyExists(contentDid)
async registry.getProxyAddress(contentDid)
Gets the address of a proxy given a content DID
contentDid
- TheDID
of the content
const address = await registry.getProxyAddress(contentDid)
async registry.upgradeProxy(opts)
Upgrades a proxy to another AFS
standard.
opts
contentDid
- TheDID
of the contentpassword
- The password of the owner of the proxyafsPassword
- The password of the AFSversion
- TheAFS
standard version to upgrade togasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns a boolean
indicating whether the proxy was successfully upgraded.
const upgraded = await registry.upgradeProxy({ contentDid, password, afsPassword, version: '1' })
async registry.deployProxy(opts)
Deploys a proxy to an AFS
standard.
opts
contentDid
- TheDID
of the content to deploy a proxy forpassword
- The password of the owner of theAFS
afsPassword
- The password of the AFSversion
- The version to use with this proxyestimate
- Optional flag to check cost ofdeployProxy
ownerDid
- Optional ownerDID
used in conjunction withestimate
to bypass needing a real AFSgasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns the address at which the proxy was deployed.
const address = await registry.deployProxy({ contentDid, password, afsPassword, version: '1' })
async registry.getProxyVersion(contentDid)
Gets the AFS
Standard version a proxy is using.
contentDid
- TheDID
of the content
const version = await registry.getProxyVersion(contentDid)
async registry.getLatestStandard()
Gets the latest AFS
contract standard.
const address = await registry.getLatestStandard()
async registry.getStandard(version)
Gets the address of an AFS
contract standard.
version
- The version of theAFS
contract standard
const address = await registry.getStandard('1')
async registry.deployNewStandard(opts)
Compiles and deploys a new AFS
standard.
opts
requesterDid
- TheDID
of the person deploying the standardpassword
- The password of the person deploying the standardversion
- The version of the standardpaths
- The solidity dependencies of the standardgasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns the address at which the standard was deployed.
const version = '1'
const paths = ['./contracts/ignored_contracts/AFS.sol',
'./contracts/ignored_contracts/Library.sol',
'./contracts/ignored_contracts/Registry.sol',
'./contracts/AraProxy.sol',
'./contracts/ignored_contracts/AraToken.sol']
const address = await registry.deployNewStandard({
requesterDid,
password,
version,
paths
})
async library.getLibrary(requesterDid)
Gets the content DID
s purchased by the requesterDID
.
requesterDid
- TheDID
of the owner of the library
const lib = await library.getLibrary(did)
async library.getLibrarySize(requesterDid)
Gets the size of requesterDid
's library.
requesterDid
- TheDID
of the owner of the library
const size = await library.getLibrarySize(did)
async library.getLibraryItem(opts)
Gets the DID
of the item at the provided index
in requesterDid
's library.
opts
requesterDid
- TheDID
of the owner of the libraryindex
- The index of the content to retrieve
const contentDid = await library.getLibraryItem({ requesterDid, index: 1 })
async library.hasPurchased(opts)
opts
contentDid
-DID
of the content to check the purchase ofpurchaserDid
-DID
of purchaserkeyringOpts
- optional Keyring options
const purchased = await library.hasPurchased({
contentDid: 'did:ara:114045f3883a21735188bb02de024a4e1451cb96c5dcc80bdfa1b801ecf81b85',
purchaserDid: 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
})
async rewards.submit(opts)
Submits new DCDN job.
opts
requesterDid
- TheDID
of the person submitting the jobcontentDid
- TheDID
of the content this job is forpassword
- The password of the person submitting the jobjob
jobId
- ThejobId
of the job being submittedbudget
- The budget to allocate for the job
gasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns transaction receipt
object.
const jobId = '0x7dc039cfb220029c371d0f4aabf4a956ed0062d66c447df7b4595d7e11187271'
const budget = 10
const receipt = await rewards.submit({
requesterDid,
contentDid,
password,
job: {
jobId,
budget
}
})
async rewards.allocate(opts)
Allocates rewards
amongst farmers
for jobId
.
opts
requesterDid
- TheDID
of the person who submitted the jobcontentDid
- TheDID
of the content the job is forpassword
- The password of the person who submitted the jobjob
jobId
- ThejobId
of the job to allocate forfarmers
- The Ethereum addresses of the farmers to rewardrewards
- The reward amounts in Ara tokens to split amongstfarmers
, respectively
gasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
const jobId = '0x7dc039cfb220029c371d0f4aabf4a956ed0062d66c447df7b4595d7e11187271'
const farmers = ['0xF9403C6DA32DB4860F1eCB1c02B9A04D37c0e36e',
'0x70693d8f4e1c9bA1AE0870C35128BaDfDcF28FBc',
'0x19d6a7D8bB09e8A6d733a9c8D9fe7b964fD8F45e',
'0x629483C72b5191C1b522E887238a0A522b1D4F74']
const distribution = [10, 20, 30, 40]
await rewards.allocate({
requesterDid,
contentDid,
password,
job: {
jobId,
farmers,
rewards: distribution
}
})
async rewards.redeem(opts)
Redeem Ara tokens (resulting from allocation return or from rewards) from AFS
contract.
opts
farmerDid
- TheDID
of the person redeeming tokenscontentDid
- TheDID
of the content to redeem frompassword
- The password of the person redeeming tokensgasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns the number of Ara tokens redeemed.
const balance = await rewards.redeem({
farmerDid,
contentDid,
password
})
async rewards.getBudget(opts)
Gets the budget for jobId
.
opts
contentDid
- TheDID
of the content that hasjobId
jobId
- ThejobId
of the job to get the budget for
const budget = await rewards.getBudget({
contentDid,
jobId
})
async rewards.getJobOwner(opts)
Gets the address of the owner of a jobId
.
opts
contentDid
- TheDID
of the content that hasjobId
jobId
- ThejobId
of the job to get the owner for
const owner = await rewards.getJobOwner({
contentDid,
jobId
})
async rewards.getRewardsBalance(opts)
Gets the balance (resulting from allocation return or from rewards) of farmerDid
stored in contentDid
.
opts
farmerDid
- TheDID
of the person to check the balance ofcontentDid
- TheDID
of the content where the balance is storedpassword
- The password of the person to check the balance ofkeyringOpts
- optional Keyring options
const balance = await rewards.getRewardsBalance({
farmerDid,
contentDid,
password
})
async token.balanceOf(did, keyringOpts)
Queries for the balance in Ara of an identity.
did
- TheDID
of the account to get the balance forkeyringOpts
- optional Keyring options
const did = 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
const balance = await token.balanceOf(did) // 100.5
async token.totalSupply()
Gets the total circulating supply of Ara tokens.
const supply = await token.totalSupply() // 1000000000
async token.allowance(opts)
Gets the amount in Ara that a spender
is allowed to spend of an owner
.
owner
-DID
of the owner of the Ara tokens to be spentspender
-DID
of the account that will be spendingowner
's tokens
const owner = 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
const spender = 'did:ara:114045f3883a21735188bb02de024a4e1451cb96c5dcc80bdfa1b801ecf81b85'
const allowance = await token.allowance({ owner, spender })
async token.transfer(opts)
Transfers Ara from one account to another.
opts
did
-DID
of the account that is sending the Arapassword
- Password of the account sending Arato
-DID
of the account to receive the tokensval
- Amount to transfergasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns transaction receipt
object.
const did = 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
const password = 'password'
const recipient = 'did:ara:114045f3883a21735188bb02de024a4e1451cb96c5dcc80bdfa1b801ecf81b85'
const receipt = await token.transfer({
did,
password,
to: recipient,
val: '500'
})
async token.approve(opts)
Sets the approved token amount to be spent on an owner's behalf. This will overwrite any previous approvals.
opts
did
-DID
of the account that owns the Arapassword
- Password of the owning accountspender
-DID
of the account that will be spending the tokensval
- Amount to approvegasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns transaction receipt
object.
const did = 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
const password = 'password'
const recipient = 'did:ara:114045f3883a21735188bb02de024a4e1451cb96c5dcc80bdfa1b801ecf81b85'
const receipt = await token.approve({
did,
password,
spender,
val: '500'
})
async token.transferFrom(opts)
Transfers Ara from one address to another. This differs from transfer
by requiring the tokens to be first approved to be spent.
opts
from
- TheDID
of the origin account of the Ara tokens to transfer (this account must approvedid
to perform the transfer beforehand)to
-DID
of the account that will be receiving the tokensval
- Amount of Ara to transferdid
-DID
of the account initiating the transfer on behalf offrom
password
- Password of the account initiating the transfergasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns transaction receipt
object.
const origin = 'did:ara:08228219008e3c7ab8b7f23a161c196be44ff33525ebea01d841b707b34b7adc'
const recipient = 'did:ara:114045f3883a21735188bb02de024a4e1451cb96c5dcc80bdfa1b801ecf81b85'
const did = 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
const password = 'password'
const receipt = await token.transferFrom({
from: origin,
to: recipient,
val: '500',
did,
password,
})
async token.increaseApproval(opts)
Increases the approved amount that a spender
can spend on behalf of an owner
. This will not overwrite any existing approved amount, just increase it.
opts
spender
-DID
of the spenderdid
-DID
of the account that owns the Arapassword
- Password of the owning accountval
- Amount to increase the approval bygasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns transaction receipt
object.
const spender = 'did:ara:114045f3883a21735188bb02de024a4e1451cb96c5dcc80bdfa1b801ecf81b85'
const did = 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
const password = 'password'
const receipt = await token.increaseApproval({
spender,
did,
password,
val: '10'
})
async token.decreaseApproval(opts)
Decreases the approved amount that a spender
can spend on behalf of an owner
. This will not overwrite any existing approved amount, just decrease it.
opts
spender
-DID
of the spenderdid
-DID
of the account that owns the Arapassword
- Password of the owning accountval
- Amount to decrease the approval bygasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns transaction receipt
object.
const did = 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
const password = 'password'
const spender = 'did:ara:114045f3883a21735188bb02de024a4e1451cb96c5dcc80bdfa1b801ecf81b85'
const receipt = await token.decreaseApproval({
spender,
did,
password,
val: '10'
})
async token.modifyDeposit(opts)
Modifies the current amount deposited for rewards for a particular account.
opts
did
-DID
of the account to update the deposit forpassword
- password of the accountval
- value asstring
to deposit/withdrawwithdraw
-boolean
whether this should be a deposit or withdraw (defaults tofalse
if not given)gasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns transaction receipt
object.
// deposits 50 Ara
const did = 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
const password = 'password'
const receipt = await token.modifyDeposit({
did,
password,
val: '50'
})
// withdraws 50 Ara from deposit
const did = 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
const password = 'password'
const receipt = await token.modifyDeposit({
did,
password,
val: '50',
withdraw: true
})
async token.getAmountDeposited(did)
Gets the current amount deposited by an account to be used for redeeming rewards.
did
-DID
of the account to get the deposit balance forkeyringOpts
- optional Keyring options
const did = 'did:ara:a51aa651c5a28a7c0a8de007843a00dcd24f3cc893522d3fb093c2bb7a323785'
const amount = await token.getAmountDeposited(did) // '100'
token.constrainTokenValue(val)
Constrains token amount used in the EVM to its nominal value (Ara supports 18 decimals).
val
- The unconstrained token value as aString
const expandedValue = '1000000000000000000' // 1 Ara Token
const constrainedValue = token.constrainTokenValue(expandedValue) // constrainedValue === '1'
token.expandTokenValue(val)
Expands nominal token value to its expanded form used in the EVM (Ara supports 18 decimals).
val
- The expanded token value as aString
const constrainedValue = '1'
const expandedValue = token.expandTokenValue(constrainedValue) // expandedValue === '1000000000000000000'
async ownership.approveOwnershipTransfer(opts)
Approves an AFS ownership transfer request.
opts
contentDid
- TheDID
of the content to transfer ownershippassword
- The password of the current ownerafsPassword
- The password of the AFSnewOwnerDid
- TheDID
of the account to transfer ownership toestimate
- optional Flag to check cost ofapproveOwnershipTransfer
gasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns transaction receipt
object.
const receipt = await ownership.approveOwnershipTransfer({
contentDid,
password,
afsPassword,
newOwnerDid
})
async ownership.revokeOwnershipRequest(opts)
Revokes an outstanding ownership request of an AFS.
opts
requesterDid
- TheDID
of the account requesting ownershipcontentDid
- TheDID
of the content to transfer ownershippassword
- The password of the account requesting ownershipestimate
- optional Flag to check cost ofrevokeOwnershipRequest
gasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns transaction receipt
object.
const receipt = await ownership.revokeOwnershipRequest({
requesterDid,
contentDid,
password
})
async ownership.requestOwnership(opts)
Requests ownership of an AFS.
opts
requesterDid
- TheDID
of the account requesting ownershipcontentDid
- TheDID
of the content to transfer ownershippassword
- The password of the account requesting ownershipestimate
- optional Flag to check cost ofrequestOwnership
gasPrice
- Optional gas price in GWeikeyringOpts
- Optional keyring optionsonhash
onreceipt
onconfirmation
onerror
onmined
Returns transaction receipt
object.
const receipt = await ownership.requestOwnership({
requesterDid,
contentDid,
password
})
async ownership.hasRequested(opts)
Checks if a requester DID
has requested ownership of an AFS.
opts
requesterDid
- TheDID
of the account requesting ownershipcontentDid
- TheDID
of the content in questionkeyringOpts
- optional Keyring options
Returns boolean
.
const hasRequested = await ownership.hasRequested({ requesterDid, contentDid })
async ownership.getOwner(contentDid)
Gets the Ethereum address of the owner of an AFS.
contentDid
- TheDID
of the content to get the owner for
const owner = await ownership.getOwner(contentDid)
Contributing
Releases follow Semantic Versioning
See Also
License
LGPL-3.0