You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Burn owned asset(token/coin), return `hash` of submitted transaction if succeed.
48
-
49
-
<!-- TBD
50
-
### signMessage(message: string)
51
-
52
-
Return signed in hex string. -->
22
+
### connect()
23
+
24
+
```javascript
25
+
/**
26
+
* Connect to the provider
27
+
* @returns{string} return the connected address
28
+
*/
29
+
asyncfunctionconnect() {
30
+
constprovider=getProvider();
31
+
awaitprovider.connect();
32
+
returnprovider.address;
33
+
}
34
+
```
35
+
36
+
### disconnect()
37
+
38
+
```javascript
39
+
/**
40
+
* Disconnect to the provider
41
+
* @returns{boolean} Whether the disconnection is successfully closed
42
+
*/
43
+
asyncfunctiondisconnect() {
44
+
constprovider=getProvider();
45
+
returnawaitprovider.disconnect();
46
+
}
47
+
```
48
+
49
+
### getBalances()
50
+
51
+
```javascript
52
+
/**
53
+
* Get balances of the connected address
54
+
* @returns{Promise<Array<{balance: string, assetId: string, assetName: string}>>} A promise that resolves with an array of balance objects.
55
+
*/
56
+
asyncfunctiongetBalances() {
57
+
constprovider=getProvider();
58
+
returnawaitprovider.getBalances();
59
+
}
60
+
```
61
+
62
+
### getTransactionInfo(tx: string)
63
+
64
+
```javascript
65
+
/**
66
+
* Represents the status of a transaction.
67
+
* @typedef{Object}TxStatus
68
+
* @property{string}hash - The transaction hash.
69
+
* @property{string}fee - The transaction fee.
70
+
* @property{string}type - The type of the transaction.
71
+
* @property{string}status - The status of the transaction.
72
+
* @property{number}blockSequence - The block sequence number.
73
+
* @property{string}timestamp - The timestamp of the transaction.
74
+
* @property{AssetBalanceDelta[]}assetBalanceDeltas - Array of asset balance changes.
75
+
*/
76
+
77
+
/**
78
+
* Represents a change in asset balance.
79
+
* @typedef{Object}AssetBalanceDelta
80
+
* @property{string}assetId - The ID of the asset.
81
+
* @property{string}delta - The change in balance.
82
+
* @property{string}assetName - The name of the asset.
83
+
*/
84
+
85
+
/**
86
+
* Retrieves the transaction status.
87
+
* @returns{Promise<TxStatus>} A promise that resolves with transaction status object.
88
+
*/
89
+
asyncfunctiongetTransactionInfo(txId:string) {
90
+
constprovider=getProvider();
91
+
returnawaitprovider.getTransaction(txId);
92
+
}
93
+
```
94
+
95
+
### getTransactions()
96
+
97
+
```javascript
98
+
/**
99
+
* Retrieves an array of the connected address's transactions' status.
100
+
* @returns{Promise<TxStatus[]>} A promise that resolves with an array of transaction status objects.
101
+
*/
102
+
asyncfunctiongetAddressTransactions() {
103
+
constprovider=getProvider();
104
+
returnawaitprovider.getTransactions();
105
+
}
106
+
```
107
+
108
+
### getOreos
109
+
110
+
```javascript
111
+
/**
112
+
* Get Orescriptions NFT of the connected address
113
+
* @returns{Promise<Array<{tick: string, tickIndex: number, data: string, removedByOwner: boolean, assetId: string, url: string}>>} A promise that resolves with an array of Oreo objects.
114
+
*/
115
+
asyncfunctiongetOreos() {
116
+
constprovider=getProvider();
117
+
returnawaitprovider.getOreos();
118
+
}
119
+
```
120
+
121
+
### sendTransaction(txInfo)
122
+
123
+
```javascript
124
+
/**
125
+
* Send a transaction using the provided transaction information.
126
+
* @param{Object}txInfo - The transaction information.
127
+
* @param{string}txInfo.from - The sender's address.
128
+
* @param{string}txInfo.to - The recipient's address.
129
+
* @param{string}txInfo.value - The amount of the asset to send.
130
+
* @param{string}txInfo.memo - A memo for the transaction.
131
+
* @param{string}txInfo.assetId - The ID of the asset being sent.
132
+
* @returns{Promise<string>} A promise that resolves with the transaction result.
133
+
*/
134
+
asyncfunctionsendTransaction(txInfo) {
135
+
constprovider=getProvider();
136
+
returnawaitprovider.sendTransaction(txInfo);
137
+
}
138
+
```
139
+
140
+
### generalTransaction(txInfo)
141
+
142
+
```javascript
143
+
/**
144
+
* Represents output part of the transaction.
145
+
* @typedef{Object}OutPutParams
146
+
* @property{string}publicAddress - The recipient's address.
147
+
* @property{string}amount - The amount of the asset to send.
148
+
* @property{string}memo - A memo for the transaction.
149
+
* @property{string}assetId - The ID of the asset being sent.
150
+
* @property{OutPutParams[]}outputs - Array of output.
151
+
*/
152
+
153
+
/**
154
+
* Represents mint part of the transaction.
155
+
* @typedef{Object}MintAssetParams
156
+
* @property{string}value - The value of the asset to mint in the transaction.
157
+
* @property{string}assetId - The ID of the asset being minted.
158
+
* @property{string}metadata - The metadata info of the asset being minted.
159
+
* @property{MintAssetParams[]}mints - Array of mint.
160
+
*/
161
+
162
+
/**
163
+
* Represents burn part of the transaction.
164
+
* @typedef{Object}BurnAssetParams
165
+
* @property{string}value - The value of the asset to burn in the transaction.
166
+
* @property{string}assetId - The ID of the asset being burned.
167
+
* @property{BurnAssetParams[]}burns - Array of burn.
168
+
*/
169
+
170
+
/**
171
+
* Send a transaction using the provided transaction information.
172
+
* @param{Object}txInfo - The transaction information.
173
+
* @param{string}txInfo.from - The sender's address.
174
+
* @param{string}txInfo.fee - The transaction fee.
175
+
* @param{string}txInfo.outputs - Array of output.
176
+
* @param{string}txInfo.mints - Array of mint.
177
+
* @param{string}txInfo.burns - Array of burn.
178
+
* @returns{Promise<string>} A promise that resolves with the transaction result.
0 commit comments