Skip to content

Taquito v17.3.0

Compare
Choose a tag to compare
@hui-an-yang hui-an-yang released this 30 Aug 23:30
· 139 commits to master since this release

A change in Licensing:
Taquito has moved from MIT to Apache 2.0.

Potential Breaking Changes:

  • Previously, an OrToken's EncodeObject method would accept an object with multiple fields. It now only accepts an object with a single field.
  • The generateSchema method in an OrToken with nested OrTokens (as well as ExtractSchema) would generate a schema object that was misleading and did not match what Execute created or EncodeObject accepted. This is now fixed and the behavior is consistent across all methods.
  • OrToken.Execute() used to throw OrTokenDecodingError in case of failure, but now will throw OrValidationError

Summary

New Features

  • @taquito/michelson-encoder - The OrToken's EncodeObject method now only accepts an object with a single field #2544

Bug Fixes

  • @taquito/michelson-encoder - A nested PairToken with a mix of fields with annots and fields without annots could generate the wrong javascript object with Execute #2540
  • @taquito/michelson-encoder - the generateSchema method in a nested OrToken now generates a schema that is consistent with Execute and EncodeObject #2543
const schema = {
    prim: 'pair',
    args: [
      {
        prim: 'pair',
        args: [
          {
            prim: 'pair',
            args: [{ prim: 'int' }, { prim: 'int' }],
            annots: ['%A3'],
          },
          { prim: 'int' },
        ],
      },
      { prim: 'bool' },
    ],
  };

  const michelineJson = {
    prim: 'Pair',
    args: [
      {
        prim: 'Pair',
        args: [{ prim: 'Pair', args: [{ int: '11' }, { int: '22' }] }, { int: '33' }],
      },
      { prim: 'True' },
    ],
  };
  const javaScriptObject = new Schema(schema).Execute(michelineJson);

Previously, this javaScriptObject would be equal to:

{
    2: true,
    A3: {
      0: 11,
      1: 22,
    },
}

But now it returns:

{
    1: 33,
    2: true,
    A3: {
      0: 11,
      1: 22,
    },
}

Internals

  • integration-tests config improvement #2163
  • update RPC urls to align with the updated infrastructure PR#2576 #2633

@taquito/michelson-encoder - Validate that an OrToken's EncodeObject method only accepts an object with a single field

Previously, an OrToken's EncodeObject method would accept an object with multiple fields. It now only accepts an object with a single field.

    const token = createToken({
        prim: 'or',
        args: [{ prim: 'int' }, { prim: 'string' }], annots: []
        }, 0) as OrToken;
    const javascriptObject = token.EncodeObject({ '0': 10, '1': '10' }));

Previously, this would return work and the result was the same as token.EncodeObject({ '0': 10, '1': '10' })). Now, this throws an error.

@taquito/michelson-encoder - For an OrToken with nested OrTokens, generateSchema behaved inconsistently with Execute and EncodeObject

Previously, generateSchema would generate a schema object that was misleading and did not match what Execute created or EncodeObject accepted. This is now fixed and the behavior is consistent across all methods.

const token = createToken(
  {
    prim: 'or',
    args: [
      {
        prim: 'bytes',
      },
      {
        prim: 'or',
        annots: ['A'],
        args: [
          {
            prim: 'or',
            args: [{ prim: 'int' }, { prim: 'nat' }],
          },
          { prim: 'bool' },
        ],
      },
    ],
  },
  0
) as OrToken;
const schema = token.generateSchema();

Previously, schema would be equal to:

{
    __michelsonType: "or",
    schema: {
        "0": { __michelsonType: "bytes", schema: "bytes" },
        "A": {
            __michelsonType: "or",
            schema: {
                "1": { __michelsonType: "int", schema: "int" },
                "2": { __michelsonType: "nat", schema: "nat" },
                "3": { __michelsonType: "bool", schema: "bool" }
            }
        }
    }
}

Which was inconsistent with what Execute created and what EncodeObject accepted.
Now it is:

{
    __michelsonType: 'or',
    schema: {
        0: { __michelsonType: 'bytes', schema: 'bytes' },
        1: { __michelsonType: 'int', schema: 'int' },
        2: { __michelsonType: 'nat', schema: 'nat' },
        3: { __michelsonType: 'bool', schema: 'bool' },
    },
}