Skip to content

Commit

Permalink
modify the create allocation api to accept the owner and owner public…
Browse files Browse the repository at this point in the history
… key
  • Loading branch information
sarath-ambati committed Aug 1, 2019
1 parent 0f6b81d commit c379f31
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions zboxcore/sdk/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,16 @@ func GetAllocations() ([]*Allocation, error) {
}

func CreateAllocation(datashards int, parityshards int, size int64, expiry int64) (string, error) {
return CreateAllocationForOwner(client.GetClientID(), client.GetClientPublicKey(), datashards, parityshards, size, expiry)
}

func CreateAllocationForOwner(owner string, ownerpublickey string, datashards int, parityshards int, size int64, expiry int64) (string, error) {
allocationRequest := make(map[string]interface{})
allocationRequest["data_shards"] = datashards
allocationRequest["parity_shards"] = parityshards
allocationRequest["size"] = size
allocationRequest["owner_id"] = owner
allocationRequest["owner_public_key"] = ownerpublickey
allocationRequest["expiration_date"] = expiry

sn := transaction.SmartContractTxnData{Name: transaction.NEW_ALLOCATION_REQUEST, InputArgs: allocationRequest}
Expand Down

0 comments on commit c379f31

Please sign in to comment.