@@ -1053,7 +1053,8 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
10531053 properties : {
10541054 chainId : { type : 'integer' } ,
10551055 contractAddress : { type : 'keyword' } ,
1056- factoryDeployed : { type : 'boolean' } ,
1056+ name : { type : 'keyword' } ,
1057+ symbol : { type : 'keyword' } ,
10571058 transferable : { type : 'boolean' } ,
10581059 users : {
10591060 type : 'nested' ,
@@ -1064,8 +1065,8 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
10641065 txId : { type : 'keyword' }
10651066 }
10661067 } ,
1067- lastUpdatedBlock : { type : 'long' } ,
1068- lastTxId : { type : 'keyword' }
1068+ deploymentBlock : { type : 'long' } ,
1069+ deploymentTxId : { type : 'keyword' }
10691070 }
10701071 }
10711072 }
@@ -1081,7 +1082,9 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
10811082 contractAddress : string ,
10821083 transferable : boolean ,
10831084 block : number ,
1084- txId : string
1085+ txId : string ,
1086+ name ?: string ,
1087+ symbol ?: string
10851088 ) {
10861089 const id = this . docId ( chainId , contractAddress )
10871090 const lowerContract = contractAddress . toLowerCase ( )
@@ -1092,22 +1095,24 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
10921095 body : {
10931096 script : {
10941097 source : `
1095- ctx._source.factoryDeployed = true;
10961098 ctx._source.transferable = params.transferable;
1097- ctx._source.lastUpdatedBlock = params.block;
1098- ctx._source.lastTxId = params.txId;
1099+ ctx._source.deploymentBlock = params.block;
1100+ ctx._source.deploymentTxId = params.txId;
1101+ if (params.name != null) { ctx._source.name = params.name; }
1102+ if (params.symbol != null) { ctx._source.symbol = params.symbol; }
10991103 ` ,
11001104 lang : 'painless' ,
1101- params : { transferable, block, txId }
1105+ params : { transferable, block, txId, name , symbol }
11021106 } ,
11031107 upsert : {
11041108 chainId,
11051109 contractAddress : lowerContract ,
1106- factoryDeployed : true ,
1110+ name,
1111+ symbol,
11071112 transferable,
11081113 users : [ ] ,
1109- lastUpdatedBlock : block ,
1110- lastTxId : txId
1114+ deploymentBlock : block ,
1115+ deploymentTxId : txId
11111116 }
11121117 } ,
11131118 refresh : 'wait_for'
@@ -1166,20 +1171,15 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
11661171 if (ctx._source.users[i].tokenId == params.user.tokenId) { exists = true; break; }
11671172 }
11681173 if (!exists) { ctx._source.users.add(params.user); }
1169- ctx._source.lastUpdatedBlock = params.block;
1170- ctx._source.lastTxId = params.txId;
11711174 ` ,
11721175 lang : 'painless' ,
1173- params : { user : normalized , block : normalized . block , txId : normalized . txId }
1176+ params : { user : normalized }
11741177 } ,
11751178 upsert : {
11761179 chainId,
11771180 contractAddress : lowerContract ,
1178- factoryDeployed : false ,
11791181 transferable : false ,
1180- users : [ normalized ] ,
1181- lastUpdatedBlock : normalized . block ,
1182- lastTxId : normalized . txId
1182+ users : [ normalized ]
11831183 }
11841184 } ,
11851185 refresh : 'wait_for'
@@ -1197,13 +1197,7 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
11971197 }
11981198 }
11991199
1200- async removeUserByTokenId (
1201- chainId : number ,
1202- contractAddress : string ,
1203- tokenId : number ,
1204- block : number ,
1205- txId : string
1206- ) {
1200+ async removeUserByTokenId ( chainId : number , contractAddress : string , tokenId : number ) {
12071201 const id = this . docId ( chainId , contractAddress )
12081202 try {
12091203 await this . client . update ( {
@@ -1215,11 +1209,9 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
12151209 if (ctx._source.users != null) {
12161210 ctx._source.users.removeIf(u -> u.tokenId == params.tokenId);
12171211 }
1218- ctx._source.lastUpdatedBlock = params.block;
1219- ctx._source.lastTxId = params.txId;
12201212 ` ,
12211213 lang : 'painless' ,
1222- params : { tokenId, block , txId }
1214+ params : { tokenId }
12231215 }
12241216 } ,
12251217 refresh : 'wait_for'
@@ -1252,8 +1244,7 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
12521244 {
12531245 nested : {
12541246 path : 'users' ,
1255- query : { term : { 'users.wallet' : lowerWallet } } ,
1256- inner_hits : { _source : { includes : [ 'users' ] } }
1247+ query : { term : { 'users.wallet' : lowerWallet } }
12571248 }
12581249 }
12591250 ]
@@ -1268,10 +1259,7 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
12681259 query : { bool : { must : filters } }
12691260 }
12701261 } as any )
1271- return result . hits . hits . map ( ( h : any ) => ( {
1272- ...( h . _source as object ) ,
1273- innerHits : h . inner_hits ?. users ?. hits ?. hits ?. map ( ( ih : any ) => ih . _source ) ?? [ ]
1274- } ) )
1262+ return result . hits . hits . map ( ( h : any ) => h . _source )
12751263 } catch ( error ) {
12761264 const errorMsg = `Error when searching access lists by wallet ${ lowerWallet } : ${ error . message } `
12771265 DATABASE_LOGGER . logMessageWithEmoji (
0 commit comments