@vela-ventures/aosync-sdk-react 1.0.6 → 1.0.7

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 CHANGED
@@ -91,16 +91,17 @@ export default WalletComponent;
91
91
 
92
92
  The `useWallet` hook provides the following methods and properties:
93
93
 
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. |
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
+ | `signAODataItem(dataItem)` | Signs an ANS-104 Data Item. |
104
105
 
105
106
  ## License
106
107
 
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { DataItem } from "arconnect";
1
2
  import Transaction from "arweave/web/lib/transaction";
2
3
  export interface AOSyncSDKContext {
3
4
  isConnected: boolean;
@@ -10,5 +11,6 @@ export interface AOSyncSDKContext {
10
11
  name: string;
11
12
  value: string;
12
13
  }[], data: string) => Promise<any>;
14
+ signAODataItem: (dataItem: DataItem) => Promise<any>;
13
15
  sign: (transaction: Transaction) => Promise<Transaction>;
14
16
  }
@@ -81,6 +81,26 @@ export function AOSyncProvider({ gatewayConfig = { host: "arweave.net", port: 44
81
81
  throw error;
82
82
  }
83
83
  });
84
+ const signAODataItem = (dataItem) => __awaiter(this, void 0, void 0, function* () {
85
+ try {
86
+ const signedDataItem = yield walletRef.current.signDataItem(dataItem);
87
+ const response = yield fetch(muUrl, {
88
+ method: "POST",
89
+ headers: {
90
+ "Content-Type": "application/octet-stream",
91
+ },
92
+ body: signedDataItem,
93
+ });
94
+ if (!response.ok) {
95
+ throw new Error("Network response was not ok");
96
+ }
97
+ return signedDataItem;
98
+ }
99
+ catch (error) {
100
+ console.error("Error signing AO message:", error);
101
+ throw error;
102
+ }
103
+ });
84
104
  const signAOMessage = (target, tags, data) => __awaiter(this, void 0, void 0, function* () {
85
105
  try {
86
106
  const dataItem = {
@@ -130,6 +150,7 @@ export function AOSyncProvider({ gatewayConfig = { host: "arweave.net", port: 44
130
150
  getAllAddresses,
131
151
  sendAR,
132
152
  signAOMessage,
153
+ signAODataItem,
133
154
  sign,
134
155
  } }, children));
135
156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vela-ventures/aosync-sdk-react",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"