You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Creates a new instance of the `NearSafe` class using the provided configuration.
60
+
*
61
+
* @param {NearSafeConfig} config - The configuration object required to initialize the `NearSafe` instance, including the Pimlico key and safe salt nonce.
62
+
* @returns {Promise<NearSafe>} - A promise that resolves to a new `NearSafe` instance.
* Constructs a user operation for the specified chain, including necessary gas fees, nonce, and paymaster data.
144
+
* Warning: Uses a private ethRPC with sensitive Pimlico API key (should be run server side).
145
+
*
146
+
* @param {Object} args - The arguments for building the transaction.
147
+
* @param {number} args.chainId - The ID of the blockchain network where the transaction will be executed.
148
+
* @param {MetaTransaction[]} args.transactions - A list of meta-transactions to be included in the user operation.
149
+
* @param {boolean} args.usePaymaster - Flag indicating whether to use a paymaster for gas fees. If true, the transaction will be sponsored by the paymaster.
150
+
* @returns {Promise<UserOperation>} - A promise that resolves to a complete `UserOperation` object, including gas fees, nonce, and paymaster data.
151
+
* @throws {Error} - Throws an error if the transaction set is empty or if any operation fails during the building process.
152
+
*/
110
153
asyncbuildTransaction(args: {
111
154
chainId: number;
112
155
transactions: MetaTransaction[];
@@ -147,15 +190,34 @@ export class NearSafe {
147
190
returnunsignedUserOp;
148
191
}
149
192
193
+
/**
194
+
* Signs a transaction with the NEAR adapter using the provided operation hash.
195
+
*
196
+
* @param {Hex} safeOpHash - The hash of the user operation that needs to be signed.
197
+
* @returns {Promise<Hex>} - A promise that resolves to the packed signature in hexadecimal format.
* Encodes a request to sign a transaction using either a paymaster or the user's own funds.
216
+
*
217
+
* @param {SignRequestData} signRequest - The data required to create the signature request. This includes information such as the chain ID and other necessary fields for the transaction.
218
+
* @param {boolean} usePaymaster - Flag indicating whether to use a paymaster for gas fees. If true, the transaction will be sponsored by the paymaster.
219
+
* @returns {Promise<EncodedTxData>} - A promise that resolves to the encoded transaction data for the NEAR and EVM networks.
220
+
*/
159
221
asyncencodeSignRequest(
160
222
signRequest: SignRequestData,
161
223
usePaymaster: boolean
@@ -177,18 +239,29 @@ export class NearSafe {
177
239
},
178
240
};
179
241
}
242
+
243
+
/**
244
+
* Broadcasts a user operation to the EVM network with a provided signature.
245
+
* Warning: Uses a private ethRPC with sensitive Pimlico API key (should be run server side).
246
+
*
247
+
* @param {number} chainId - The ID of the EVM network to which the transaction should be broadcasted.
248
+
* @param {FinalExecutionOutcome} outcome - The result of the NEAR transaction execution, which contains the necessary data to construct an EVM signature.
249
+
* @param {UserOperation} unsignedUserOp - The unsigned user operation to be broadcasted. This includes transaction data such as the destination address and data payload.
250
+
* @returns {Promise<{ signature: Hex; opHash: Hash }>} - A promise that resolves to an object containing the signature used and the hash of the executed user operation.
251
+
* @throws {Error} - Throws an error if the EVM broadcast fails, including the error message for debugging.
* Decodes transaction data for a given EVM transaction and extracts relevant details.
370
+
*
371
+
* @param {EvmTransactionData} data - The raw transaction data to be decoded.
372
+
* @returns {{ chainId: number; costEstimate: string; transactions: MetaTransaction[] }} - An object containing the chain ID, estimated cost, and a list of decoded meta-transactions.
0 commit comments