X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=api%2Freceivers.go;h=02d80b98633656227c043be0490f1756c78a39f9;hb=a6be86325c56b458295c163200c295b43c44f2e0;hp=b244b7ec9a3f06ef84e00768282ce1169eb2649e;hpb=e58c4b1e2f0573318ffc699919599609ccf5da10;p=bytom%2Fvapor.git diff --git a/api/receivers.go b/api/receivers.go index b244b7ec..02d80b98 100644 --- a/api/receivers.go +++ b/api/receivers.go @@ -4,7 +4,6 @@ import ( "context" "github.com/vapor/blockchain/txbuilder" - chainjson "github.com/vapor/encoding/json" ) func (a *API) createAccountReceiver(ctx context.Context, ins struct { @@ -31,60 +30,3 @@ func (a *API) createAccountReceiver(ctx context.Context, ins struct { Address: program.Address, }) } - -type fundingResp struct { - MainchainAddress string `json:"mainchain_address"` - ClaimScript chainjson.HexBytes `json:"claim_script"` -} - -func (a *API) getPeginAddress(ctx context.Context, ins struct { - AccountID string `json:"account_id"` - AccountAlias string `json:"account_alias"` -}) Response { - - accountID := ins.AccountID - if ins.AccountAlias != "" { - account, err := a.wallet.AccountMgr.FindByAlias(ins.AccountAlias) - if err != nil { - return NewErrorResponse(err) - } - - accountID = account.ID - } - - mainchainAddress, claimScript, err := a.wallet.AccountMgr.CreatePeginAddress(accountID, false) - if err != nil { - return NewErrorResponse(err) - } - - return NewSuccessResponse(fundingResp{ - MainchainAddress: mainchainAddress, - ClaimScript: claimScript, - }) -} - -func (a *API) getPeginContractAddress(ctx context.Context, ins struct { - AccountID string `json:"account_id"` - AccountAlias string `json:"account_alias"` -}) Response { - - accountID := ins.AccountID - if ins.AccountAlias != "" { - account, err := a.wallet.AccountMgr.FindByAlias(ins.AccountAlias) - if err != nil { - return NewErrorResponse(err) - } - - accountID = account.ID - } - - mainchainAddress, claimScript, err := a.wallet.AccountMgr.CreatePeginContractAddress(accountID, false) - if err != nil { - return NewErrorResponse(err) - } - - return NewSuccessResponse(fundingResp{ - MainchainAddress: mainchainAddress, - ClaimScript: claimScript, - }) -}