diff --git a/lib/__tests__/manifest-values.spec.ts b/lib/__tests__/manifest-values.spec.ts index 677c401..e53b76e 100644 --- a/lib/__tests__/manifest-values.spec.ts +++ b/lib/__tests__/manifest-values.spec.ts @@ -52,11 +52,11 @@ describe('scrypto value', () => { [Enum('Foo'), 'Enum("Foo")'], [ Enum('Foo', String('some string'), Bool(false)), - 'Enum("Foo","some string",false)', + 'Enum("Foo", "some string", false)', ], - [Enum('Some', String('foobar')), 'Enum("Some","foobar")'], - [Enum('Some', U128('128')), 'Enum("Some",128u128)'], - [Enum('Some', Decimal(219.01234)), 'Enum("Some",Decimal("219.01234"))'], + [Enum('Some', String('foobar')), 'Enum("Some", "foobar")'], + [Enum('Some', U128('128')), 'Enum("Some", 128u128)'], + [Enum('Some', Decimal(219.01234)), 'Enum("Some", Decimal("219.01234"))'], [Enum('None'), 'Enum("None")'], [Tuple(Decimal(42.42), String('foo')), 'Tuple(Decimal("42.42"),"foo")'], [Tuple(Decimal(42.42), String('foo')), 'Tuple(Decimal("42.42"),"foo")'], @@ -214,8 +214,8 @@ describe('manifest builder', () => { Address( 'component_sim1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0tshjs68x' ), - 'key', - Enum(0, Enum(0, 'value')), + String('key'), + Enum(0, Enum(0, String('value'))), ]) .build() .toString() diff --git a/lib/manifest-builder.ts b/lib/manifest-builder.ts index 270dfc5..4454113 100644 --- a/lib/manifest-builder.ts +++ b/lib/manifest-builder.ts @@ -85,9 +85,9 @@ export class ManifestBuilder { resourceAddress: AddressString, bucketName: string ): ManifestBuilder { - var temp = nonFungibleLocalIds + let temp = nonFungibleLocalIds .map(function (id) { - 'NonFungibleLocalId("' + id + '")' + return 'NonFungibleLocalId("' + id + '")' }) .join(', ') this.instructions.push( @@ -153,9 +153,9 @@ export class ManifestBuilder { nonFungibleLocalIds: NonFungibleLocalIdString[], resourceAddress: AddressString ): ManifestBuilder { - var temp = nonFungibleLocalIds + let temp = nonFungibleLocalIds .map(function (id) { - 'NonFungibleLocalId("' + id + '")' + return 'NonFungibleLocalId("' + id + '")' }) .join(', ') this.instructions.push( @@ -254,9 +254,9 @@ export class ManifestBuilder { resourceAddress: AddressString, proofName: string ): ManifestBuilder { - var temp = nonFungibleLocalIds + let temp = nonFungibleLocalIds .map(function (id) { - 'NonFungibleLocalId("' + id + '")' + return 'NonFungibleLocalId("' + id + '")' }) .join(', ') this.instructions.push( @@ -388,7 +388,7 @@ export class ManifestBuilder { this.instructions.push( `CALL_METHOD ${Address(accountAddress)} "withdraw" ${Address( resourceAddress - )} ${Decimal(amount)} ;` + )} ${Decimal(amount)};` ) return this } @@ -406,9 +406,9 @@ export class ManifestBuilder { resourceAddress: AddressString, nonFungibleLocalIds: NonFungibleLocalIdString[] ): ManifestBuilder { - var temp = nonFungibleLocalIds + let temp = nonFungibleLocalIds .map(function (id) { - 'NonFungibleLocalId("' + id + '")' + return 'NonFungibleLocalId("' + id + '")' }) .join(', ') this.instructions.push( @@ -416,7 +416,7 @@ export class ManifestBuilder { accountAddress )} "withdraw_non_fungibles" ${Address( resourceAddress - )} Array(${temp})};` + )} Array(${temp});` ) return this } @@ -476,9 +476,9 @@ export class ManifestBuilder { resourceAddress: AddressString, nonFungibleLocalIds: NonFungibleLocalIdString[] ): ManifestBuilder { - var temp = nonFungibleLocalIds + let temp = nonFungibleLocalIds .map(function (id) { - 'NonFungibleLocalId("' + id + '")' + return 'NonFungibleLocalId("' + id + '")' }) .join(', ') this.instructions.push( diff --git a/lib/manifest-value.ts b/lib/manifest-value.ts index b4149a6..50d8fc6 100644 --- a/lib/manifest-value.ts +++ b/lib/manifest-value.ts @@ -138,11 +138,11 @@ export const String = (str: T): `"${T}"` => { export const Enum = (field: string | number, ...args: string[]): string => { if (typeof field === 'number') { return args.length > 0 - ? `Enum(${field}u8,${args.join(',')})` + ? `Enum(${field}u8, ${args.join(', ')})` : `Enum(${field}u8)` } else { return args.length > 0 - ? `Enum("${field}",${args.join(',')})` + ? `Enum("${field}", ${args.join(', ')})` : `Enum("${field}")` } }