@vela-ventures/aosync-sdk-react 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/dist/types.d.ts +4 -1
- package/dist/walletContext.js +3 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,18 +14,18 @@ A lightweight React hook and context provider for integrating the Beacon Wallet
|
|
|
14
14
|
Install the package via npm:
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
npm install @vela-ventures/
|
|
17
|
+
npm install @vela-ventures/aosync-sdk-react
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
22
|
### 1: Wrap Your App with WalletProvider
|
|
23
23
|
|
|
24
|
-
To enable wallet functionality across your app, wrap your application with the
|
|
24
|
+
To enable wallet functionality across your app, wrap your application with the AOSyncProvider:
|
|
25
25
|
|
|
26
26
|
```javascript
|
|
27
27
|
import React from "react";
|
|
28
|
-
import { AOSyncProvider } from "@vela-ventures/
|
|
28
|
+
import { AOSyncProvider } from "@vela-ventures/aosync-sdk-react";
|
|
29
29
|
|
|
30
30
|
const App = () => {
|
|
31
31
|
return (
|
|
@@ -49,7 +49,7 @@ Access wallet functionality in any component with the useWallet hook:
|
|
|
49
49
|
|
|
50
50
|
```javascript
|
|
51
51
|
import React from "react";
|
|
52
|
-
import { useWallet } from "@vela-ventures/
|
|
52
|
+
import { useWallet } from "@vela-ventures/aosync-sdk-react";
|
|
53
53
|
|
|
54
54
|
const WalletComponent = () => {
|
|
55
55
|
const { isConnected, connect, disconnect, getAddress, sendAR } = useWallet();
|
|
@@ -91,16 +91,16 @@ export default WalletComponent;
|
|
|
91
91
|
|
|
92
92
|
The `useWallet` hook provides the following methods and properties:
|
|
93
93
|
|
|
94
|
-
| Method/Property
|
|
95
|
-
|
|
|
96
|
-
| `isConnected`
|
|
97
|
-
| `connect()`
|
|
98
|
-
| `disconnect()`
|
|
99
|
-
| `getAddress()`
|
|
100
|
-
| `getAllAddresses()`
|
|
101
|
-
| `sendAR(recipient, quantity)`
|
|
102
|
-
| `sign(transaction)`
|
|
103
|
-
| `signAOMessage(target,
|
|
94
|
+
| Method/Property | Description |
|
|
95
|
+
| -------------------------------------------------- | ---------------------------------------------- |
|
|
96
|
+
| `isConnected` | Boolean indicating if the wallet is connected. |
|
|
97
|
+
| `connect()` | Connects to the wallet. |
|
|
98
|
+
| `disconnect()` | Disconnects from the wallet. |
|
|
99
|
+
| `getAddress()` | Returns the currently active wallet address. |
|
|
100
|
+
| `getAllAddresses()` | Returns all wallet addresses. |
|
|
101
|
+
| `sendAR(recipient, quantity)` | Sends AR to the specified address. |
|
|
102
|
+
| `sign(transaction)` | Signs a transaction using the wallet. |
|
|
103
|
+
| `signAOMessage(target, tags, data)` | Signs an ANS-104 Data Item. |
|
|
104
104
|
|
|
105
105
|
## License
|
|
106
106
|
|
package/dist/types.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ export interface AOSyncSDKContext {
|
|
|
6
6
|
getAllAddresses: () => Promise<string[]>;
|
|
7
7
|
getAddress: () => Promise<string | undefined>;
|
|
8
8
|
sendAR: (recipient: string, quantity: string) => Promise<any>;
|
|
9
|
-
signAOMessage: (target: string,
|
|
9
|
+
signAOMessage: (target: string, tags: {
|
|
10
|
+
name: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[], data: string) => Promise<any>;
|
|
10
13
|
sign: (transaction: Transaction) => Promise<Transaction>;
|
|
11
14
|
}
|
package/dist/walletContext.js
CHANGED
|
@@ -81,19 +81,18 @@ export function AOSyncProvider({ gatewayConfig = { host: "arweave.net", port: 44
|
|
|
81
81
|
throw error;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
const signAOMessage = (target,
|
|
84
|
+
const signAOMessage = (target, tags, data) => __awaiter(this, void 0, void 0, function* () {
|
|
85
85
|
try {
|
|
86
86
|
const dataItem = {
|
|
87
|
-
data:
|
|
87
|
+
data: data,
|
|
88
88
|
target,
|
|
89
89
|
tags: [
|
|
90
90
|
{ name: "Action", value: "Transfer" },
|
|
91
|
-
{ name: "Recipient", value: recipient },
|
|
92
|
-
{ name: "Quantity", value: quantity },
|
|
93
91
|
{ name: "SDK", value: "Beacon Wallet" },
|
|
94
92
|
{ name: "Data-Protocol", value: "ao" },
|
|
95
93
|
{ name: "Variant", value: "ao.TN.1" },
|
|
96
94
|
{ name: "Type", value: "Message" },
|
|
95
|
+
...tags,
|
|
97
96
|
],
|
|
98
97
|
};
|
|
99
98
|
const signedDataItem = yield walletRef.current.signDataItem(dataItem);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vela-ventures/aosync-sdk-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -65,6 +65,6 @@
|
|
|
65
65
|
"react": "^18.2.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@vela-ventures/ao-sync-sdk": "^1.1.
|
|
68
|
+
"@vela-ventures/ao-sync-sdk": "^1.1.11"
|
|
69
69
|
}
|
|
70
70
|
}
|