Skip to content

Add a r/aib/ibc/apps/transfer.Transfer() function #4

@tbruyelle

Description

@tbruyelle

This function should act as a wrapper around SendPacket() so instead of writing this code:

    signer := runtime.CurrentRealm().Address()
	payload := transfer.FungibleTokenPacketData{
		Denom:    "ugnot",
		Amount:   "100",
		Sender:   signer.String(),
		Receiver: "atone1user",
	}
	packet := types.MsgSendPacket{
		SourceClient:     clientID,
		TimeoutTimestamp: uint64(time.Now().Add(time.Hour).Unix()),
		Payloads: []types.Payload{
			{
				SourcePort:      transfer.PortID,
				DestinationPort: transfer.PortID,
				Encoding:        transfer.EncodingProtobuf,
				Value:           payload.ProtoMarshal(),
				Version:         transfer.V1,
			},
		},
	}
	banker := banker.NewBanker(banker.BankerTypeOriginSend)

	core.SendPacket(cross, banker, packet)

You would just have to write this:

transfer.Transfer(banker, clientID, receiver, amount, denom)

Probably relevant to also add the timeout in the parameters list. Signer needs to be ajusted as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions