@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/main.js CHANGED
@@ -81,7 +81,7 @@ const $25d5bdd23cba31eb$export$ace043a4f2efe476 = {
81
81
  const changes = tx.changes;
82
82
  for(let ci = 0; ci < changes.length; ci += 1){
83
83
  if (!changes[ci]?.data) continue;
84
- const { address: accountAddress, data: { data: { balance: balance, metadata: metadata }, type: changeType } } = changes[ci];
84
+ const { address: accountAddress, data: { data: { balance: balance, metadata: metadata, owner: owner }, type: changeType } } = changes[ci];
85
85
  if (changeType === "0x1::fungible_asset::FungibleStore") {
86
86
  if (!accountAddressMap[accountAddress]) accountAddressMap[accountAddress] = changes[ci + 1]?.data.data.owner;
87
87
  const to = accountAddressMap[accountAddress];
@@ -98,6 +98,19 @@ const $25d5bdd23cba31eb$export$ace043a4f2efe476 = {
98
98
  transactionGasFee: gasUsed,
99
99
  transactionHash: tx.hash
100
100
  });
101
+ } else if (owner?.length > 4) {
102
+ const payload = tx.payload;
103
+ if (payload && payload.function === "0x1::aptos_account::transfer_coins") transfers.push({
104
+ amount: BigInt(payload.arguments[1]),
105
+ blockNumber: parseInt(block.block_height, 10),
106
+ from: sender,
107
+ to: owner,
108
+ timestamp: timestamp,
109
+ token: null,
110
+ tokenType: "NATIVE",
111
+ transactionGasFee: gasUsed,
112
+ transactionHash: tx.hash
113
+ });
101
114
  }
102
115
  }
103
116
  for (const evt of tx.events){
@@ -119,9 +132,7 @@ const $25d5bdd23cba31eb$export$ace043a4f2efe476 = {
119
132
  }
120
133
  for (const partial of Object.values(transfersByKey)){
121
134
  if (!partial.from || !partial.to) continue;
122
- const fromAddr = partial.from.length < 66 ? `0x0${partial.from.slice(2)}` : partial.from;
123
- const toAddr = partial.to.length < 66 ? `0x0${partial.to.slice(2)}` : partial.to;
124
- if (toAddr === "0x00") continue;
135
+ if (partial.to === "0x00") continue;
125
136
  let finalToken = null;
126
137
  let finalTokenType = "TOKEN";
127
138
  if (partial.tokenAddress?.toLowerCase().includes("aptos_coin")) finalToken = null;
@@ -129,8 +140,8 @@ const $25d5bdd23cba31eb$export$ace043a4f2efe476 = {
129
140
  transfers.push({
130
141
  amount: BigInt(partial.amount),
131
142
  blockNumber: parseInt(block.block_height, 10),
132
- from: fromAddr,
133
- to: toAddr,
143
+ from: partial.from,
144
+ to: partial.to,
134
145
  timestamp: timestamp,
135
146
  token: finalToken,
136
147
  tokenType: finalTokenType,
@@ -139,7 +150,15 @@ const $25d5bdd23cba31eb$export$ace043a4f2efe476 = {
139
150
  });
140
151
  }
141
152
  }
142
- return transfers;
153
+ return transfers.filter((txfer)=>txfer.to?.length > 4).map((txfer)=>{
154
+ const fromAddr = txfer.from.length < 66 ? `0x${txfer.from.slice(2).padStart(64, "0")}` : txfer.from;
155
+ const toAddr = txfer.to.length < 66 ? `0x${txfer.to.slice(2).padStart(64, "0")}` : txfer.to;
156
+ return {
157
+ ...txfer,
158
+ from: fromAddr,
159
+ to: toAddr
160
+ };
161
+ });
143
162
  },
144
163
  tests: [
145
164
  {
@@ -224,6 +243,38 @@ const $25d5bdd23cba31eb$export$ace043a4f2efe476 = {
224
243
  transactionHash: "0xc5a21679a947f986908b09091516bc3896245d974686ca2bd5709b7dbc5118fb"
225
244
  }
226
245
  ]
246
+ },
247
+ {
248
+ params: {
249
+ network: "APTOS",
250
+ contractAddress: "",
251
+ walletAddress: "0x089556578008574ed3fddda6bc2ea6bee475b042e237bbb2f447c263086edcc5"
252
+ },
253
+ payload: "https://jiti.indexing.co/networks/aptos/403873552",
254
+ output: [
255
+ {
256
+ amount: 19500000n,
257
+ blockNumber: 403873552,
258
+ from: "0x8509aa39bc09ea530b0481c573c0215781c01fa363c135996614bb11cf337703",
259
+ timestamp: "2025-08-11T11:07:54.286Z",
260
+ to: "0x089556578008574ed3fddda6bc2ea6bee475b042e237bbb2f447c263086edcc5",
261
+ token: "0xa",
262
+ tokenType: "TOKEN",
263
+ transactionGasFee: 18n,
264
+ transactionHash: "0xa7d2d682f6940c1023d95ae8950b8d1dc0604abd34a4a2cc654f1be6f330ca44"
265
+ },
266
+ {
267
+ amount: 9500000n,
268
+ blockNumber: 403873552,
269
+ from: "0x8509aa39bc09ea530b0481c573c0215781c01fa363c135996614bb11cf337703",
270
+ timestamp: "2025-08-11T11:07:54.286Z",
271
+ to: "0x089556578008574ed3fddda6bc2ea6bee475b042e237bbb2f447c263086edcc5",
272
+ token: null,
273
+ tokenType: "NATIVE",
274
+ transactionGasFee: 18n,
275
+ transactionHash: "0xa7d2d682f6940c1023d95ae8950b8d1dc0604abd34a4a2cc654f1be6f330ca44"
276
+ }
277
+ ]
227
278
  }
228
279
  ]
229
280
  };