@@ -4,7 +4,7 @@ import {readFile} from 'fs/promises';
4
4
import type { ICrossAccountId } from '@unique-nft/playgrounds/types.js' ;
5
5
import type { IKeyringPair } from '@polkadot/types/types' ;
6
6
import { UniqueNFTCollection } from '@unique-nft/playgrounds/unique.js' ;
7
- import { Contract } from 'ethers' ;
7
+ import { Contract , hexlify } from 'ethers' ;
8
8
import { createObjectCsvWriter } from 'csv-writer' ;
9
9
import { convertToTokens , createCollectionForBenchmarks , PERMISSIONS , PROPERTIES } from '../utils/common.js' ;
10
10
import { makeNames } from '@unique/test-utils/util.js' ;
@@ -124,7 +124,7 @@ main()
124
124
async function benchMintFee (
125
125
helper : EthUniqueHelper ,
126
126
privateKey : ( seed : string ) => Promise < IKeyringPair > ,
127
- proxyContract : Contract ,
127
+ contract : Contract ,
128
128
) : Promise < {
129
129
substrateFee : number ;
130
130
ethFee : number ;
@@ -134,6 +134,8 @@ async function benchMintFee(
134
134
const substrateReceiver = await privateKey ( '//Bob' ) ;
135
135
const ethSigner = await helper . eth . createAccountWithBalance ( donor ) ;
136
136
137
+ const proxyContract = helper . eth . changeContractCaller ( contract , ethSigner ) ;
138
+
137
139
const nominal = helper . balance . getOneTokenNominal ( ) ;
138
140
139
141
await helper . eth . transferBalanceFromSubstrate (
@@ -184,7 +186,7 @@ async function benchMintFee(
184
186
async ( ) => {
185
187
await ( await proxyContract . mintToSubstrate . send (
186
188
helper . ethAddress . fromCollectionId ( collection . collectionId ) ,
187
- substrateReceiver . addressRaw ,
189
+ hexlify ( substrateReceiver . addressRaw ) ,
188
190
) ) . wait ( ...waitParams ) ;
189
191
} ,
190
192
) ;
@@ -199,14 +201,16 @@ async function benchMintFee(
199
201
async function benchMintWithProperties (
200
202
helper : EthUniqueHelper ,
201
203
privateKey : ( seed : string ) => Promise < IKeyringPair > ,
202
- proxyContract : Contract ,
204
+ contract : Contract ,
203
205
setup : { propertiesNumber : number } ,
204
206
) : Promise < IBenchmarkResultForProp > {
205
207
const donor = await privateKey ( '//Alice' ) ; // Seed from account with balance on this network
206
208
const ethSigner = await helper . eth . createAccountWithBalance ( donor ) ;
207
209
208
- const susbstrateReceiver = await privateKey ( '//Bob' ) ;
209
- const receiverEthAddress = helper . address . substrateToEth ( susbstrateReceiver . address ) ;
210
+ const proxyContract = helper . eth . changeContractCaller ( contract , ethSigner ) ;
211
+
212
+ const substrateReceiver = await privateKey ( '//Bob' ) ;
213
+ const receiverEthAddress = helper . address . substrateToEth ( substrateReceiver . address ) ;
210
214
211
215
const nominal = helper . balance . getOneTokenNominal ( ) ;
212
216
@@ -219,7 +223,7 @@ async function benchMintWithProperties(
219
223
async ( collection ) => {
220
224
await collection . mintToken (
221
225
donor ,
222
- { Substrate : susbstrateReceiver . address } ,
226
+ { Substrate : substrateReceiver . address } ,
223
227
PROPERTIES . slice ( 0 , setup . propertiesNumber ) . map ( ( p ) => ( { key : p . key , value : Buffer . from ( p . value ) . toString ( ) } ) ) ,
224
228
) ;
225
229
} ,
@@ -235,7 +239,7 @@ async function benchMintWithProperties(
235
239
const evmContract = await helper . ethNativeContract . collection (
236
240
helper . ethAddress . fromCollectionId ( collection . collectionId ) ,
237
241
'nft' ,
238
- undefined as any ,
242
+ ethSigner ,
239
243
true ,
240
244
) ;
241
245
@@ -273,7 +277,7 @@ async function benchMintWithProperties(
273
277
const evmContract = await helper . ethNativeContract . collection (
274
278
helper . ethAddress . fromCollectionId ( collection . collectionId ) ,
275
279
'nft' ,
276
- undefined as any ,
280
+ ethSigner ,
277
281
) ;
278
282
279
283
const subTokenId = await evmContract . nextTokenId . staticCall ( ) ;
@@ -308,7 +312,7 @@ async function benchMintWithProperties(
308
312
const evmContract = await helper . ethNativeContract . collection (
309
313
helper . ethAddress . fromCollectionId ( collection . collectionId ) ,
310
314
'nft' ,
311
- undefined as any ,
315
+ ethSigner ,
312
316
) ;
313
317
314
318
await ( await evmContract . mintCross . send (
@@ -327,7 +331,7 @@ async function benchMintWithProperties(
327
331
async ( collection ) => {
328
332
await ( await proxyContract . mintToSubstrateWithProperty (
329
333
helper . ethAddress . fromCollectionId ( collection . collectionId ) ,
330
- susbstrateReceiver . addressRaw ,
334
+ hexlify ( substrateReceiver . addressRaw ) ,
331
335
PROPERTIES . slice ( 0 , setup . propertiesNumber ) ,
332
336
) ) . wait ( ...waitParams ) ;
333
337
} ,
@@ -342,7 +346,7 @@ async function benchMintWithProperties(
342
346
async ( collection ) => {
343
347
await ( await proxyContract . mintToSubstrateBulkProperty . send (
344
348
helper . ethAddress . fromCollectionId ( collection . collectionId ) ,
345
- susbstrateReceiver . addressRaw ,
349
+ hexlify ( substrateReceiver . addressRaw ) ,
346
350
PROPERTIES . slice ( 0 , setup . propertiesNumber ) ,
347
351
) ) . wait ( ...waitParams ) ;
348
352
} ,
0 commit comments