Skip to content

Commit

Permalink
Merge pull request #1514 from aeternity/feature/tokens-to-coins
Browse files Browse the repository at this point in the history
refactor: rename tokens to coins
  • Loading branch information
davidyuk authored May 17, 2022
2 parents b7f7de1 + 13a80bf commit 18d907b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions examples/browser/aepp/src/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
</div>

<h2>Spend tokens</h2>
<h2>Spend coins</h2>
<div class="group">
<div>
<div>Recipient address</div>
Expand All @@ -35,7 +35,7 @@
</div>
</div>
<div>
<div>Tokens amount</div>
<div>Coins amount</div>
<div><input v-model="spendAmount"></div>
</div>
<div>
Expand Down
4 changes: 2 additions & 2 deletions src/ae/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function signUsingGA (tx, { authData, authFun, ...options } = {}) {
}

/**
* Send tokens to another account
* Send coins to another account
* @instance
* @category async
* @rtype (amount: Number|String, recipientIdOrName: String, options?: Object) => Promise[String]
Expand All @@ -86,7 +86,7 @@ async function spend (amount, recipientIdOrName, options) {

// TODO: Rename to spendFraction
/**
* Send a fraction of token balance to another account
* Send a fraction of coin balance to another account
* @instance
* @category async
* @rtype (fraction: Number|String, recipientIdOrName: String, options?: Object) => Promise[String]
Expand Down
18 changes: 9 additions & 9 deletions src/channel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function fsmId () {
/**
* Trigger a transfer update
*
* The transfer update is moving tokens from one channel account to another.
* The transfer update is moving coins from one channel account to another.
* The update is a change to be applied on top of the latest state.
*
* Sender and receiver are the channel parties. Both the initiator and responder
Expand Down Expand Up @@ -309,7 +309,7 @@ function shutdown (sign) {
}

/**
* Withdraw tokens from the channel
* Withdraw coins from the channel
*
* After the channel had been opened any of the participants can initiate a withdrawal.
* The process closely resembles the update. The most notable difference is that the
Expand All @@ -335,7 +335,7 @@ function shutdown (sign) {
* When the other party had confirmed that the block height needed is reached
* onWithdrawLocked callback is called (without any arguments).
*
* @param {Number} amount - Amount of tokens to withdraw
* @param {Number} amount - Amount of coins to withdraw
* @param {Function} sign - Function which verifies and signs withdraw transaction
* @param {Object} [callbacks]
* @param {Function} [callbacks.onOnChainTx] - Called when withdraw transaction has been posted
Expand Down Expand Up @@ -379,7 +379,7 @@ function withdraw (amount, sign, { onOnChainTx, onOwnWithdrawLocked, onWithdrawL
}

/**
* Deposit tokens into the channel
* Deposit coins into the channel
*
* After the channel had been opened any of the participants can initiate a deposit.
* The process closely resembles the update. The most notable difference is that the
Expand All @@ -405,7 +405,7 @@ function withdraw (amount, sign, { onOnChainTx, onOwnWithdrawLocked, onWithdrawL
* When the other party had confirmed that the block height needed is reached
* onDepositLocked callback is called (without any arguments).
*
* @param {Number} amount - Amount of tokens to deposit
* @param {Number} amount - Amount of coins to deposit
* @param {Function} sign - Function which verifies and signs deposit transaction
* @param {Object} [callbacks]
* @param {Function} [callbacks.onOnChainTx] - Called when deposit transaction has been posted
Expand Down Expand Up @@ -456,7 +456,7 @@ function deposit (amount, sign, { onOnChainTx, onOwnDepositLocked, onDepositLock
* The update is a change to be applied on top of the latest state.
*
* That would create a contract with the poster being the owner of it. Poster commits initially
* a deposit amount of tokens to the new contract.
* a deposit amount of coins to the new contract.
*
* @param {Object} options
* @param {String} options.code - Api encoded compiled AEVM byte code
Expand Down Expand Up @@ -518,7 +518,7 @@ function createContract ({ code, callData, deposit, vmVersion, abiVersion }, sig
* internal state tree. The update is a change to be applied on top of the latest state.
*
* That would call a contract with the poster being the caller of it. Poster commits
* an amount of tokens to the contract.
* an amount of coins to the contract.
*
* The call would also create a call object inside the channel state tree. It contains
* the result of the contract call.
Expand Down Expand Up @@ -806,9 +806,9 @@ async function reconnect (options, txParams) {
* @param {String} options.initiatorId - Initiator's public key
* @param {String} options.responderId - Responder's public key
* @param {Number} options.pushAmount - Initial deposit in favour of the responder by the initiator
* @param {Number} options.initiatorAmount - Amount of tokens the initiator has committed to
* @param {Number} options.initiatorAmount - Amount of coins the initiator has committed to
* the channel
* @param {Number} options.responderAmount - Amount of tokens the responder has committed to
* @param {Number} options.responderAmount - Amount of coins the responder has committed to
* the channel
* @param {Number} options.channelReserve - The minimum amount both peers need to maintain
* @param {Number} [options.ttl] - Minimum block height to include the channel_create_tx
Expand Down
2 changes: 1 addition & 1 deletion src/utils/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ export class NotPayableFunctionError extends ContractError {
constructor (amount: string, fn: string) {
super(
`You try to pay "${amount}" to function "${fn}" which is not payable. ` +
'Only payable function can accept tokens')
'Only payable function can accept coins')
this.name = 'NotPayableFunctionError'
}
}
Expand Down
10 changes: 5 additions & 5 deletions test/integration/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ describe('Accounts', function () {
return wallet.getBalance(await wallet.address()).should.eventually.be.equal('0')
})

it('spending tokens', async () => {
it('spending coins', async () => {
return wallet.spend(1, receiver).should.be.rejectedWith(Error)
})

it('spending negative amount of tokens', () => expect(wallet.spend(-1, receiver))
it('spending negative amount of coins', () => expect(wallet.spend(-1, receiver))
.to.be.rejectedWith(InvalidTxParamsError, 'Transaction build error. {"amount":"-1 must be >= 0"}'))
})

Expand Down Expand Up @@ -105,23 +105,23 @@ describe('Accounts', function () {
})
})

it('spends tokens', async () => {
it('spends coins', async () => {
const ret = await aeSdk.spend(1, receiver)
ret.should.have.property('tx')
ret.tx.should.include({
amount: 1, recipientId: receiver
})
})

it('spends tokens in AE format', async () => {
it('spends coins in AE format', async () => {
const ret = await aeSdk.spend(1, receiver, { denomination: AE_AMOUNT_FORMATS.AE })
ret.should.have.property('tx')
ret.tx.should.include({
amount: `${1e18}`, recipientId: receiver
})
})

it('spends big amount of tokens', async () => {
it('spends big amount of coins', async () => {
const bigAmount = '10000000000000100000000000000000'
const genesis = await BaseAe({ networkId })
const receiverWallet = generateKeyPair()
Expand Down

0 comments on commit 18d907b

Please sign in to comment.