@bronlabs/intents-sdk 1.0.55 → 1.0.56

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.
@@ -1,5 +1,5 @@
1
1
  import { ethers } from 'ethers';
2
- import { log, memoise } from '../utils.js';
2
+ import { log, memoize } from '../utils.js';
3
3
  export class EvmNetwork {
4
4
  constructor(rpcUrl, confirmations = 6) {
5
5
  this.nativeAssetDecimals = 18;
@@ -12,7 +12,7 @@ export class EvmNetwork {
12
12
  if (tokenAddress === "0x0") {
13
13
  return this.nativeAssetDecimals;
14
14
  }
15
- return memoise(`decimals-${this.rpcUrl}-${tokenAddress}`, 86400 * 1000, async () => {
15
+ return memoize(`decimals-${this.rpcUrl}-${tokenAddress}`, 86400 * 1000, async () => {
16
16
  const { result } = await fetch(this.rpcUrl, {
17
17
  method: 'POST',
18
18
  body: JSON.stringify({
@@ -1,7 +1,7 @@
1
1
  import { Connection, Transaction, SystemProgram, Keypair, PublicKey } from "@solana/web3.js";
2
2
  import { createTransferInstruction, getOrCreateAssociatedTokenAccount } from "@solana/spl-token";
3
3
  import bs58 from "bs58";
4
- import { log, memoise } from "../utils.js";
4
+ import { log, memoize } from "../utils.js";
5
5
  export class SolNetwork {
6
6
  constructor(rpcUrl, confirmations = 20) {
7
7
  this.nativeAssetDecimals = 9; // SOL has 9 decimals
@@ -14,7 +14,7 @@ export class SolNetwork {
14
14
  if (tokenAddress === "0x0") {
15
15
  return this.nativeAssetDecimals;
16
16
  }
17
- return memoise(`decimals-sol-${tokenAddress}`, 86400 * 1000, async () => {
17
+ return memoize(`decimals-sol-${tokenAddress}`, 86400 * 1000, async () => {
18
18
  const { result } = await fetch(this.rpcUrl, {
19
19
  method: 'POST',
20
20
  body: JSON.stringify({
@@ -1,6 +1,6 @@
1
1
  import { fromHex } from "tron-format-address";
2
2
  import { TronWeb } from "tronweb";
3
- import { log, memoise } from "../utils.js";
3
+ import { log, memoize } from "../utils.js";
4
4
  export class TrxNetwork {
5
5
  constructor(rpcUrl, confirmations = 20) {
6
6
  this.authHeaders = {};
@@ -24,7 +24,7 @@ export class TrxNetwork {
24
24
  if (tokenAddress === "0x0") {
25
25
  return this.nativeAssetDecimals;
26
26
  }
27
- return memoise(`decimals-trx-${tokenAddress}`, 86400 * 1000, async () => {
27
+ return memoize(`decimals-trx-${tokenAddress}`, 86400 * 1000, async () => {
28
28
  const response = await this.request(`/wallet/triggerconstantcontract`, {
29
29
  method: "POST",
30
30
  headers: {
package/dist/utils.d.ts CHANGED
@@ -2,4 +2,4 @@ import * as winston from 'winston';
2
2
  export declare const log: winston.Logger;
3
3
  export declare const sleep: (ms: number) => Promise<void>;
4
4
  export declare function expRetry<T>(fn: () => Promise<T>, maxRetries?: number, retryIf?: (e: Error) => boolean): Promise<T>;
5
- export declare function memoise<T>(key: string, durationMs: number, cb: () => Promise<T> | T): Promise<T>;
5
+ export declare function memoize<T>(key: string, durationMs: number, cb: () => Promise<T> | T): Promise<T>;
package/dist/utils.js CHANGED
@@ -36,7 +36,7 @@ const __gc = setInterval(() => {
36
36
  }
37
37
  }, 60_000);
38
38
  __gc.unref?.();
39
- export function memoise(key, durationMs, cb) {
39
+ export function memoize(key, durationMs, cb) {
40
40
  const now = Date.now();
41
41
  const existing = __memoCache.get(key);
42
42
  if (existing && existing.expiresAt > now && !existing.promise) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bronlabs/intents-sdk",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "description": "SDK for Intents DeFi smart contracts",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",