@vela-ventures/aosync-sdk-react 1.0.11 → 1.0.13
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 +10 -11
- package/dist/types.d.ts +1 -5
- package/dist/walletContext.js +3 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,17 +92,16 @@ export default WalletComponent;
|
|
|
92
92
|
|
|
93
93
|
The `useWallet` hook provides the following methods and properties:
|
|
94
94
|
|
|
95
|
-
| Method/Property
|
|
96
|
-
|
|
|
97
|
-
| `isConnected`
|
|
98
|
-
| `connect()`
|
|
99
|
-
| `disconnect()`
|
|
100
|
-
| `getAddress()`
|
|
101
|
-
| `getAllAddresses()`
|
|
102
|
-
| `sendAR(recipient, quantity)`
|
|
103
|
-
| `sign(transaction)`
|
|
104
|
-
| `signAOMessage(
|
|
105
|
-
| `signAODataItem(dataItem)` | Signs an ANS-104 Data Item. |
|
|
95
|
+
| Method/Property | Description |
|
|
96
|
+
| ----------------------------- | ---------------------------------------------- |
|
|
97
|
+
| `isConnected` | Boolean indicating if the wallet is connected. |
|
|
98
|
+
| `connect()` | Connects to the wallet. |
|
|
99
|
+
| `disconnect()` | Disconnects from the wallet. |
|
|
100
|
+
| `getAddress()` | Returns the currently active wallet address. |
|
|
101
|
+
| `getAllAddresses()` | Returns all wallet addresses. |
|
|
102
|
+
| `sendAR(recipient, quantity)` | Sends AR to the specified address. |
|
|
103
|
+
| `sign(transaction)` | Signs a transaction using the wallet. |
|
|
104
|
+
| `signAOMessage(dataItem)` | Signs an ANS-104 Data Item. |
|
|
106
105
|
|
|
107
106
|
## License
|
|
108
107
|
|
package/dist/types.d.ts
CHANGED
|
@@ -7,10 +7,6 @@ export interface AOSyncSDKContext {
|
|
|
7
7
|
getAllAddresses: () => Promise<string[]>;
|
|
8
8
|
getAddress: () => Promise<string | undefined>;
|
|
9
9
|
sendAR: (recipient: string, quantity: string) => Promise<any>;
|
|
10
|
-
signAOMessage: (
|
|
11
|
-
name: string;
|
|
12
|
-
value: string;
|
|
13
|
-
}[], data: string) => Promise<any>;
|
|
14
|
-
signAODataItem: (dataItem: DataItem) => Promise<any>;
|
|
10
|
+
signAOMessage: (dataItem: DataItem) => Promise<any>;
|
|
15
11
|
sign: (transaction: Transaction) => Promise<Transaction>;
|
|
16
12
|
}
|
package/dist/walletContext.js
CHANGED
|
@@ -82,40 +82,10 @@ export function AOSyncProvider({ gatewayConfig = { host: "arweave.net", port: 44
|
|
|
82
82
|
throw error;
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
const
|
|
85
|
+
const signAOMessage = (dataItem) => __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
var _a;
|
|
86
87
|
try {
|
|
87
|
-
|
|
88
|
-
const response = yield fetch(muUrl, {
|
|
89
|
-
method: "POST",
|
|
90
|
-
headers: {
|
|
91
|
-
"Content-Type": "application/octet-stream",
|
|
92
|
-
},
|
|
93
|
-
body: signedDataItem,
|
|
94
|
-
});
|
|
95
|
-
if (!response.ok) {
|
|
96
|
-
throw new Error("Network response was not ok");
|
|
97
|
-
}
|
|
98
|
-
return signedDataItem;
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
console.error("Error signing AO message:", error);
|
|
102
|
-
throw error;
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
const signAOMessage = (target, tags, data) => __awaiter(this, void 0, void 0, function* () {
|
|
106
|
-
try {
|
|
107
|
-
const dataItem = {
|
|
108
|
-
data: data,
|
|
109
|
-
target,
|
|
110
|
-
tags: [
|
|
111
|
-
{ name: "Action", value: "Transfer" },
|
|
112
|
-
{ name: "SDK", value: "Beacon Wallet" },
|
|
113
|
-
{ name: "Data-Protocol", value: "ao" },
|
|
114
|
-
{ name: "Variant", value: "ao.TN.1" },
|
|
115
|
-
{ name: "Type", value: "Message" },
|
|
116
|
-
...tags,
|
|
117
|
-
],
|
|
118
|
-
};
|
|
88
|
+
(_a = dataItem === null || dataItem === void 0 ? void 0 : dataItem.tags) === null || _a === void 0 ? void 0 : _a.push({ name: "SDK", value: "Beacon Wallet" }, { name: "Data-Protocol", value: "ao" }, { name: "Variant", value: "ao.TN.1" }, { name: "Type", value: "Message" });
|
|
119
89
|
const signedDataItem = yield walletRef.current.signDataItem(dataItem);
|
|
120
90
|
const response = yield fetch(muUrl, {
|
|
121
91
|
method: "POST",
|
|
@@ -151,7 +121,6 @@ export function AOSyncProvider({ gatewayConfig = { host: "arweave.net", port: 44
|
|
|
151
121
|
getAllAddresses,
|
|
152
122
|
sendAR,
|
|
153
123
|
signAOMessage,
|
|
154
|
-
signAODataItem,
|
|
155
124
|
sign,
|
|
156
125
|
} }, children));
|
|
157
126
|
}
|