Skip to content

Commit

Permalink
feat: adding new protocol hash PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2V…
Browse files Browse the repository at this point in the history
…NuQ3KXfUtUQeZ
  • Loading branch information
hui-an-yang committed May 28, 2024
1 parent 35bba2d commit 3343aa1
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 79 deletions.
2 changes: 2 additions & 0 deletions packages/taquito-local-forging/src/protocols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export enum ProtocolsHash {
PtNairobi = 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf',
ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH',
PtParisBQ = 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz',
PtParisBx = 'PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ',
ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK',
}

Expand All @@ -39,6 +40,7 @@ const protoLevel: Record<ProtocolsHash, number> = {
PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf: 17,
ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH: 19,
PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz: 20,
PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ: 20,
ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 21,
};

Expand Down
163 changes: 84 additions & 79 deletions packages/taquito-michel-codec/src/michelson-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type Instr0<PT extends MichelsonNoArgInstructionID> = Prim0<PT>;
type InstrX<PT extends MichelsonRegularInstructionID, AT extends Expr[]> = PrimX<PT, AT>;

export type MichelsonCode = InstructionList | MichelsonInstruction;
export interface InstructionList extends List<MichelsonCode> { }
export interface InstructionList extends List<MichelsonCode> {}

export type MichelsonNoArgInstruction = Instr0<MichelsonNoArgInstructionID>;
export type MichelsonInstruction =
Expand Down Expand Up @@ -224,87 +224,87 @@ export type MichelsonTypeChest = Type0<'chest'>;
type TypeList<T extends MichelsonType[]> = T & Node;
export type MichelsonTypePair<T extends MichelsonType[]> = TypeX<'pair', T> | TypeList<T>;

export interface MichelsonTypeOption<T extends MichelsonType> extends TypeX<'option', [T]> { }
export interface MichelsonTypeList<T extends MichelsonType> extends TypeX<'list', [T]> { }
export interface MichelsonTypeContract<T extends MichelsonType> extends TypeX<'contract', [T]> { }
export interface MichelsonTypeOr<T extends [MichelsonType, MichelsonType]> extends TypeX<'or', T> { }
export interface MichelsonTypeOption<T extends MichelsonType> extends TypeX<'option', [T]> {}
export interface MichelsonTypeList<T extends MichelsonType> extends TypeX<'list', [T]> {}
export interface MichelsonTypeContract<T extends MichelsonType> extends TypeX<'contract', [T]> {}
export interface MichelsonTypeOr<T extends [MichelsonType, MichelsonType]> extends TypeX<'or', T> {}
export interface MichelsonTypeLambda<Arg extends MichelsonType, Ret extends MichelsonType>
extends TypeX<'lambda', [Arg, Ret]> { }
extends TypeX<'lambda', [Arg, Ret]> {}

export interface MichelsonTypeSet<T extends MichelsonType> extends TypeX<'set', [T]> { }
export interface MichelsonTypeSet<T extends MichelsonType> extends TypeX<'set', [T]> {}
export interface MichelsonTypeMap<K extends MichelsonType, V extends MichelsonType>
extends TypeX<'map', [K, V]> { }
extends TypeX<'map', [K, V]> {}
export interface MichelsonTypeBigMap<K extends MichelsonType, V extends MichelsonType>
extends TypeX<'big_map', [K, V]> { }
extends TypeX<'big_map', [K, V]> {}
export interface MichelsonTypeSaplingState<S extends string = string>
extends TypeX<'sapling_state', [IntLiteral<S>]> { }
extends TypeX<'sapling_state', [IntLiteral<S>]> {}
export interface MichelsonTypeSaplingTransaction<S extends string = string>
extends TypeX<'sapling_transaction', [IntLiteral<S>]> { }
export interface MichelsonTypeTicket<T extends MichelsonType> extends TypeX<'ticket', [T]> { }
extends TypeX<'sapling_transaction', [IntLiteral<S>]> {}
export interface MichelsonTypeTicket<T extends MichelsonType> extends TypeX<'ticket', [T]> {}

export type MichelsonType<T extends MichelsonTypeID = MichelsonTypeID> = T extends 'int'
? MichelsonTypeInt
: T extends 'nat'
? MichelsonTypeNat
: T extends 'string'
? MichelsonTypeString
: T extends 'bytes'
? MichelsonTypeBytes
: T extends 'mutez'
? MichelsonTypeMutez
: T extends 'bool'
? MichelsonTypeBool
: T extends 'key_hash'
? MichelsonTypeKeyHash
: T extends 'timestamp'
? MichelsonTypeTimestamp
: T extends 'address'
? MichelsonTypeAddress
: T extends 'key'
? MichelsonTypeKey
: T extends 'unit'
? MichelsonTypeUnit
: T extends 'signature'
? MichelsonTypeSignature
: T extends 'operation'
? MichelsonTypeOperation
: T extends 'chain_id'
? MichelsonTypeChainID
: T extends 'option'
? MichelsonTypeOption<MichelsonType>
: T extends 'list'
? MichelsonTypeList<MichelsonType>
: T extends 'contract'
? MichelsonTypeContract<MichelsonType>
: T extends 'ticket'
? MichelsonTypeTicket<MichelsonType>
: T extends 'pair'
? MichelsonTypePair<MichelsonType[]>
: T extends 'or'
? MichelsonTypeOr<[MichelsonType, MichelsonType]>
: T extends 'lambda'
? MichelsonTypeLambda<MichelsonType, MichelsonType>
: T extends 'set'
? MichelsonTypeSet<MichelsonType>
: T extends 'map'
? MichelsonTypeMap<MichelsonType, MichelsonType>
: T extends 'big_map'
? MichelsonTypeBigMap<MichelsonType, MichelsonType>
: T extends 'never'
? MichelsonTypeNever
: T extends 'bls12_381_g1'
? MichelsonTypeBLS12_381_G1
: T extends 'bls12_381_g2'
? MichelsonTypeBLS12_381_G2
: T extends 'bls12_381_fr'
? MichelsonTypeBLS12_381_FR
: T extends 'sapling_transaction'
? MichelsonTypeSaplingTransaction
: T extends 'sapling_state'
? MichelsonTypeSaplingState
: T extends 'chest_key'
? MichelsonTypeChestKey
: MichelsonTypeChest;
? MichelsonTypeNat
: T extends 'string'
? MichelsonTypeString
: T extends 'bytes'
? MichelsonTypeBytes
: T extends 'mutez'
? MichelsonTypeMutez
: T extends 'bool'
? MichelsonTypeBool
: T extends 'key_hash'
? MichelsonTypeKeyHash
: T extends 'timestamp'
? MichelsonTypeTimestamp
: T extends 'address'
? MichelsonTypeAddress
: T extends 'key'
? MichelsonTypeKey
: T extends 'unit'
? MichelsonTypeUnit
: T extends 'signature'
? MichelsonTypeSignature
: T extends 'operation'
? MichelsonTypeOperation
: T extends 'chain_id'
? MichelsonTypeChainID
: T extends 'option'
? MichelsonTypeOption<MichelsonType>
: T extends 'list'
? MichelsonTypeList<MichelsonType>
: T extends 'contract'
? MichelsonTypeContract<MichelsonType>
: T extends 'ticket'
? MichelsonTypeTicket<MichelsonType>
: T extends 'pair'
? MichelsonTypePair<MichelsonType[]>
: T extends 'or'
? MichelsonTypeOr<[MichelsonType, MichelsonType]>
: T extends 'lambda'
? MichelsonTypeLambda<MichelsonType, MichelsonType>
: T extends 'set'
? MichelsonTypeSet<MichelsonType>
: T extends 'map'
? MichelsonTypeMap<MichelsonType, MichelsonType>
: T extends 'big_map'
? MichelsonTypeBigMap<MichelsonType, MichelsonType>
: T extends 'never'
? MichelsonTypeNever
: T extends 'bls12_381_g1'
? MichelsonTypeBLS12_381_G1
: T extends 'bls12_381_g2'
? MichelsonTypeBLS12_381_G2
: T extends 'bls12_381_fr'
? MichelsonTypeBLS12_381_FR
: T extends 'sapling_transaction'
? MichelsonTypeSaplingTransaction
: T extends 'sapling_state'
? MichelsonTypeSaplingState
: T extends 'chest_key'
? MichelsonTypeChestKey
: MichelsonTypeChest;

// Data

Expand All @@ -330,7 +330,10 @@ export type MichelsonDataPair<T extends MichelsonData[]> = DataX<'Pair', T> | Da
export type MichelsonMapElt = PrimX<'Elt', [MichelsonData, MichelsonData]>;
export type MichelsonMapEltList = List<MichelsonMapElt>;
export type MichelsonLambdaRec = DataX<'Lambda_rec', [InstructionList]>;
export type MichelsonTicket = PrimX<'Ticket', [StringLiteral | BytesLiteral, MichelsonType, MichelsonData, IntLiteral]>;
export type MichelsonTicket = PrimX<
'Ticket',
[StringLiteral | BytesLiteral, MichelsonType, MichelsonData, IntLiteral]
>;

export type MichelsonData =
| IntLiteral
Expand Down Expand Up @@ -363,12 +366,12 @@ export type MichelsonContract = MichelsonContractSection[];

export type MichelsonContractSection<T extends MichelsonSectionID = MichelsonSectionID> =
T extends 'parameter'
? MichelsonContractParameter
: T extends 'storage'
? MichelsonContractStorage
: T extends 'view'
? MichelsonContractView
: MichelsonContractCode;
? MichelsonContractParameter
: T extends 'storage'
? MichelsonContractStorage
: T extends 'view'
? MichelsonContractView
: MichelsonContractCode;

// Code analysis types
export interface MichelsonTypeFailed {
Expand Down Expand Up @@ -405,6 +408,7 @@ export enum Protocol {
PtNairobi = 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf',
ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH',
PtParisBQ = 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz',
PtParisBx = 'PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ',
ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', // temporary protocol hash
}

Expand Down Expand Up @@ -439,6 +443,7 @@ const protoLevel: Record<ProtocolID, number> = {
PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf: 17,
ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH: 19,
PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz: 20,
PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ: 20,
ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 21,
};

Expand Down
1 change: 1 addition & 0 deletions packages/taquito/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export enum Protocols {
PtNairobi = 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf',
ProxfordY = 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH',
PtParisBQ = 'PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz',
PtParisBx = 'PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ',
ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK',
}

Expand Down

0 comments on commit 3343aa1

Please sign in to comment.