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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ $(eval $(call makemock, pkg/wsclient, WSClient, wsmocks))
$(eval $(call makemock, internal/identity, Manager, identitymanagermocks))
$(eval $(call makemock, internal/batchpin, Submitter, batchpinmocks))
$(eval $(call makemock, internal/sysmessaging, SystemEvents, sysmessagingmocks))
$(eval $(call makemock, internal/sysmessaging, MessageSender, sysmessagingmocks))
$(eval $(call makemock, internal/syncasync, Bridge, syncasyncmocks))
$(eval $(call makemock, internal/data, Manager, datamocks))
$(eval $(call makemock, internal/batch, Manager, batchmocks))
Expand Down
218 changes: 218 additions & 0 deletions docs/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4743,12 +4743,120 @@ paths:
schema:
properties:
amount: {}
created: {}
from:
type: string
key:
type: string
localId: {}
message:
properties:
batch: {}
confirmed: {}
data:
items:
properties:
blob:
properties:
hash: {}
public:
type: string
type: object
datatype:
properties:
name:
type: string
version:
type: string
type: object
hash: {}
id: {}
validator:
type: string
value:
format: byte
type: string
type: object
type: array
group:
properties:
ledger: {}
members:
items:
properties:
identity:
type: string
node:
type: string
type: object
type: array
name:
type: string
type: object
hash: {}
header:
properties:
author:
type: string
cid: {}
created: {}
datahash: {}
group: {}
id: {}
key:
type: string
namespace:
type: string
tag:
type: string
topics:
items:
type: string
type: array
txtype:
type: string
type:
enum:
- definition
- broadcast
- private
- groupinit
- transfer_broadcast
- transfer_private
type: string
type: object
local:
type: boolean
pending:
type: boolean
pins:
items:
type: string
type: array
rejected:
type: boolean
type: object
messageHash: {}
poolProtocolId:
type: string
protocolId:
type: string
to:
type: string
tokenIndex:
type: string
tx:
properties:
id: {}
type:
type: string
type: object
type:
enum:
- mint
- burn
- transfer
type: string
type: object
responses:
"200":
Expand Down Expand Up @@ -4857,10 +4965,120 @@ paths:
schema:
properties:
amount: {}
created: {}
from:
type: string
key:
type: string
localId: {}
message:
properties:
batch: {}
confirmed: {}
data:
items:
properties:
blob:
properties:
hash: {}
public:
type: string
type: object
datatype:
properties:
name:
type: string
version:
type: string
type: object
hash: {}
id: {}
validator:
type: string
value:
format: byte
type: string
type: object
type: array
group:
properties:
ledger: {}
members:
items:
properties:
identity:
type: string
node:
type: string
type: object
type: array
name:
type: string
type: object
hash: {}
header:
properties:
author:
type: string
cid: {}
created: {}
datahash: {}
group: {}
id: {}
key:
type: string
namespace:
type: string
tag:
type: string
topics:
items:
type: string
type: array
txtype:
type: string
type:
enum:
- definition
- broadcast
- private
- groupinit
- transfer_broadcast
- transfer_private
type: string
type: object
local:
type: boolean
pending:
type: boolean
pins:
items:
type: string
type: array
rejected:
type: boolean
type: object
messageHash: {}
poolProtocolId:
type: string
protocolId:
type: string
to:
type: string
tokenIndex:
type: string
tx:
properties:
id: {}
type:
type: string
type: object
type:
enum:
- mint
- burn
- transfer
type: string
type: object
responses:
"200":
Expand Down
4 changes: 2 additions & 2 deletions internal/apiserver/route_post_token_burn.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ var postTokenBurn = &oapispec.Route{
},
FilterFactory: nil,
Description: i18n.MsgTBD,
JSONInputValue: func() interface{} { return &fftypes.TokenTransfer{} },
JSONInputValue: func() interface{} { return &fftypes.TokenTransferInput{} },
JSONInputMask: []string{"Type", "LocalID", "PoolProtocolID", "To", "ProtocolID", "MessageHash", "TX", "Created"},
JSONOutputValue: func() interface{} { return &fftypes.TokenTransfer{} },
JSONOutputCodes: []int{http.StatusAccepted, http.StatusOK},
JSONHandler: func(r *oapispec.APIRequest) (output interface{}, err error) {
waitConfirm := strings.EqualFold(r.QP["confirm"], "true")
r.SuccessStatus = syncRetcode(waitConfirm)
return r.Or.Assets().BurnTokens(r.Ctx, r.PP["ns"], r.PP["type"], r.PP["name"], r.Input.(*fftypes.TokenTransfer), waitConfirm)
return r.Or.Assets().BurnTokens(r.Ctx, r.PP["ns"], r.PP["type"], r.PP["name"], r.Input.(*fftypes.TokenTransferInput), waitConfirm)
},
}
4 changes: 2 additions & 2 deletions internal/apiserver/route_post_token_burn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ func TestPostTokenBurn(t *testing.T) {
o, r := newTestAPIServer()
mam := &assetmocks.Manager{}
o.On("Assets").Return(mam)
input := fftypes.TokenTransfer{}
input := fftypes.TokenTransferInput{}
var buf bytes.Buffer
json.NewEncoder(&buf).Encode(&input)
req := httptest.NewRequest("POST", "/api/v1/namespaces/ns1/tokens/tok1/pools/pool1/burn", &buf)
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mam.On("BurnTokens", mock.Anything, "ns1", "tok1", "pool1", mock.AnythingOfType("*fftypes.TokenTransfer"), false).
mam.On("BurnTokens", mock.Anything, "ns1", "tok1", "pool1", mock.AnythingOfType("*fftypes.TokenTransferInput"), false).
Return(&fftypes.TokenTransfer{}, nil)
r.ServeHTTP(res, req)

Expand Down
4 changes: 2 additions & 2 deletions internal/apiserver/route_post_token_mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ var postTokenMint = &oapispec.Route{
},
FilterFactory: nil,
Description: i18n.MsgTBD,
JSONInputValue: func() interface{} { return &fftypes.TokenTransfer{} },
JSONInputValue: func() interface{} { return &fftypes.TokenTransferInput{} },
JSONInputMask: []string{"Type", "LocalID", "PoolProtocolID", "TokenIndex", "From", "ProtocolID", "MessageHash", "TX", "Created"},
JSONOutputValue: func() interface{} { return &fftypes.TokenTransfer{} },
JSONOutputCodes: []int{http.StatusAccepted, http.StatusOK},
JSONHandler: func(r *oapispec.APIRequest) (output interface{}, err error) {
waitConfirm := strings.EqualFold(r.QP["confirm"], "true")
r.SuccessStatus = syncRetcode(waitConfirm)
return r.Or.Assets().MintTokens(r.Ctx, r.PP["ns"], r.PP["type"], r.PP["name"], r.Input.(*fftypes.TokenTransfer), waitConfirm)
return r.Or.Assets().MintTokens(r.Ctx, r.PP["ns"], r.PP["type"], r.PP["name"], r.Input.(*fftypes.TokenTransferInput), waitConfirm)
},
}
4 changes: 2 additions & 2 deletions internal/apiserver/route_post_token_mint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ func TestPostTokenMint(t *testing.T) {
o, r := newTestAPIServer()
mam := &assetmocks.Manager{}
o.On("Assets").Return(mam)
input := fftypes.TokenTransfer{}
input := fftypes.TokenTransferInput{}
var buf bytes.Buffer
json.NewEncoder(&buf).Encode(&input)
req := httptest.NewRequest("POST", "/api/v1/namespaces/ns1/tokens/tok1/pools/pool1/mint", &buf)
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mam.On("MintTokens", mock.Anything, "ns1", "tok1", "pool1", mock.AnythingOfType("*fftypes.TokenTransfer"), false).
mam.On("MintTokens", mock.Anything, "ns1", "tok1", "pool1", mock.AnythingOfType("*fftypes.TokenTransferInput"), false).
Return(&fftypes.TokenTransfer{}, nil)
r.ServeHTTP(res, req)

Expand Down
Loading