@indexing/jiti 0.0.40 → 0.0.41

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/dist/module.js CHANGED
@@ -75,7 +75,7 @@ const $bea1ed486f96b980$export$ace043a4f2efe476 = {
75
75
  const changes = tx.changes;
76
76
  for(let ci = 0; ci < changes.length; ci += 1){
77
77
  if (!changes[ci]?.data) continue;
78
- const { address: accountAddress, data: { data: { balance: balance, metadata: metadata }, type: changeType } } = changes[ci];
78
+ const { address: accountAddress, data: { data: { balance: balance, metadata: metadata, owner: owner }, type: changeType } } = changes[ci];
79
79
  if (changeType === "0x1::fungible_asset::FungibleStore") {
80
80
  if (!accountAddressMap[accountAddress]) accountAddressMap[accountAddress] = changes[ci + 1]?.data.data.owner;
81
81
  const to = accountAddressMap[accountAddress];
@@ -92,6 +92,19 @@ const $bea1ed486f96b980$export$ace043a4f2efe476 = {
92
92
  transactionGasFee: gasUsed,
93
93
  transactionHash: tx.hash
94
94
  });
95
+ } else if (owner?.length > 4) {
96
+ const payload = tx.payload;
97
+ if (payload && payload.function === "0x1::aptos_account::transfer_coins") transfers.push({
98
+ amount: BigInt(payload.arguments[1]),
99
+ blockNumber: parseInt(block.block_height, 10),
100
+ from: sender,
101
+ to: owner,
102
+ timestamp: timestamp,
103
+ token: null,
104
+ tokenType: "NATIVE",
105
+ transactionGasFee: gasUsed,
106
+ transactionHash: tx.hash
107
+ });
95
108
  }
96
109
  }
97
110
  for (const evt of tx.events){
@@ -113,9 +126,7 @@ const $bea1ed486f96b980$export$ace043a4f2efe476 = {
113
126
  }
114
127
  for (const partial of Object.values(transfersByKey)){
115
128
  if (!partial.from || !partial.to) continue;
116
- const fromAddr = partial.from.length < 66 ? `0x0${partial.from.slice(2)}` : partial.from;
117
- const toAddr = partial.to.length < 66 ? `0x0${partial.to.slice(2)}` : partial.to;
118
- if (toAddr === "0x00") continue;
129
+ if (partial.to === "0x00") continue;
119
130
  let finalToken = null;
120
131
  let finalTokenType = "TOKEN";
121
132
  if (partial.tokenAddress?.toLowerCase().includes("aptos_coin")) finalToken = null;
@@ -123,8 +134,8 @@ const $bea1ed486f96b980$export$ace043a4f2efe476 = {
123
134
  transfers.push({
124
135
  amount: BigInt(partial.amount),
125
136
  blockNumber: parseInt(block.block_height, 10),
126
- from: fromAddr,
127
- to: toAddr,
137
+ from: partial.from,
138
+ to: partial.to,
128
139
  timestamp: timestamp,
129
140
  token: finalToken,
130
141
  tokenType: finalTokenType,
@@ -133,7 +144,15 @@ const $bea1ed486f96b980$export$ace043a4f2efe476 = {
133
144
  });
134
145
  }
135
146
  }
136
- return transfers;
147
+ return transfers.filter((txfer)=>txfer.to?.length > 4).map((txfer)=>{
148
+ const fromAddr = txfer.from.length < 66 ? `0x${txfer.from.slice(2).padStart(64, "0")}` : txfer.from;
149
+ const toAddr = txfer.to.length < 66 ? `0x${txfer.to.slice(2).padStart(64, "0")}` : txfer.to;
150
+ return {
151
+ ...txfer,
152
+ from: fromAddr,
153
+ to: toAddr
154
+ };
155
+ });
137
156
  },
138
157
  tests: [
139
158
  {
@@ -218,6 +237,38 @@ const $bea1ed486f96b980$export$ace043a4f2efe476 = {
218
237
  transactionHash: "0xc5a21679a947f986908b09091516bc3896245d974686ca2bd5709b7dbc5118fb"
219
238
  }
220
239
  ]
240
+ },
241
+ {
242
+ params: {
243
+ network: "APTOS",
244
+ contractAddress: "",
245
+ walletAddress: "0x089556578008574ed3fddda6bc2ea6bee475b042e237bbb2f447c263086edcc5"
246
+ },
247
+ payload: "https://jiti.indexing.co/networks/aptos/403873552",
248
+ output: [
249
+ {
250
+ amount: 19500000n,
251
+ blockNumber: 403873552,
252
+ from: "0x8509aa39bc09ea530b0481c573c0215781c01fa363c135996614bb11cf337703",
253
+ timestamp: "2025-08-11T11:07:54.286Z",
254
+ to: "0x089556578008574ed3fddda6bc2ea6bee475b042e237bbb2f447c263086edcc5",
255
+ token: "0xa",
256
+ tokenType: "TOKEN",
257
+ transactionGasFee: 18n,
258
+ transactionHash: "0xa7d2d682f6940c1023d95ae8950b8d1dc0604abd34a4a2cc654f1be6f330ca44"
259
+ },
260
+ {
261
+ amount: 9500000n,
262
+ blockNumber: 403873552,
263
+ from: "0x8509aa39bc09ea530b0481c573c0215781c01fa363c135996614bb11cf337703",
264
+ timestamp: "2025-08-11T11:07:54.286Z",
265
+ to: "0x089556578008574ed3fddda6bc2ea6bee475b042e237bbb2f447c263086edcc5",
266
+ token: null,
267
+ tokenType: "NATIVE",
268
+ transactionGasFee: 18n,
269
+ transactionHash: "0xa7d2d682f6940c1023d95ae8950b8d1dc0604abd34a4a2cc654f1be6f330ca44"
270
+ }
271
+ ]
221
272
  }
222
273
  ]
223
274
  };