Categorygithub.com/wmwallet/wm-wallet-sdk
modulepackage
1.0.3
Repository: https://github.com/wmwallet/wm-wallet-sdk.git
Documentation: pkg.go.dev

# README

wm-wallet-uml

deposit

                      ,-.                                                                                                      
                      `-'                                                                                                      
                      /|\                                                                                                      
                       |             ,------.                                              ,--------.           ,--.           
                      / \            |Broker|                                              |WmWallet|           |DB|           
                     User            `---+--'                                              `----+---'           `-+'           
                       |                 |                                                      |                 |            
          ____________________________________________________________________________________________________________________ 
          ! CREATE&CANCEL DEPOSIT ORDER  /                                                      |                 |           !
          !_______________1 do deposit__/|                                                      |                 |           !
          !            |---------------->|                                                      |                 |           !
          !            |                 |                                                      |                 |           !
          !            |                 |2 do deposit(source_id,chain,coin,fiat_amount,symbol) |                 |           !
          !            |                 |----------------------------------------------------->|                 |           !
          !            |                 |                                                      |                 |           !
          !            |                 |3 ret order(order_id,chain,coin,exchange_rate,amount) |                 |           !
          !            |                 |<- - - - - - - - - - - - - - - - - - - - - - - - - - -|                 |           !
          !            |                 |                                                      |                 |           !
          !            |                 |                                                      |     4 save      |           !
          !            |                 |                                                      | - - - - - - - ->|           !
          !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
                       |                 |                                                      |                 |            
                       |                 |                                                      |                 |            
                 ________________________________________________________________________________________________________      
                 ! DEPOSIT  /            |                                                      |                 |      !     
                 !_________/             |                 5 webhook callback                   |                 |      !     
                 !     |                 |<- - - - - - - - - - - - - - - - - - - - - - - - - - -|                 |      !     
                 !     |                 |                                                      |                 |      !     
                 !     |                 |             6 check transaction exists               |                 |      !     
                 !     |                 |----------------------------------------------------->|                 |      !     
                 !     |                 |                                                      |                 |      !     
                 !     |                 |                                                      |                 |      !     
                 !     |   ____________________________________________________________________________________   |      !     
                 !     |   ! ALT  /      |                                                      |              !  |      !     
                 !     |   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!  |      !     
                 !     |   ! [transaction exists]                                               |              !  |      !     
                 !     |   !             |                 7 transaction info                   |              !  |      !     
                 !     |   !             |<- - - - - - - - - - - - - - - - - - - - - - - - - - -|              !  |      !     
                 !     |   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!  |      !     
                 !     |   ! [not exists]|                                                      |              !  |      !     
                 !     |   !             |                       8 null                         |              !  |      !     
                 !     |   !             |<- - - - - - - - - - - - - - - - - - - - - - - - - - -|              !  |      !     
                 !     |   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!  |      !     
                 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!     
                     User            ,---+--.                                              ,----+---.           ,-+.           
                      ,-.            |Broker|                                              |WmWallet|           |DB|           
                      `-'            `------'                                              `--------'           `--'           
                      /|\                                                                                                      
                       |                                                                                                       
                      / \                                                                                                      

withdraw

                                                                                ,.-^^-._                
                      ,-.                                                      |-.____.-|               
                      `-'                                                      |        |               
                      /|\                                                      |        |               
                       |             ,--------.                                |        |       ,------.
                      / \            |WmWallet|                                '-.____.-'       |Wallet|
                     User            `----+---'                                   DB            `---+--'
                       |   1 withdraw     |                                        |                |   
                       |----------------->|                                        |                |   
                       |                  |                                        |                |   
                       |                  |2 check balance && freeze/deduct amount |                |   
                       |                  |--------------------------------------->|                |   
                       |                  |                                        |                |   
                       |                  |                                        |                |   
          _____________________________________________________________________________________     |   
          ! NOT ENOUGH  /                 |                                        |           !    |   
          !____________/                  |         3 not enough, cancel           |           !    |   
          !            |                  |<- - - - - - - - - - - - - - - - - - - -|           !    |   
          !            |                  |                                        |           !    |   
          !            |4 withdraw failed |                                        |           !    |   
          !            |<- - - - - - - - -|                                        |           !    |   
          !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!    |   
                       |                  |                                        |                |   
                       |                  |                                        |                |   
                       |                  |                                        |                |   
                       |                  |                                        |                |   
                       |                  |                       5 withdraw       |                |   
                       |                  |-------------------------------------------------------->|   
                       |                  |                                        |                |   
                       |                  |                          6 ok          |                |   
                       |                  |<- - - - - - - - - - - - - - - - - - - - - - - - - - - - |   
                       |                  |                                        |                |   
                       |                  |               7 callback withdraw detail                |   
                       |                  |<- - - - - - - - - - - - - - - - - - - - - - - - - - - - |   
                       |                  |                                        |                |   
                       |                  |                                        |                |   
                       |   ____________________________________________________________________     |   
                       |   ! DETAIL SUCC  /                                        |           !    |   
                       |   !_____________/|            8 deduct amount             |           !    |   
                       |   !              |--------------------------------------->|           !    |   
                       |   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!    |   
                       |   ! [failed]     |                                        |           !    |   
                       |   !              |         9 unfeeze/add amount           |           !    |   
                       |   !              |--------------------------------------->|           !    |   
                       |   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!    |   
                     User            ,----+---.                                   DB            ,---+--.
                      ,-.            |WmWallet|                                 ,.-^^-._        |Wallet|
                      `-'            `--------'                                |-.____.-|       `------'
                      /|\                                                      |        |               
                       |                                                       |        |               
                      / \                                                      |        |               
                                                                               '-.____.-'               

Common

Broker must in header.

Chain Support:

chain_idchain_name
1TRON
2TON

Coin Support:

coin_idcoin_name
1USDT
2TRX
3TON

Symbol Support

symbol
USDT/TON
USDT/TRX
......

resp always like:

resp from gateway:

{
  "code": 0,
  "data": {
    "code": 0,
    "msg": "",
    "data": {
      "source_id": "20241205114600032509",
      "chain_id": 2,
      "coin_id": 1,
      "address": "UQBetutxT6cLe54yHYRxKsUCW_bnvjYa_02GWFWQHaigBYWg",
      "tag": "13",
      "hash": "8To7dqNJ7kJPmTz4F9HSYpU/wvGZbx4q2RdkYutsm8E=",
      "fiat_amount": "2",
      "symbol": "USDT/CNY",
      "exchange_rate": "7.274951607768018",
      "amount": "0.2749159180474064",
      "order_id": "06ceb53730794f62be1a29d8aaf2efeb",
      "url": "http://43.156.157.230/wm/?broker=bacb849551df44e19608b46f9c4db031&no=06ceb53730794f62be1a29d8aaf2efeb&lang=zh",
      "status": 8,
      "status_desc": "订单成功"
    }
  }
}

api resp body in data:

{
    "code": 0,
    "msg": "",
    "data": {
        "source_id": "20241205114600032509",
        "chain_id": 2,
        "coin_id": 1,
        "address": "UQBetutxT6cLe54yHYRxKsUCW_bnvjYa_02GWFWQHaigBYWg",
        "tag": "13",
        "hash": "8To7dqNJ7kJPmTz4F9HSYpU/wvGZbx4q2RdkYutsm8E=",
        "fiat_amount": "2",
        "symbol": "USDT/CNY",
        "exchange_rate": "7.274951607768018",
        "amount": "0.2749159180474064",
        "order_id": "06ceb53730794f62be1a29d8aaf2efeb",
        "url": "http://43.156.157.230/wm/?broker=bacb849551df44e19608b46f9c4db031&no=06ceb53730794f62be1a29d8aaf2efeb&lang=zh",
        "status": 8,
        "status_desc": "订单成功"
    }
}

API

Deposit.Create

path: /v1/api/broker/order/create

req:

nametypecommentrequire
source_idstringuniq idy
chain_idinty
coin_idinty
fiat_amountdecimal(40,18)y
symbolstringy
callback_urlstringy

resp:

nametypecomment
source_idstringbroker uid
chain_idint
coin_idint
fiat_amountdecimal(40,18)
exchange_ratedecimal(40,18)
amountdecimal(40,18)
order_idstringwm wallet uid
urlstringa html view

Deposit.Detail

path: /v1/api/broker/order/detail

req:

nametypecommentrequire
source_idstringuniq idy

resp:

nametypecomment
source_idstring
chain_idint
coin_idint
addressstring
tagstring
hashstring
fiat_amountdecimal(40,18)
symbolstring
exchange_ratedecimal(40,18)
amountdecimal(40,18)
order_idstring
urlstringa html view
statusint8
status_descstring
statusstatus_desc
0Order Created
8Order Success
12User Cancel
16Expire Cancel
20Less Amount

Deposit.Cancel

path: /v1/api/broker/order/cancel

req:

nametypecommentrequire
source_idstringuniq idy

resp:

nametypecomment
null

Deposit Callback Struct

nametypecomment
source_idstring
chain_idint
coin_idint
addressstring
tagstring
hashstring
fiat_amountdecimal(40,18)
symbolstringUSDT/TON
exchange_ratedecimal(40,18)
amountdecimal(40,18)0.123456
order_idstring
statusint8
status_descstring
statusstatus_desc
0Withdraw Doing
4Withdraw Success
8Withdraw Fail

Withdraw.Create

path: /v1/api/broker/order/withdraw

req:

nametypecommentrequire
source_idstringuniq idy
chain_idinty
coin_idinty
addressstringy
tagstringy
amountdecimal(40,18)y
callback_urlstringy

resp:

nametypecomment
source_idstringuniq id
order_idstring

Withdraw.Detail

path: /v1/api/broker/order/withdraw-detail

req:

nametypecommentrequire
source_idstringuniq idy

resp:

nametypecomment
source_idstringuniq id
chain_idint
coin_idint
addressstring
tagstring
hashstring
fiat_amountdecimal(40,18)
symbolstring
exchange_ratedecimal(40,18)
amountdecimal(40,18)
service_feedecimal(40,18)
order_idstring
statusint8
status_descstring

Withdraw Callback Struct

nametypecomment
source_idstring
order_idint
chain_idint
coin_idint
tagstring
amountdecimal(40,18)
service_feedecimal(40,18)
statusint8
status_descstring

sdk example

package thirdparty

import (
	"context"
	sdk "github.com/wmwallet/wm-wallet-sdk"
	"github.com/wmwallet/wm-wallet-sdk/deposit"
	"github.com/wmwallet/wm-wallet-sdk/withdraw"
)

const CustomerName = "test"

const Url = "http://wmwallet.pro"

type WmWalletSDK struct {
	wmWalletSDK *sdk.WmWalletClient
}

func NewWmWalletSDK() *WmWalletSDK {
	ops := []sdk.Option{
		sdk.WithSecretPath("wallet/public_key.pem"),
		sdk.WithCertPath("wallet/ca.crt", "wallet/client.crt", "wallet/client.key"),
		sdk.WithCustomer(CustomerName),
	}
	wmWalletSDK, err := sdk.Init(ops...)
	if err != nil {
		panic(err)
	}
	return &WmWalletSDK{
		wmWalletSDK: wmWalletSDK,
	}
}

func (wws *WmWalletSDK) DepositOrderCreate(req *deposit.CreateOrderReq) (resp *deposit.CreateOrderResp, err error) {
	d := deposit.NewDeposit(wws.wmWalletSDK, Url)
	resp, err = d.Create(context.Background(), req)
	if err != nil {
		return
	}
	return
}

func (wws *WmWalletSDK) DepositOrderDetail(req *deposit.GetDetailRequest) (resp *deposit.GetDetailResponse, err error) {
	d := deposit.NewDeposit(wws.wmWalletSDK, Url)
	resp, err = d.Detail(context.Background(), req)
	if err != nil {
		return
	}
	return
}

func (wws *WmWalletSDK) DepositOrderCancel(req *deposit.CancelOrderReq) (resp *deposit.CancelOrderResp, err error) {
	d := deposit.NewDeposit(wws.wmWalletSDK, Url)
	resp, err = d.Cancel(context.Background(), req)
	if err != nil {
		return
	}
	return
}

func (wws *WmWalletSDK) WithdrawOrderCreate(req *withdraw.CreateOrderReq) (resp *withdraw.CreateOrderResp, err error) {
	w := withdraw.NewWithdraw(wws.wmWalletSDK, Url)
	resp, err = w.Create(context.Background(), req)
	if err != nil {
		return
	}
	return
}

func (wws *WmWalletSDK) WithdrawOrderDetail(req *withdraw.GetDetailRequest) (resp *withdraw.GetDetailResponse, err error) {
	w := withdraw.NewWithdraw(wws.wmWalletSDK, Url)
	resp, err = w.Detail(context.Background(), req)
	if err != nil {
		return
	}
	return
}

Java SDK

document

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author