@@ -2137,7 +2137,7 @@ enum Logger_LogLevel @imported(
2137
2137
const client = await getClient ( {
2138
2138
interfaces : [
2139
2139
{
2140
- interface : "w3://ens/interface.eth" ,
2140
+ interface : interfaceUri ,
2141
2141
implementations : [ implementationUri ] ,
2142
2142
}
2143
2143
] ,
@@ -2164,5 +2164,93 @@ enum Logger_LogLevel @imported(
2164
2164
expect ( ( query . data as any ) . queryImplementations ) . toEqual ( [ implementationUri ] ) ;
2165
2165
} ) ;
2166
2166
2167
+ it ( "e2e Interface invoke method " , async ( ) => {
2168
+ const interfaceUri = "w3://ens/interface.eth"
2169
+
2170
+ const implementationApi = await buildAndDeployApi (
2171
+ `${ GetPathToTestApis ( ) } /interface-invoke/test-implementation` ,
2172
+ ipfsProvider ,
2173
+ ensAddress
2174
+ ) ;
2175
+ const implementationUri = `w3://ens/testnet/${ implementationApi . ensDomain } ` ;
2176
+
2177
+ const client = await getClient ( {
2178
+ interfaces : [
2179
+ {
2180
+ interface : interfaceUri ,
2181
+ implementations : [ implementationUri ] ,
2182
+ }
2183
+ ] ,
2184
+ } ) ;
2185
+
2186
+ const api = await buildAndDeployApi (
2187
+ `${ GetPathToTestApis ( ) } /interface-invoke/test-api` ,
2188
+ ipfsProvider ,
2189
+ ensAddress
2190
+ ) ;
2191
+ const apiUri = `w3://ens/testnet/${ api . ensDomain } ` ;
2192
+
2193
+ const query = await client . query < {
2194
+ queryMethod : string ;
2195
+ abstractQueryMethod : string ;
2196
+ } > ( {
2197
+ uri : apiUri ,
2198
+ query : `
2199
+ query {
2200
+ queryMethod(
2201
+ arg: $argument1
2202
+ )
2203
+ abstractQueryMethod(
2204
+ arg: $argument2
2205
+ )
2206
+ }
2207
+ ` ,
2208
+ variables : {
2209
+ argument1 : {
2210
+ uint8 : 1 ,
2211
+ str : "Test String 1" ,
2212
+ } ,
2213
+ argument2 : {
2214
+ str : "Test String 2" ,
2215
+ } ,
2216
+ } ,
2217
+ } ) ;
2218
+
2219
+ expect ( query . errors ) . toBeFalsy ( ) ;
2220
+ expect ( query . data ) . toBeTruthy ( ) ;
2221
+ expect ( query . data ?. queryMethod ) . toEqual ( {
2222
+ uint8 : 1 ,
2223
+ str : "Test String 1" ,
2224
+ } ) ;
2225
+
2226
+ expect ( query . data ?. abstractQueryMethod ) . toBe ( "Test String 2" ) ;
2227
+
2228
+ const mutation = await client . query < {
2229
+ mutationMethod : string ;
2230
+ abstractMutationMethod : string ;
2231
+ } > ( {
2232
+ uri : implementationUri ,
2233
+ query : `
2234
+ mutation {
2235
+ mutationMethod(
2236
+ arg: $argument1
2237
+ )
2238
+ abstractMutationMethod(
2239
+ arg: $argument2
2240
+ )
2241
+ }
2242
+ ` ,
2243
+ variables : {
2244
+ argument1 : 1 ,
2245
+ argument2 : 2 ,
2246
+ } ,
2247
+ } ) ;
2248
+
2249
+ expect ( mutation . errors ) . toBeFalsy ( ) ;
2250
+ expect ( mutation . data ) . toBeTruthy ( ) ;
2251
+ expect ( mutation . data ?. mutationMethod ) . toBe ( 1 ) ;
2252
+ expect ( mutation . data ?. abstractMutationMethod ) . toBe ( 2 ) ;
2253
+ } ) ;
2254
+
2167
2255
} ) ;
2168
2256
0 commit comments