@revibase/core 0.0.60 → 0.1.0
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 +35 -18
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -477
- package/dist/index.d.ts +42 -477
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -108,20 +108,29 @@ Use `settings`, `compressed`, and (optionally) `walletAddress` in the following
|
|
|
108
108
|
### 2. Native SOL transfer
|
|
109
109
|
|
|
110
110
|
```ts
|
|
111
|
-
import {
|
|
111
|
+
import {
|
|
112
|
+
nativeTransferIntent,
|
|
113
|
+
retrieveTransactionManager,
|
|
114
|
+
getSignedTransactionManager,
|
|
115
|
+
} from "@revibase/core";
|
|
112
116
|
import type { TransactionSigner } from "gill";
|
|
113
117
|
|
|
114
118
|
declare const payer: TransactionSigner;
|
|
115
119
|
declare const memberSigner: TransactionSigner;
|
|
116
120
|
declare const destination: string;
|
|
117
121
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
// For wallets with a transaction manager, add its signer. See Custom transactions for full flow.
|
|
123
|
+
const tmResult = retrieveTransactionManager(
|
|
124
|
+
memberSigner.address.toString(),
|
|
125
|
+
settingsAccount,
|
|
126
|
+
);
|
|
127
|
+
const transactionManagerSigner =
|
|
128
|
+
"transactionManagerAddress" in tmResult
|
|
129
|
+
? await getSignedTransactionManager({
|
|
130
|
+
transactionManagerAddress: tmResult.transactionManagerAddress,
|
|
131
|
+
userAddressTreeIndex: tmResult.userAddressTreeIndex,
|
|
132
|
+
})
|
|
133
|
+
: null;
|
|
125
134
|
|
|
126
135
|
const instructions = await nativeTransferIntent({
|
|
127
136
|
settings,
|
|
@@ -134,13 +143,17 @@ const instructions = await nativeTransferIntent({
|
|
|
134
143
|
payer,
|
|
135
144
|
compressed,
|
|
136
145
|
});
|
|
137
|
-
//
|
|
146
|
+
// Build tx from instructions with prepareTransactionMessage (or similar), then send.
|
|
138
147
|
```
|
|
139
148
|
|
|
140
149
|
### 3. SPL / Token-2022 transfer
|
|
141
150
|
|
|
142
151
|
```ts
|
|
143
|
-
import {
|
|
152
|
+
import {
|
|
153
|
+
tokenTransferIntent,
|
|
154
|
+
retrieveTransactionManager,
|
|
155
|
+
getSignedTransactionManager,
|
|
156
|
+
} from "@revibase/core";
|
|
144
157
|
import type { Address, TransactionSigner } from "gill";
|
|
145
158
|
import { TOKEN_2022_PROGRAM_ADDRESS } from "gill/programs";
|
|
146
159
|
|
|
@@ -149,13 +162,17 @@ declare const memberSigner: TransactionSigner;
|
|
|
149
162
|
declare const destinationWallet: Address;
|
|
150
163
|
declare const mint: Address;
|
|
151
164
|
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
165
|
+
const tmResult = retrieveTransactionManager(
|
|
166
|
+
memberSigner.address.toString(),
|
|
167
|
+
settingsAccount,
|
|
168
|
+
);
|
|
169
|
+
const transactionManagerSigner =
|
|
170
|
+
"transactionManagerAddress" in tmResult
|
|
171
|
+
? await getSignedTransactionManager({
|
|
172
|
+
transactionManagerAddress: tmResult.transactionManagerAddress,
|
|
173
|
+
userAddressTreeIndex: tmResult.userAddressTreeIndex,
|
|
174
|
+
})
|
|
175
|
+
: null;
|
|
159
176
|
|
|
160
177
|
const instructions = await tokenTransferIntent({
|
|
161
178
|
settings,
|
|
@@ -170,7 +187,7 @@ const instructions = await tokenTransferIntent({
|
|
|
170
187
|
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
|
|
171
188
|
compressed,
|
|
172
189
|
});
|
|
173
|
-
//
|
|
190
|
+
// Build tx from instructions, then send. Same signer pattern as native transfer if using a transaction manager.
|
|
174
191
|
```
|
|
175
192
|
|
|
176
193
|
---
|