@@ -277,4 +277,32 @@ class EIP681Tests: LocalTestCase {
277277 XCTAssertEqual ( data ? [ 0 ] , [ " 123 " , " 2 " , " 5000 " , " wwweer2-=! " ] )
278278 XCTAssertEqual ( data ? [ 1 ] , [ " test1 " , " demo " ] )
279279 }
280+
281+ func testMakeEIP681Link( ) throws {
282+ var eip681Link = Web3 . EIP681Code ( Web3 . EIP681Code. TargetAddress. ethereumAddress ( EthereumAddress ( " 0x9aBbDB06A61cC686BD635484439549D45c2449cc " ) !) )
283+
284+ eip681Link. functionName = " setData "
285+ eip681Link. parameters = [ Web3 . EIP681Code. EIP681Parameter ( type: . array( type: . bytes( length: 32 ) , length: 0 ) ,
286+ value: [ Data . fromHex ( " 0x1234789565875498655487123478956587549865548712347895658754980000 " ) !,
287+ Data . fromHex ( " 0x1234789565875498655487123478956587549865548712347895658754986554 " ) !] as AnyObject ) ,
288+ Web3 . EIP681Code. EIP681Parameter ( type: . array( type: . dynamicBytes, length: 0 ) ,
289+ value: [ Data . fromHex ( " 0x12345607 " ) !,
290+ Data . fromHex ( " 0x8965abcdef " ) !] as AnyObject ) ,
291+ Web3 . EIP681Code. EIP681Parameter ( type: . uint( bits: 256 ) ,
292+ value: 98986565 as AnyObject ) ,
293+ Web3 . EIP681Code. EIP681Parameter ( type: . int( bits: 256 ) ,
294+ value: 155445566 as AnyObject ) ,
295+ Web3 . EIP681Code. EIP681Parameter ( type: . address,
296+ value: EthereumAddress ( " 0x9aBbDB06A61cC686BD635484439549D45c2449cc " ) ! as AnyObject ) ,
297+ Web3 . EIP681Code. EIP681Parameter ( type: . bytes( length: 5 ) ,
298+ value: " 0x9aBbDB06A6 " as AnyObject ) ,
299+ Web3 . EIP681Code. EIP681Parameter ( type: . bytes( length: 3 ) ,
300+ value: Data . fromHex ( " 0x9aBbDB " ) ! as AnyObject ) ,
301+ Web3 . EIP681Code. EIP681Parameter ( type: . dynamicBytes,
302+ value: Data . fromHex ( " 0x11009aBbDB87879898656545 " ) ! as AnyObject ) ,
303+ Web3 . EIP681Code. EIP681Parameter ( type: . string,
304+ value: " this is EIP681 query parameter string " as AnyObject ) ]
305+
306+ XCTAssertEqual ( eip681Link. makeEIP681Link ( ) , " ethereum:0x9aBbDB06A61cC686BD635484439549D45c2449cc/setData?bytes32[]=[0x1234789565875498655487123478956587549865548712347895658754980000,0x1234789565875498655487123478956587549865548712347895658754986554]&bytes[]=[0x12345607,0x8965abcdef]&uint256=98986565&int256=155445566&address=0x9aBbDB06A61cC686BD635484439549D45c2449cc&bytes5=0x9abbdb06a6&bytes3=0x9abbdb&bytes=0x11009abbdb87879898656545&string=this is EIP681 query parameter string " )
307+ }
280308}
0 commit comments