Skip to content

Commit

Permalink
Merge pull request #92 from everFinance/feature/sdk
Browse files Browse the repository at this point in the history
Feature/sdk
  • Loading branch information
zyjblockchain authored Feb 21, 2024
2 parents c543de2 + a462183 commit 1c6b311
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions sdk/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ func (s *SDK) PayOrders(orders []*arseedSchema.RespOrder, rewards []schema.Rewar
}

if len(rewards) > 0 {
// sdk need 10% reward
rewards = append(rewards, schema.Reward{
Tag: useTag,
Recipient: "0x28840a3A565eF1fE7468d000Ff0B461058b9Ef5f",
Amount: new(big.Int).Div(totalFee, big.NewInt(10)).String(), // 10%
})

var bundleSigs paySchema.BundleWithSigs
bundleSigs, err = s.assembleEverBundleItems(rewards)
if err != nil {
Expand Down
14 changes: 7 additions & 7 deletions sdk/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func TestSDK_SendDataStreamAndPay(t *testing.T) {

func TestSDK_PayOrders_BundlePay(t *testing.T) {
payUrl := "https://api.everpay.io"
seedUrl := "https://seed-dev.everpay.io"
seedUrl := "https://arseed.web3infra.dev"

eccSigner, err := goether.NewSigner("")
if err != nil {
Expand All @@ -174,23 +174,23 @@ func TestSDK_PayOrders_BundlePay(t *testing.T) {
if err != nil {
panic(err)
}
data := []byte("sandy test bundle pay")
data := []byte("sandy test bundle pay 1111111")
tags := []types.Tag{
{"Content-Type", "text"},
}
rewards := []schema.Reward{
{
Tag: "conflux-cfx-0x0000000000000000000000000000000000000000",
Tag: "bsc-bnb-0x0000000000000000000000000000000000000000",
Recipient: "cSYOy8-p1QFenktkDBFyRM3cwZSTrQ_J4EsELLho_UE",
Amount: "55024587325649",
Amount: "10000000000",
},
{
Tag: "moonbeam-glmr-0x0000000000000000000000000000000000000000",
Tag: "bsc-bnb-0x0000000000000000000000000000000000000000",
Recipient: "0xa2026731B31E4DFBa78314bDBfBFDC8cF5F761F8",
Amount: "3417200978720",
Amount: "20000000000",
},
}
tx, itemId, err := sdk.SendDataAndPay(data, "usdt", &schema.OptionItem{Tags: tags}, false, rewards) // your account must have enough balance in everpay
tx, itemId, err := sdk.SendDataAndPay(data, "BNB", &schema.OptionItem{Tags: tags}, false, rewards) // your account must have enough balance in everpay
assert.NoError(t, err)
t.Log("itemId:", itemId)
t.Log(tx.HexHash())
Expand Down

0 comments on commit 1c6b311

Please sign in to comment.