Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(index): Include amountFormatter and SCHEMA in bundle #936

Merged
merged 6 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ You can use this URL with any releasee on [npmjs](https://www.npmjs.com/package/
- [AENS delegation signature](guides/delegate-signature-to-contract.md)
- [AENS usage](guides/aens-usage.md)

### New Wallet/Aepp API
- [How to build Wallet app/extension](guides/how-to-build-an-wallet-app-or-extension.md)
- [How to build Aepp](guides/how-to-build-aepp-using-new-wallet-api.md)

## Examples
Check out our [Examples](../examples/README.md) for more.
3 changes: 2 additions & 1 deletion docs/examples/node/aewallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ the implementation grab the key pair from the `WALLET_PRIV` and

```js
const node = await Node({ url: host })
Ae({ nodes: [{ name: 'local', instance: node }], debug, process })
const keypair = { secretKey: 'YOUR_SECRET', publicKey: 'YOUR_PUBLIC_KEY' }
Ae({ nodes: [{ name: 'local', instance: node, accounts: [MemoryAccount({ keypair })] }], debug, process })
.then(ae => ae.spend(parseInt(amount), receiver))
.then(tx => console.log('Transaction mined', tx))
.catch(e => console.log(e.message))
Expand Down
4 changes: 0 additions & 4 deletions docs/guides/import-nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ Promise.all([
Ae({
nodes: [
{ name: 'someNode', instance: nodes[0] },
// node2
],
compilerUrl: 'COMPILER_URL',
accounts: [
acc1,
// acc2
]
}).then(ae => {
ae.height().then(height => {
Expand All @@ -43,12 +41,10 @@ const main = async () => {
const client = await Ae({
nodes: [
{ name: 'someNode', instance: node1 },
// node2
],
compilerUrl: 'COMPILER_URL',
accounts: [
acc1,
// acc2
],
address: 'SELECTED_ACCOUNT_PUB'
})
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/import-script-tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The bundle will assign the SDK to a global `var` called `Ae`, and you can use it
<script src="https://unpkg.com/@aeternity/aepp-sdk/dist/aepp-sdk.browser-script.js"></script>
<script type="text/javascript">
Ae.Node({ url: 'https://sdk-testnet.aepps.com' }).then(node => {
Ae.Wallet({
Ae.Universal({
nodes: [{ name: 'local', instance: node }]
}).then(aeInstance => {
aeInstance.height().then(height => {
Expand Down
19 changes: 15 additions & 4 deletions docs/guides/import-tree-shaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,26 @@ Using this method also enables the use of [Tree shaking] (dead code
elimination). In order to ensure that modules are loaded directly, use the following syntax to load your desired part (aka [_flavor_](../README.md)) of aepp-sdk:

```js
// import only Wallet flavor
import Aepp from '@aeternity/aepp-sdk/es/ae/wallet'
// import Universal stamp
import Universal from '@aeternity/aepp-sdk/es/ae/universal'
// import Node
import Node from '@aeternity/aepp-sdk/es/node'
// import Account
import MemoryAccount from '@aeternity/aepp-sdk/es/account/memory'

// interact with aeternity's blockchain
Wallet().then(client => {
(async () => {
const node = await Node({ url: 'https://sdk-testnet.aepps.com' })
const account = MemoryAccount({ keypair: 'YOUR_KEYPAIR' })
// Init client
const client = await Universal({
nodes: [{ name: 'test-net', instance: node }],
accounts: [ account ]
})
client.height().then(height => {
console.log('Current Block', height)
})
})
})()
```

[webpack]: https://webpack.js.org/
Expand Down
24 changes: 16 additions & 8 deletions docs/guides/import-vuejs.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## [Vue.js]

Adding aepp-sdk to a Vue.js project requires nothing special, but it should be
noted that `Ae.create` is asynchronous which needs to be taken into account.
noted that `client creation` is asynchronous which needs to be taken into account.

```bash
vue init webpack my-project
Expand All @@ -13,10 +13,12 @@ npm install @aeternity/aepp-sdk
# src/components/HelloWorld.vue

<script>
// import Aepp
import Aepp from '@aeternity/aepp-sdk/es/ae/aepp'
// Init Ae Client
const ae = Aepp()
// import Universal stamp
import Universal from '@aeternity/aepp-sdk/es/ae/universal'
// import Node
import Node from '@aeternity/aepp-sdk/es/node'
// import Account
import MemoryAccount from '@aeternity/aepp-sdk/es/account/memory'

export default {
name: 'HelloWorld',
Expand All @@ -26,9 +28,15 @@ export default {
}
},
async mounted () {
// Wait Ae client
const client = await ae
// Start Using Ae client
const node = await Node({ url: 'https://sdk-testnet.aepps.com' })
const account = MemoryAccount({ keypair: 'YOUR_KEYPAIR' })

// Init client
const client = await Universal({
nodes: [{ name: 'test-net', instance: node }],
accounts: [ account ]
})
// Start Using client
const height = await client.height()
this.msg = 'Current Block: ' + height
}
Expand Down
6 changes: 5 additions & 1 deletion es/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import * as Keystore from './utils/keystore'
import * as Bytes from './utils/bytes'
import * as TxBuilder from './tx/builder'
import * as TxBuilderHelper from './tx/builder/helpers'
import * as AmountFormatter from './utils/amount-formatter'
import * as SCHEMA from './tx/builder/schema'
import HdWallet from './utils/hd-wallet'

import Ae from './ae'
Expand Down Expand Up @@ -47,6 +49,7 @@ import Universal from './ae/universal'
import ContractACI from './contract/aci'

export {
AmountFormatter,
Account,
Accounts,
Ae,
Expand Down Expand Up @@ -77,5 +80,6 @@ export {
TxBuilder,
TxBuilderHelper,
Universal,
Wallet
Wallet,
SCHEMA
}