Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions wasmsdk/allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,14 @@ func updateAllocation(allocationID string,
return hash, err
}

func getUpdateAllocTicket(allocationID, userID, operationType string, roundExpiry int64) (string, error) {
sign, err := sdk.GetUpdateAllocTicket(allocationID, userID, operationType, roundExpiry)
if err != nil {
return "", err
}
return sign, err
}

// getAllocationMinLock retrieves the minimum lock value for the allocation creation, as calculated by the network.
// Lock value is the amount of tokens that the client needs to lock in the allocation's write pool
// to be able to pay for the write operations.
Expand Down
1 change: 1 addition & 0 deletions wasmsdk/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ func main() {
"getUpdateAllocationMinLock": getUpdateAllocationMinLock,
"getAllocationWith": getAllocationWith,
"createfreeallocation": createfreeallocation,
"getUpdateAllocTicket": getUpdateAllocTicket,

// readpool
"getReadPoolInfo": getReadPoolInfo,
Expand Down
13 changes: 13 additions & 0 deletions zboxcore/sdk/blobber_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
package sdk

import (
"encoding/hex"
"encoding/json"
"fmt"
"math"
"strings"

Expand Down Expand Up @@ -154,6 +156,17 @@ func UpdateAllocation(
return
}

func GetUpdateAllocTicket(allocationID, userID, operationType string, roundExpiry int64) (string, error) {
payload := fmt.Sprintf("%s:%d:%s:%s", allocationID, roundExpiry, userID, operationType)

signature, err := client.Sign(hex.EncodeToString([]byte(payload)))
if err != nil {
return "", err
}

return signature, nil
}

// StakePoolLock locks tokens in a stake pool.
// This function is the entry point for the staking operation.
// Provided the provider type and provider ID, the value is locked in the stake pool between the SDK client and the provider.
Expand Down
Loading