Documentation Index
Fetch the complete documentation index at: https://mintlify.com/frol/near-connect-ios/llms.txt
Use this file to discover all available pages before exploring further.
DelegateActionResult contains the signed delegate actions returned by the wallet after successfully signing meta transaction actions using the NEP-366 standard.
Properties
Raw JSON result string from the wallet containing the signed delegate actions. This payload can be sent to a relayer service to execute the meta transaction.
Usage
DelegateActionResult is returned by:
signDelegateActions(delegateActions:)
Meta transactions allow users to have transactions signed by their wallet without paying gas fees. A relayer service submits the signed delegate actions to the blockchain on behalf of the user.
Example: Signing Delegate Actions
do {
let delegateActions: [[String: Any]] = [
[
"receiverId": "contract.testnet",
"actions": [
[
"type": "FunctionCall",
"params": [
"methodName": "set_greeting",
"args": Data("Hello, World!".utf8).base64EncodedString(),
"gas": "30000000000000",
"deposit": "0"
]
]
]
]
]
let result = try await walletManager.signDelegateActions(
delegateActions: delegateActions
)
if let signedPayload = result.rawResult {
print("Delegate actions signed successfully")
// Send the signed payload to your relayer service
try await submitToRelayer(signedPayload)
}
} catch {
print("Failed to sign delegate actions: \(error)")
}
func executeBatchMetaTransaction() async {
do {
// Create multiple delegate actions
let delegateActions: [[String: Any]] = [
[
"receiverId": "token.testnet",
"actions": [
[
"type": "FunctionCall",
"params": [
"methodName": "ft_transfer",
"args": encodeArgs(["receiver_id": "alice.testnet", "amount": "100"]),
"gas": "30000000000000",
"deposit": "1"
]
]
]
],
[
"receiverId": "nft.testnet",
"actions": [
[
"type": "FunctionCall",
"params": [
"methodName": "nft_mint",
"args": encodeArgs(["token_id": "token-123"]),
"gas": "50000000000000",
"deposit": "10000000000000000000000"
]
]
]
]
]
let result = try await walletManager.signDelegateActions(
delegateActions: delegateActions
)
if let signedPayload = result.rawResult {
print("Batch delegate actions signed")
// Submit to relayer
let txHash = try await relayerService.submit(signedPayload)
print("Meta transaction submitted: \(txHash)")
}
} catch {
print("Batch meta transaction failed: \(error)")
}
}
func encodeArgs(_ args: [String: Any]) -> String {
let data = try! JSONSerialization.data(withJSONObject: args)
return data.base64EncodedString()
}
Notes
- Delegate actions are signed but not broadcast by the wallet
- A relayer service is responsible for submitting the signed actions to the blockchain
- The relayer pays the gas fees, enabling gasless transactions for users
- Each delegate action must specify a
receiverId (contract) and an array of actions
- The
rawResult contains the full signed payload needed by the relayer
- This feature implements the NEP-366 meta transaction standard