@boostxyz/sdk 5.2.1 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/Actions/Action.cjs +1 -1
- package/dist/Actions/Action.js +1 -1
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +84 -41
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +1866 -378
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +2 -2
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.js +2 -2
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.js +3 -3
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +42 -1
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +360 -318
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.js +2 -2
- package/dist/{Budget-N0YEfSt2.cjs → Budget-AoNx7uFd.cjs} +2 -2
- package/dist/{Budget-N0YEfSt2.cjs.map → Budget-AoNx7uFd.cjs.map} +1 -1
- package/dist/{Budget-C0SMvfEl.js → Budget-DYIV9iNK.js} +3 -3
- package/dist/{Budget-C0SMvfEl.js.map → Budget-DYIV9iNK.js.map} +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +2 -2
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.js +2 -2
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.js +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.js +2 -2
- package/dist/Incentive-BbkfwGOb.cjs +2 -0
- package/dist/Incentive-BbkfwGOb.cjs.map +1 -0
- package/dist/{Incentive-DBZHQ9Np.js → Incentive-qlnv5kQB.js} +77 -50
- package/dist/Incentive-qlnv5kQB.js.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.js +3 -3
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.js +2 -2
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.js +6 -6
- package/dist/Incentives/ERC20PeggedIncentive.d.ts +10 -1
- package/dist/Incentives/ERC20PeggedIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js +2 -2
- package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +2 -2
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.js +2 -2
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.js +2 -2
- package/dist/{SimpleDenyList-B8QeJthf.js → SimpleDenyList-ByAr4X1r.js} +3 -3
- package/dist/{SimpleDenyList-B8QeJthf.js.map → SimpleDenyList-ByAr4X1r.js.map} +1 -1
- package/dist/{SimpleDenyList-DIb4xX3j.cjs → SimpleDenyList-CsRXJPwm.cjs} +2 -2
- package/dist/{SimpleDenyList-DIb4xX3j.cjs.map → SimpleDenyList-CsRXJPwm.cjs.map} +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs +1 -1
- package/dist/Validators/LimitedSignerValidator.js +2 -2
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.js +2 -2
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +1 -1
- package/dist/{deployments-COxshLqt.js → deployments-D0fs26TV.js} +16 -16
- package/dist/{deployments-COxshLqt.js.map → deployments-D0fs26TV.js.map} +1 -1
- package/dist/{deployments-BGpr4ppG.cjs → deployments-DoIOqxco.cjs} +2 -2
- package/dist/deployments-DoIOqxco.cjs.map +1 -0
- package/dist/deployments.json +3 -3
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +40 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +42 -16
- package/dist/errors.js.map +1 -1
- package/dist/{generated-ClbO_ULI.js → generated-Cyvr_Tjx.js} +446 -438
- package/dist/generated-Cyvr_Tjx.js.map +1 -0
- package/dist/{generated-CRD9XfOT.cjs → generated-DtYPHhtX.cjs} +2 -2
- package/dist/generated-DtYPHhtX.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +160 -155
- package/package.json +1 -1
- package/src/Actions/EventAction.test.ts +294 -3
- package/src/Actions/EventAction.ts +417 -154
- package/src/BoostCore.test.ts +51 -3
- package/src/BoostCore.ts +73 -0
- package/src/Incentives/ERC20PeggedIncentive.ts +33 -4
- package/src/errors.ts +50 -0
- package/dist/Incentive-BpZePiOD.cjs +0 -2
- package/dist/Incentive-BpZePiOD.cjs.map +0 -1
- package/dist/Incentive-DBZHQ9Np.js.map +0 -1
- package/dist/deployments-BGpr4ppG.cjs.map +0 -1
- package/dist/generated-CRD9XfOT.cjs.map +0 -1
- package/dist/generated-ClbO_ULI.js.map +0 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
selectors as eventSelectors,
|
|
3
|
+
abi as eventAbi,
|
|
4
|
+
} from "@boostxyz/signatures/events";
|
|
2
5
|
import { selectors as funcSelectors } from "@boostxyz/signatures/functions";
|
|
3
6
|
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
4
7
|
import {
|
|
5
|
-
AbiEvent,
|
|
6
|
-
AbiFunction,
|
|
8
|
+
type AbiEvent,
|
|
7
9
|
type Address,
|
|
10
|
+
type Log,
|
|
8
11
|
type Hex,
|
|
9
12
|
isAddress,
|
|
10
13
|
isAddressEqual,
|
|
@@ -36,6 +39,9 @@ import {
|
|
|
36
39
|
Criteria,
|
|
37
40
|
anyActionParameter,
|
|
38
41
|
transactionSenderClaimant,
|
|
42
|
+
packFieldIndexes,
|
|
43
|
+
unpackFieldIndexes,
|
|
44
|
+
decodeAndReorderLogArgs
|
|
39
45
|
} from "./EventAction";
|
|
40
46
|
import { allKnownSignatures } from "@boostxyz/test/allKnownSignatures";
|
|
41
47
|
import { getTransactionReceipt } from "@wagmi/core";
|
|
@@ -301,6 +307,7 @@ describe("EventAction Event Selector", () => {
|
|
|
301
307
|
defaultOptions,
|
|
302
308
|
basicErc721TransferAction(erc721),
|
|
303
309
|
);
|
|
310
|
+
// @ts-expect-error
|
|
304
311
|
await action.deploy();
|
|
305
312
|
expect(isAddress(action.assertValidAddress())).toBe(true);
|
|
306
313
|
});
|
|
@@ -961,6 +968,7 @@ describe("EventAction Func Selector", () => {
|
|
|
961
968
|
defaultOptions,
|
|
962
969
|
basicErc721MintFuncAction(erc721),
|
|
963
970
|
);
|
|
971
|
+
// @ts-expect-error
|
|
964
972
|
await action.deploy();
|
|
965
973
|
expect(isAddress(action.assertValidAddress())).toBe(true);
|
|
966
974
|
});
|
|
@@ -1221,3 +1229,286 @@ describe("EventAction Func Selector", () => {
|
|
|
1221
1229
|
).toBe(true);
|
|
1222
1230
|
});
|
|
1223
1231
|
});
|
|
1232
|
+
|
|
1233
|
+
describe("Tuple & bitpacked fieldIndex support", () => {
|
|
1234
|
+
describe("packFieldIndexes / unpackFieldIndexes", () => {
|
|
1235
|
+
test("packs up to five indexes and unpacks them correctly", () => {
|
|
1236
|
+
const indexes = [0, 3, 5, 10, 63]; // sample indexes
|
|
1237
|
+
const packed = packFieldIndexes(indexes);
|
|
1238
|
+
const result = unpackFieldIndexes(packed);
|
|
1239
|
+
const resultIndexes = [0, 3, 5, 10]; // 63 is a terminator and won't be included since it triggers a break
|
|
1240
|
+
|
|
1241
|
+
expect(result).toEqual(resultIndexes);
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
test("packs 3 indexes with the automatic addition of a terminator and unpacks them correctly", () => {
|
|
1245
|
+
const indexes = [0, 3, 5]; // sample indexes
|
|
1246
|
+
const packed = packFieldIndexes(indexes);
|
|
1247
|
+
const result = unpackFieldIndexes(packed);
|
|
1248
|
+
const resultIndexes = [0, 3, 5]; // should terminate on it's own even if a terminator isn't passed in
|
|
1249
|
+
|
|
1250
|
+
expect(result).toEqual(resultIndexes);
|
|
1251
|
+
});
|
|
1252
|
+
|
|
1253
|
+
test("throws if more than five indexes are provided", () => {
|
|
1254
|
+
expect(() => packFieldIndexes([1, 2, 3, 4, 5, 6])).toThrowError(
|
|
1255
|
+
"Can only pack up to 5 indexes.",
|
|
1256
|
+
);
|
|
1257
|
+
});
|
|
1258
|
+
|
|
1259
|
+
test("throws if an index exceeds the max field index (63)", () => {
|
|
1260
|
+
// 64 is out of range
|
|
1261
|
+
expect(() => packFieldIndexes([64])).toThrowError(
|
|
1262
|
+
"Index 64 exceeds the maximum allowed value (63).",
|
|
1263
|
+
);
|
|
1264
|
+
});
|
|
1265
|
+
|
|
1266
|
+
test("terminates on max-field-index in unpackFieldIndexes", () => {
|
|
1267
|
+
// 63 is used as a "terminator," so anything after 63 should be truncated
|
|
1268
|
+
// Example: [2, 63, 7] => We expect only [2] because 63 signals end
|
|
1269
|
+
const packed = packFieldIndexes([2, 63, 7]);
|
|
1270
|
+
const result = unpackFieldIndexes(packed);
|
|
1271
|
+
|
|
1272
|
+
// we expect only [2], because 63 signals "stop"
|
|
1273
|
+
expect(result).toEqual([2]);
|
|
1274
|
+
});
|
|
1275
|
+
});
|
|
1276
|
+
|
|
1277
|
+
describe("parseFieldFromAbi with TUPLE bitpacked indexes", () => {
|
|
1278
|
+
// We'll create a minimal EventAction or a direct call to parseFieldFromAbi
|
|
1279
|
+
// to show we can handle a TUPLE index that references nested components
|
|
1280
|
+
|
|
1281
|
+
test("handles a single-level tuple with one sub-index", async () => {
|
|
1282
|
+
// Suppose we have a tuple param in index 0, with a single sub-field
|
|
1283
|
+
// We'll pack the indexes: [0, 0]
|
|
1284
|
+
// i.e. top-level param at index 0 is a tuple, then sub-field 0
|
|
1285
|
+
const tupleIndex = packFieldIndexes([0, 0]);
|
|
1286
|
+
|
|
1287
|
+
// We'll construct a minimal event or function input ABI with 1 param: a tuple of [address].
|
|
1288
|
+
const abiInputs = [
|
|
1289
|
+
{
|
|
1290
|
+
type: "tuple",
|
|
1291
|
+
components: [{ type: "address" }],
|
|
1292
|
+
},
|
|
1293
|
+
];
|
|
1294
|
+
|
|
1295
|
+
// The actual values we decoded: array of one tuple => [ ["0x1234..."] ]
|
|
1296
|
+
const allArgs = [
|
|
1297
|
+
// param 0 is a tuple of length 1 => the "address"
|
|
1298
|
+
["0x111122223333444455556666777788889999AaAa"],
|
|
1299
|
+
];
|
|
1300
|
+
|
|
1301
|
+
const action = new EventAction(
|
|
1302
|
+
defaultOptions,
|
|
1303
|
+
basicErc721MintFuncAction(erc721),
|
|
1304
|
+
);
|
|
1305
|
+
|
|
1306
|
+
const { value, type } = action.parseFieldFromAbi(
|
|
1307
|
+
allArgs,
|
|
1308
|
+
tupleIndex, // bitpacked indexes
|
|
1309
|
+
abiInputs,
|
|
1310
|
+
PrimitiveType.TUPLE, // declared TUPLE
|
|
1311
|
+
);
|
|
1312
|
+
|
|
1313
|
+
expect(type).toBe(PrimitiveType.ADDRESS);
|
|
1314
|
+
expect(value).toBe("0x111122223333444455556666777788889999AaAa");
|
|
1315
|
+
});
|
|
1316
|
+
|
|
1317
|
+
test("handles deeper nested tuples with multiple sub-indexes", async () => {
|
|
1318
|
+
// Suppose param 1 is a tuple, inside that subcomponent 2 is also a tuple, etc.
|
|
1319
|
+
const tupleIndex = packFieldIndexes([1, 2, 0]); // for example
|
|
1320
|
+
|
|
1321
|
+
// Our ABI might have 2 top-level params: param 0 is a normal uint, param 1 is a tuple
|
|
1322
|
+
// That tuple's 'components' has at least 3 fields, so we pick sub-field #2
|
|
1323
|
+
// that sub-field #2 might itself be a tuple with at least 1 field => sub-sub-field #0
|
|
1324
|
+
const abiInputs = [
|
|
1325
|
+
{ type: "uint256" }, // param 0
|
|
1326
|
+
{
|
|
1327
|
+
type: "tuple",
|
|
1328
|
+
components: [
|
|
1329
|
+
{ type: "address" }, // sub-field 0
|
|
1330
|
+
{ type: "uint256" }, // sub-field 1
|
|
1331
|
+
{
|
|
1332
|
+
type: "tuple", // sub-field 2
|
|
1333
|
+
components: [{ type: "string" }], // sub-sub-field 0
|
|
1334
|
+
},
|
|
1335
|
+
],
|
|
1336
|
+
},
|
|
1337
|
+
];
|
|
1338
|
+
|
|
1339
|
+
const allArgs = [
|
|
1340
|
+
123n, // param 0
|
|
1341
|
+
[
|
|
1342
|
+
"0x111122223333444455556666777788889999AaAa", // sub-field0
|
|
1343
|
+
999n, // sub-field1
|
|
1344
|
+
// sub-field2 => tuple
|
|
1345
|
+
["hello world"], // sub-sub-field 0
|
|
1346
|
+
],
|
|
1347
|
+
];
|
|
1348
|
+
|
|
1349
|
+
const action = new EventAction(
|
|
1350
|
+
defaultOptions,
|
|
1351
|
+
basicErc721MintFuncAction(erc721),
|
|
1352
|
+
);
|
|
1353
|
+
const { value, type } = action.parseFieldFromAbi(
|
|
1354
|
+
allArgs,
|
|
1355
|
+
tupleIndex,
|
|
1356
|
+
abiInputs,
|
|
1357
|
+
PrimitiveType.TUPLE, // We know it's a nested TUPLE
|
|
1358
|
+
);
|
|
1359
|
+
|
|
1360
|
+
expect(type).toBe(PrimitiveType.STRING);
|
|
1361
|
+
expect(value).toBe("hello world");
|
|
1362
|
+
});
|
|
1363
|
+
|
|
1364
|
+
test("throws if TUPLE indexes go out of range", async () => {
|
|
1365
|
+
const tupleIndex = packFieldIndexes([1, 2, 9]); // sub-field #9 doesn't exist
|
|
1366
|
+
const abiInputs = [
|
|
1367
|
+
{ type: "uint256" },
|
|
1368
|
+
{
|
|
1369
|
+
type: "tuple",
|
|
1370
|
+
components: [
|
|
1371
|
+
{ type: "address" },
|
|
1372
|
+
{ type: "uint256" },
|
|
1373
|
+
{
|
|
1374
|
+
type: "tuple",
|
|
1375
|
+
components: [{ type: "string" }],
|
|
1376
|
+
},
|
|
1377
|
+
],
|
|
1378
|
+
},
|
|
1379
|
+
];
|
|
1380
|
+
const allArgs = [
|
|
1381
|
+
123n,
|
|
1382
|
+
[
|
|
1383
|
+
"0x111122223333444455556666777788889999AaAa",
|
|
1384
|
+
999n,
|
|
1385
|
+
["hello world"],
|
|
1386
|
+
],
|
|
1387
|
+
];
|
|
1388
|
+
const action = new EventAction(
|
|
1389
|
+
defaultOptions,
|
|
1390
|
+
basicErc721MintFuncAction(erc721),
|
|
1391
|
+
);
|
|
1392
|
+
expect(() =>
|
|
1393
|
+
action.parseFieldFromAbi(allArgs, tupleIndex, abiInputs, PrimitiveType.TUPLE),
|
|
1394
|
+
).toThrowError("Failed to decode tuple: 9");
|
|
1395
|
+
});
|
|
1396
|
+
});
|
|
1397
|
+
});
|
|
1398
|
+
|
|
1399
|
+
describe('decodeAndReorderLogArgs', () => {
|
|
1400
|
+
test('correctly reorders mixed indexed and non-indexed parameters', () => {
|
|
1401
|
+
const event = eventAbi[
|
|
1402
|
+
'Minted(address indexed,uint8,uint8,address indexed,(uint32,uint256,address,uint32,uint32,uint32,address,bool,uint256,uint256,uint256,uint256,uint256),uint256 indexed)'
|
|
1403
|
+
] as AbiEvent;
|
|
1404
|
+
|
|
1405
|
+
const log: Log = {
|
|
1406
|
+
address: "0x000000000001a36777f9930aaeff623771b13e70",
|
|
1407
|
+
blockHash: "0xf529b056439fb090e974a2567642500ede9b5632ddb3bc138e6bebdf18ce367a",
|
|
1408
|
+
blockNumber: 24706315n,
|
|
1409
|
+
data: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000015a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000512b55b00d744fc2edb8474f223a7498c3e5a7ce00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000002c2ad68fd900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f8c501d9b0000000000000000000000000000000000000000000000000000000c9e86723e0000000000000000000000000000000000000000000000000000000000000000000",
|
|
1410
|
+
logIndex: 379,
|
|
1411
|
+
removed: false,
|
|
1412
|
+
topics: [
|
|
1413
|
+
"0x2a29f7402bd32f0e4bbe17d44be064f7f64d96ee174ed7cb27936d869bf9a888",
|
|
1414
|
+
"0x0000000000000000000000008bc2a882609060bf9b5c673af5d11795463b9230",
|
|
1415
|
+
"0x000000000000000000000000234d469154ed5cec5a8c22b186e4766d556702ff",
|
|
1416
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
1417
|
+
],
|
|
1418
|
+
transactionHash: "0x604496c89be16e005314db89478c9999fc55aa95e8bbc6d5e8b2a26afc82abb7",
|
|
1419
|
+
transactionIndex: 110,
|
|
1420
|
+
};
|
|
1421
|
+
|
|
1422
|
+
const result = decodeAndReorderLogArgs(event, log);
|
|
1423
|
+
|
|
1424
|
+
expect(result.args[0]).toBe("0x8BC2A882609060Bf9b5C673aF5D11795463B9230");
|
|
1425
|
+
expect(result.args[1]).toBe(0);
|
|
1426
|
+
expect(result.args[2]).toBe(0);
|
|
1427
|
+
expect(result.args[3]).toBe("0x234d469154eD5cEC5A8C22b186e4766d556702ff");
|
|
1428
|
+
expect(Array.isArray(result.args[4]));
|
|
1429
|
+
expect(result.args[5]).toBe(0n);
|
|
1430
|
+
});
|
|
1431
|
+
|
|
1432
|
+
test('correctly reorders mixed indexed and non-indexed parameters', () => {
|
|
1433
|
+
const event = eventAbi['NameRegistered(string,bytes32 indexed,address indexed,uint256)'] as AbiEvent;
|
|
1434
|
+
|
|
1435
|
+
const log: Log = {
|
|
1436
|
+
address: "0x4ccb0bb02fcaba27e82a56646e81d8c5bc4119a5",
|
|
1437
|
+
blockHash: "0xd3756b6a35ebee1bfcf66b605dc3bd6fc85ca282ed94b190b25db4c6b3ef188a",
|
|
1438
|
+
blockNumber: 23536079n,
|
|
1439
|
+
data: "0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000693a2861000000000000000000000000000000000000000000000000000000000000000c626f6f73742d6d61747469650000000000000000000000000000000000000000",
|
|
1440
|
+
logIndex: 133,
|
|
1441
|
+
removed: false,
|
|
1442
|
+
topics: [
|
|
1443
|
+
"0x0667086d08417333ce63f40d5bc2ef6fd330e25aaaf317b7c489541f8fe600fa",
|
|
1444
|
+
"0x82de51675fd710fc7a247469e170340787130a61b84dc3446b63277e03e4abd9",
|
|
1445
|
+
"0x000000000000000000000000865c301c46d64de5c9b124ec1a97ef1efc1bcbd1"
|
|
1446
|
+
],
|
|
1447
|
+
transactionHash: "0xbe54acb2ceb28e7eb962e09218d51ab3369139ac3fd782cacccf163f0daf1a08",
|
|
1448
|
+
transactionIndex: 26,
|
|
1449
|
+
};
|
|
1450
|
+
|
|
1451
|
+
const result = decodeAndReorderLogArgs(event, log);
|
|
1452
|
+
|
|
1453
|
+
expect(result.args[0]).toBe("boost-mattie");
|
|
1454
|
+
expect(result.args[1]).toBe("0x82de51675fd710fc7a247469e170340787130a61b84dc3446b63277e03e4abd9");
|
|
1455
|
+
expect(result.args[2]).toBe("0x865C301c46d64DE5c9B124Ec1a97eF1EFC1bcbd1");
|
|
1456
|
+
expect(result.args[3]).toBe(1765419105n);
|
|
1457
|
+
});
|
|
1458
|
+
|
|
1459
|
+
test('works with events where params are already correctly ordered', () => {
|
|
1460
|
+
const event = eventAbi["BoostCreated(uint256 indexed,address indexed,address indexed,uint256,address,address,address)"] as AbiEvent;
|
|
1461
|
+
|
|
1462
|
+
const log: Log = {
|
|
1463
|
+
address: "0xdcffce9d8185706780a46cf04d9c6b86b3451497",
|
|
1464
|
+
blockHash: "0xdfcbc66fc07d41321badb8f8afa3e8fea3f65e87791d3de1ad07d470b2ff1c8e",
|
|
1465
|
+
blockNumber: 7449080n,
|
|
1466
|
+
data: "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e81490c0b9e625999c78f155c7bcf7f11f512b390000000000000000000000003322baef13ac75b1b1e25abc65c0df28f9e55670000000000000000000000000d1513f67da84dec0759f6a715bf28a637c7de716",
|
|
1467
|
+
logIndex: 141,
|
|
1468
|
+
removed: false,
|
|
1469
|
+
topics: [
|
|
1470
|
+
"0x116812d3ad4507d72f2c428b63246d594ca055a1dc119394285504c23d1f34cd",
|
|
1471
|
+
"0x000000000000000000000000000000000000000000000000000000000000006f",
|
|
1472
|
+
"0x0000000000000000000000000000c1e5c9d12c8c52eb319af11da44bb84779d2",
|
|
1473
|
+
"0x0000000000000000000000008b1646483aeedd894feb417da1f5a7ab1846e81e"
|
|
1474
|
+
],
|
|
1475
|
+
transactionHash: "0xb23270a738440be31b2e6c2e1180324f04159d7bfd681564e877d8675fd8b5c2",
|
|
1476
|
+
transactionIndex: 79,
|
|
1477
|
+
};
|
|
1478
|
+
|
|
1479
|
+
const result = decodeAndReorderLogArgs(event, log);
|
|
1480
|
+
|
|
1481
|
+
expect(result.args[0]).toBe(111n);
|
|
1482
|
+
expect(result.args[1]).toBe("0x0000c1E5C9d12c8c52eb319AF11dA44bb84779d2");
|
|
1483
|
+
expect(result.args[2]).toBe("0x8B1646483aEedd894feB417dA1f5a7Ab1846E81E");
|
|
1484
|
+
expect(result.args[3]).toBe(1n);
|
|
1485
|
+
expect(result.args[4]).toBe("0xE81490c0b9e625999C78f155c7bCf7f11f512B39");
|
|
1486
|
+
expect(result.args[5]).toBe("0x3322BaEf13ac75B1b1E25Abc65c0dF28f9e55670");
|
|
1487
|
+
expect(result.args[6]).toBe("0xD1513f67da84DEc0759F6a715BF28A637c7de716");
|
|
1488
|
+
});
|
|
1489
|
+
|
|
1490
|
+
test('works with events where there is no indexed params', () => {
|
|
1491
|
+
const event = eventAbi['Minted(uint8,address,uint256,uint256)'] as AbiEvent;
|
|
1492
|
+
|
|
1493
|
+
const log: Log = {
|
|
1494
|
+
address: "0x45ecff1c647a32455ced5c21400fe61aa2be680b",
|
|
1495
|
+
blockHash: "0xc5b14f59a5bc89e6a6ecdd595d4d10d1dd82adc624a04717fdff78bbb9dac988",
|
|
1496
|
+
blockNumber: 24749935n,
|
|
1497
|
+
data: "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000865c301c46d64de5c9b124ec1a97ef1efc1bcbd1000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000014a4",
|
|
1498
|
+
logIndex: 188,
|
|
1499
|
+
removed: false,
|
|
1500
|
+
topics: [
|
|
1501
|
+
"0x7ac572687bf4e66a8514fc2ec464fc2644c78bcb1d80a225fc51a33e0ee38bfa"
|
|
1502
|
+
],
|
|
1503
|
+
transactionHash: "0x0e4aba5edcbfff24d25290066b992ef5670a00864febe38ffaeb8cb1476faa96",
|
|
1504
|
+
transactionIndex: 42,
|
|
1505
|
+
};
|
|
1506
|
+
|
|
1507
|
+
const result = decodeAndReorderLogArgs(event, log);
|
|
1508
|
+
|
|
1509
|
+
expect(result.args[0]).toBe(1);
|
|
1510
|
+
expect(result.args[1]).toBe("0x865C301c46d64DE5c9B124Ec1a97eF1EFC1bcbd1");
|
|
1511
|
+
expect(result.args[2]).toBe(1n);
|
|
1512
|
+
expect(result.args[3]).toBe(5284n);
|
|
1513
|
+
});
|
|
1514
|
+
});
|