Skip to content

Commit

Permalink
docs: ✏️ provide English version
Browse files Browse the repository at this point in the history
  • Loading branch information
hzz780 committed Dec 21, 2019
1 parent 3878915 commit cb3b4e5
Show file tree
Hide file tree
Showing 82 changed files with 967 additions and 190 deletions.
14 changes: 14 additions & 0 deletions docs-zh/ApiReference/Api/callAElfChain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# CALL_AELF_CHAIN

```javascript
const txid = 'c45edfcca86f4f528cd8e30634fa4ac53801aae05365cfefc3bfe9b652fe5768';
aelf.chain.getTxResult(txid, (err, result) => {
console.log('>>>>>>>>>>>>> getTxResult >>>>>>>>>>>>>');
console.log(err, result);
});

// result = {
// Status: "NotExisted"
// TransactionId: "ff5bcd126f9b7f22bbfd0816324390776f10ccb3fe0690efc84c5fcf6bdd3fc6"
// }
```
14 changes: 14 additions & 0 deletions docs-zh/ApiReference/Api/callAElfContract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# CALL_AELF_CONTRACT

```javascript
tokenContract.Transfer(
{
symbol: 'ELF',
to: '6WZNJgU5MHWsvzZmPpC7cW6g3qciniQhDKRLCvbQcTCcVFH',
amount: 100
},
(err, result) => {
console.log('>>>>>>>>>>>>>>>>>>>', result);
}
);
```
19 changes: 19 additions & 0 deletions docs-zh/ApiReference/Api/callAElfContractReadonly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# CALL_AELF_CONTRACT_READONLY

```javascript
tokenContract.GetBalance.call(
{
symbol: 'AELF',
owner: '65dDNxzcd35jESiidFXN5JV8Z7pCwaFnepuYQToNefSgqk9'
},
(err, result) => {
console.log('>>>>>>>>>>>>>>>>>>>', result);
}
);

// result = {
// symbol: "AELF",
// owner: "65dDNxzcd35jESiidFXN5JV8Z7pCwaFnepuYQToNefSgqk9",
// balance: 0
// }
```
36 changes: 36 additions & 0 deletions docs-zh/ApiReference/Api/checkPermission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# CHECK_PERMISSION / checkPermission

```javascript
aelf.checkPermission({
appName: 'test',
type: 'address', // if you did not set type, it aways get by domain.
address: '4WBgSL2fSem9ABD4LLZBpwP8eEymVSS1AyTBCqXjt5cfxXK'
}, (error, result) => {
console.log('checkPermission>>>>>>>>>>>>>>>>>', result);
});

// result = {
// ...,
// permissions:[
// {
// address: '...',
// appName: 'test',
// contracts: [{
// chainId: 'AELF',
// contractAddress: '4rkKQpsRFt1nU6weAHuJ6CfQDqo6dxruU3K3wNUFr6ZwZYc',
// contractName: 'token',
// description: 'token contract',
// github: ''
// },
// {
// chainId: 'AELF TEST',
// contractAddress: 'TEST contractAddress',
// contractName: 'TEST contractName',
// description: 'contract description',
// github: ''
// }],
// domian: 'Dapp domain'
// }
// ]
// }
```
29 changes: 29 additions & 0 deletions docs-zh/ApiReference/Api/contractAtAsync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# INIT_AELF_CONTRACT / contractAtAsync

```javascript
// In aelf-sdk.js wallet is the realy wallet.
// But in extension sdk, we just need the address of the wallet.
const tokenContract;
const wallet = {
address: '2JqnxvDiMNzbSgme2oxpqUFpUYfMjTpNBGCLP2CsWjpbHdu'
};
// It is different from the wallet created by Aelf.wallet.getWalletByPrivateKey();
// There is only one value named address;
aelf.chain.contractAtAsync(
'4rkKQpsRFt1nU6weAHuJ6CfQDqo6dxruU3K3wNUFr6ZwZYc',
wallet,
(error, result) => {
console.log('>>>>>>>>>>>>> contractAtAsync >>>>>>>>>>>>>');
console.log(error, result);
tokenContract = result;
}
);

// result = {
// Approve: ƒ (),
// Burn: ƒ (),
// ChargeTransactionFees: ƒ (),
// ClaimTransactionFees: ƒ (),
// ....
// }
```
23 changes: 23 additions & 0 deletions docs-zh/ApiReference/Api/getAddress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# GET_ADDRESS / getAddress

```javascript
aelf.getAddress({
appName: 'test'
}, (error, result) => {
console.log('>>>>>>>>>>>>>>>>>>>', result);
});

// result = {
// ...,
// addressList: [
// {
// address: '...',
// name: '...',
// publicKey: {
// x: '...',
// y: '...'
// }
// }
// ]
// }
```
29 changes: 29 additions & 0 deletions docs-zh/ApiReference/Api/getChainInformation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# GET_CHAIN_INFORMATION / getChainInformation

```javascript
const aelf = new window.NightElf.AElf({
// Enter your test address in this location
httpProvider: [
'https://127.0.0.1:8000/chain', // host
null, // timeout
null, // user
null, // password
// header
[{
name: 'Accept',
value: 'text/plain;v=1.0'
}]
],
appName // your Dapp name
});

aelf.chain.getChainInformation((error, result) => {
console.log('>>>>>>>>>>>>> connectChain >>>>>>>>>>>>>');
console.log(error, result);
});

// result = {
// ChainId: "AELF"
// GenesisContractAddress: "61W3AF3Voud7cLY2mejzRuZ4WEN8mrDMioA9kZv3H8taKxF"
// }
```
51 changes: 51 additions & 0 deletions docs-zh/ApiReference/Api/login.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# LOGIN / login

```javascript
aelf.login({
appName: 'test',
chainId: 'AELF',
payload: {
method: 'LOGIN',
contracts: [{
chainId: 'AELF',
contractAddress: '4rkKQpsRFt1nU6weAHuJ6CfQDqo6dxruU3K3wNUFr6ZwZYc',
contractName: 'token',
description: 'token contract',
github: ''
}, {
chainId: 'AELF TEST',
contractAddress: '2Xg2HKh8vusnFMQsHCXW1q3vys5JxG5ZnjiGwNDLrrpb9Mb',
contractName: 'TEST contractName',
description: 'contract description',
github: ''
}]
}
}, (error, result) => {
console.log('login>>>>>>>>>>>>>>>>>>', result);
});

// keychain = {
// keypairs: {
// name: 'your keypairs name',
// address: 'your keypairs address',
// mnemonic: 'your keypairs mnemonic',
// privateKey: 'your keypairs privateKey',
// publicKey: {
// x: 'f79c25eb......',
// y: '7fa959ed......'
// }
// },
// permissions: [{
// appName: 'test',
// address: 'your keyparis address',
// contracts: [{
// chainId: 'AELF',
// contractAddress: '4rkKQpsRFt1nU6weAHuJ6CfQDqo6dxruU3K3wNUFr6ZwZYc',
// contractName: 'token',
// description: 'token contract',
// github: ''
// }],
// domain: 'Dapp domain'
// }]
// }
```
29 changes: 29 additions & 0 deletions docs-zh/ApiReference/Api/removeContractPermission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# REMOVE_CONTRACT_PERMISSION / removeContractPermission

```javascript
aelf.removeContractPermission({
appName: 'test',
chainId: 'AELF',
payload: {
contractAddress: '2Xg2HKh8vusnFMQsHCXW1q3vys5JxG5ZnjiGwNDLrrpb9Mb'
}
}, (error, result) => {
console.log('removeContractPermission>>>>>>>>>>>>>>>>>>>', result);
});

// keychain = {
// keypairs: {...},
// permissions: [{
// appName: 'test',
// address: 'your keyparis address',
// contracts: [{
// chainId: 'AELF',
// contractAddress: '4rkKQpsRFt1nU6weAHuJ6CfQDqo6dxruU3K3wNUFr6ZwZYc',
// contractName: 'token',
// description: 'token contract',
// github: ''
// }],
// domain: 'Dapp domain'
// }]
// }
```
30 changes: 30 additions & 0 deletions docs-zh/ApiReference/Api/removeMethodsWhitelist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# REMOVE_METHODS_WHITELIST / removeMethodsWhitelist

```javascript
aelf.removeMethodsWhitelist({
appName: 'test',
chainId: 'AELF',
payload: {
contractAddress: '2Xg2HKh8vusnFMQsHCXW1q3vys5JxG5ZnjiGwNDLrrpb9Mb',
whitelist: ['Approve']
}
}, (error, result) => {
console.log('removeWhitelist>>>>>>>>>>>>>>>>>', result);
});
// keychain = {
// keypairs: {...},
// permissions: [{
// appName: 'test',
// address: 'your keyparis address',
// contracts: [{
// chainId: 'AELF',
// contractAddress: '4rkKQpsRFt1nU6weAHuJ6CfQDqo6dxruU3K3wNUFr6ZwZYc',
// contractName: 'token',
// description: 'token contract',
// github: '',
// whitelist: {}
// }],
// domain: 'Dapp domain'
// }]
// }
```
44 changes: 44 additions & 0 deletions docs-zh/ApiReference/Api/setContractPermission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# SET_CONTRACT_PERMISSION / setContractPermission

```javascript
aelf.setContractPermission({
appName: 'test',
hainId: 'AELF',
payload: {
address: '2JqnxvDiMNzbSgme2oxpqUFpUYfMjTpNBGCLP2CsWjpbHdu',
contracts: [{
chainId: 'AELF',
contractAddress: 'TEST contractAddress',
contractName: 'AAAA',
description: 'contract description',
github: ''
}]
}
}, (error, result) => {
console.log('>>>>>>>>>>>>>', result);
});

// keychain = {
// keypairs: {...},
// permissions: [{
// appName: 'test',
// address: 'your keyparis address',
// contracts: [{
// chainId: 'AELF',
// contractAddress: '4rkKQpsRFt1nU6weAHuJ6CfQDqo6dxruU3K3wNUFr6ZwZYc',
// contractName: 'token',
// description: 'token contract',
// github: '',
// whitelist: {}
// },
// {
// chainId: 'AELF',
// contractAddress: 'TEST contractAddress',
// contractName: 'AAAA',
// description: 'contract description',
// github: ''
// }],
// domain: 'Dapp domain'
// }]
// }
```
Loading

0 comments on commit cb3b4e5

Please sign in to comment.