public static void Main() { StructTag tag = new StructTag( AccountAddress.valueOf(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }), new Identifier("XDX"), new Identifier("XDX"), new ValueArray <TypeTag>(new List <TypeTag>().ToArray()) ); TypeTag token = new TypeTag.Struct(tag); AccountAddress payee = AccountAddress.valueOf( new byte[] { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22 }); ulong amount = 1234567; Script script = Helpers.encode_peer_to_peer_with_metadata_script( token, payee, amount, new ValueArray <byte>(new List <byte>().ToArray()), new ValueArray <byte>(new List <byte>().ToArray()) ); ScriptCall.PeerToPeerWithMetadata call = (ScriptCall.PeerToPeerWithMetadata)Helpers.DecodeScript(script); Debug.Assert(call.amount.Equals(amount), string.Format("call.amount is {0}. Expecting {1}", call.amount, amount)); Debug.Assert(call.payee.Equals(payee), string.Format("call.payee is {0}. Expecting {1}", call.payee, payee)); byte[] output = script.BcsSerialize(); foreach (byte o in output) { Console.Write(((int)o & 0xFF) + " "); } Console.WriteLine(); }
public StructField(@string Name = default, @string PkgPath = default, Type Type = default, StructTag Tag = default, System.UIntPtr Offset = default, slice <long> Index = default, bool Anonymous = default) { this.Name = Name; this.PkgPath = PkgPath; this.Type = Type; this.Tag = Tag; this.Offset = Offset; this.Index = Index; this.Anonymous = Anonymous; }