Skip to content

Commit c22d171

Browse files
committed
Bump version v0.0.2
1 parent 8ccd73a commit c22d171

File tree

3 files changed

+193
-50
lines changed

3 files changed

+193
-50
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,16 @@ OreoWallet aims to build an easy-to-use Type2 extension wallet for Ironfish bloc
6666

6767
## Features
6868

69-
| Feature | Status |
70-
| ----------------------- | ------- |
71-
| Account creation/import ||
72-
| IRON native token ||
73-
| User created asset ||
74-
| Orescriptions NFT ||
75-
| Dapp provider | Ongoing |
76-
| ... | ... |
69+
| Feature | Status |
70+
| ----------------------- | ------ |
71+
| Account creation/import ||
72+
| IRON native token ||
73+
| User created asset ||
74+
| Orescriptions NFT ||
75+
| Dapp provider ||
76+
| Local data provider ||
77+
| Local prover ||
78+
| ... | ... |
7779

7880
## Documentation
7981

provider.md

Lines changed: 174 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,184 @@ OreoWallet injects the provider API into websites visited by its users using the
44

55
## Properties
66

7-
### window.ironfish.isOreoWallet
8-
7+
### window.ironfish
8+
9+
```javascript
10+
function getProvider() {
11+
const provider = window.ironfish
12+
if (!provider) {
13+
throw new Error("Install OreoWallet first.");
14+
}
15+
return provider;
16+
}
17+
```
918
This property is `true` if the user has OreoWallet installed.
1019

1120
## Methods
1221

13-
### isConnected()
14-
15-
Return `true` if the provider is connect to current chain.
16-
17-
### getAccount()
18-
19-
Return `ViewAccount` of the connected wallet.
20-
21-
### getNetwork()
22-
23-
Return `Network` of current wallet (mainnet or testnet).
24-
25-
### getBalances(address: string)
26-
27-
Return `Balance[]` of cureent connected wallet.
28-
29-
### getOrescriptions(address: string)
30-
31-
Return `Orescriptions[]` of cureent connected wallet.
32-
33-
### sendNativeCoin({toAddress: string, amount: BigInt, memo?: string, fee?: string})
34-
35-
Send native IRON coin to others, return `hash` of submitted transaction if succeed.
36-
37-
### sendAsset({toAddress: string, amount: BigInt, assetId: string, memo?: string, fee?: string})
38-
39-
Send user created token to others, return `hash` of submitted transaction if succeed.
40-
41-
### mintAsset({value: string, assetId?: string, name?: string, metadata?: string, fee?: string})
42-
43-
Create new asset(token), return `hash` of submitted transaction if succeed.
44-
45-
### burnAsset({value: string, assetId: string, fee?: string})
46-
47-
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+
async function connect() {
30+
const provider = getProvider();
31+
await provider.connect();
32+
return provider.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+
async function disconnect() {
44+
const provider = getProvider();
45+
return await provider.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+
async function getBalances() {
57+
const provider = getProvider();
58+
return await provider.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+
async function getTransactionInfo(txId: string) {
90+
const provider = getProvider();
91+
return await provider.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+
async function getAddressTransactions() {
103+
const provider = getProvider();
104+
return await provider.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+
async function getOreos() {
116+
const provider = getProvider();
117+
return await provider.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+
async function sendTransaction(txInfo) {
135+
const provider = getProvider();
136+
return await provider.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.
179+
*/
180+
async function generalTransaction(txInfo) {
181+
const provider = getProvider();
182+
return await provider.generalTransaction(txInfo);
183+
}
184+
```
53185

54186
## Special Thanks
55187

release-notes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# OreoWallet Release Notes
22

3+
## v0.0.2
4+
5+
- Support Dapp provider
6+
- Support import via Ironfish spending key
7+
- Support change data provider
8+
- Support change prover
9+
- Support account management
10+
- UI/UX improvements
11+
312
## v0.0.1
413

514
- Support basic wallet functionality

0 commit comments

Comments
 (0)