libra-sdk-mol
Version:
Javascript SDK for Libra Network and Move Smart Contract powered by MoveOnLibra OpenAPI
172 lines (118 loc) • 3.61 kB
Markdown
Method | HTTP request | Description
------------- | ------------- | -------------
[**compileModule**](move_api.md
[**compileScript**](move_api.md
[**getCode**](move_api.md
[**publish**](move_api.md
[**execute**](move_api.md
<br/><hr/>
Compile move module of the given source file
```javascript
const appkey = "*****" // your app key
var client = new LibraClient("testnet", appkey);
try{
data = await client.MoveAPI.compileModule(publish_account_address, source_file);
console.log(data) //the compiled bytecode id
} catch (error) {
console.log(error);
}
```
Name | Type | Description
------------- | ------------- | -------------
**publish_account_address** | **string**|
**source_file** | **file**|
| |
[**CodeIdResult**](../CodeIdResult.md)
<br/><hr/>
Compile move script of the given source file
```javascript
const appkey = "*****" // your app key
var client = new LibraClient("testnet", appkey);
try{
data = await client.MoveAPI.compileScript(sender_address, source_file);
console.log(data) //the compiled bytecode id
} catch (error) {
console.log(error);
}
```
Name | Type | Description
------------- | ------------- | -------------
**sender_address** | **string**|
**source_file** | **file**|
| |
[**CodeIdResult**](../CodeIdResult.md)
<br/><hr/>
Download compiled move bytecode by id
```javascript
const appkey = "*****" // your app key
var client = new LibraClient("testnet", appkey);
try{
data = await client.MoveAPI.getCode(code_id);
console.log(data) //the compiled bytecode id
} catch (error) {
console.log(error);
}
```
Name | Type | Description
------------- | ------------- | -------------
**code_id** | **string**|
| |
[**array**](../array.md)
<br/><hr/>
Publish move module on-chain
```javascript
const appkey = "*****" // your app key
var client = new LibraClient("testnet", appkey);
try{
data = await client.MoveAPI.publish(code_id, publish_account_address);
console.log(data) //SignedTransaction
} catch (error) {
console.log(error);
}
```
Name | Type | Description
------------- | ------------- | -------------
**code_id** | **string**|
**publish_account_address** | **string**|
| |
[**SignedTransaction**](../SignedTransaction.md)
<br/><hr/>
Execute custom move script on-chain
```javascript
const appkey = "*****" // your app key
var client = new LibraClient("testnet", appkey);
try{
data = await client.MoveAPI.execute(code_id, sender_account_address, script_args);
console.log(data) //SignedTransaction
} catch (error) {
console.log(error);
}
```
Name | Type | Description
------------- | ------------- | -------------
**code_id** | **string**|
**sender_account_address** | **string**|
**script_args** | **array**|
| |
[**SignedTransaction**](../SignedTransaction.md)