Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TestNet] Add Delegatedtransfer method to NonFungibleToken #95

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ public void DelegatedTransfer_ValidTokenTransfer_MessageSender_TransfersTokenFro
var nonFungibleToken = CreateNonFungibleToken();
var uid = Guid.NewGuid();

string url = $"?uid={Convert.ToHexString(uid.ToByteArray().Reverse().ToArray())}&action=DelegatedTransfer&from={this.AddressToString(ownerAddress)}&to={this.AddressToString(targetAddress)}&tokenId=1";
string url = $"?uid={Convert.ToHexString(uid.ToByteArray().Reverse().ToArray())}&method=DelegatedTransfer&from={this.AddressToString(ownerAddress)}&to={this.AddressToString(targetAddress)}&tokenId=1";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use uid as string for avoid endian stuff?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets rather keep uid compatible with UInt128/Guid,

byte[] signature = Convert.FromBase64String(key.SignMessage(url));

nonFungibleToken.DelegatedTransfer(url, signature);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ private struct SignatureTemplate
/// <param name="signature">The signature of the <paramref name="url"/> string signed by the owner.</param>
public void DelegatedTransfer(string url, byte[] signature)
{
string[] args = SSAS.GetURLArguments(url, new string[] { "uid", "action", "from", "to", "tokenId" });
string[] args = SSAS.GetURLArguments(url, new string[] { "uid", "method", "from", "to", "tokenId" });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to add contract address here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


Assert(args != null && args.Length == 5 && args[1] == nameof(DelegatedTransfer), "Invalid url.");

Expand Down