UNPKG

@ingocollatz/sdk-tests

Version:
52 lines (37 loc) 1.67 kB
import { CirclesSdk } from "@ingocollatz/sdk"; import { PUBLIC_KEY_1, RPC_URL, SAFE_ADDRESS_USER } from "../config"; import Web3 from "web3"; import Safe, { Web3Adapter } from "@safe-global/protocol-kit"; import { Web3AbiEncoder } from "@ingocollatz/sdk-web3-adapter"; import { EthersAbiEncoder } from "@ingocollatz/sdk-ethers-adapter"; import { ethers } from "ethers"; import { EthersAdapter } from "@safe-global/protocol-kit"; import { SortOrder, type TxHistory } from "@ingocollatz/sdk-interfaces"; (async (): Promise<void> => { // Ethers // const provider = new ethers.providers.JsonRpcProvider(RPC_URL); // const safe = await Safe.create({ // ethAdapter: new EthersAdapter({ // ethers, // signerOrProvider: provider, // }), // safeAddress: SAFE_ADDRESS_USER, // }); // const abiEncoder = new EthersAbiEncoder(); // const circlesSdk = new CirclesSdk(safe, abiEncoder); // const history = await circlesSdk.getCrcTransfers({ limit: 1, sortOrder: SortOrder.Descending }) // console.log(`Last ubi payout for ${SAFE_ADDRESS_USER}: `, history); // Web3 const web3 = new Web3(new Web3.providers.HttpProvider(RPC_URL)); const safe = await Safe.create({ ethAdapter: new Web3Adapter({ web3: new Web3(new Web3.providers.HttpProvider(RPC_URL)), signerAddress: PUBLIC_KEY_1, }), safeAddress: SAFE_ADDRESS_USER, }); const abiEncoder = new Web3AbiEncoder(web3); const circlesSdk = new CirclesSdk(safe, abiEncoder); const history = await circlesSdk.getCrcTransfers({ sortOrder: SortOrder.Descending, limit: 2 }) console.log(`Crc Transfers for ${SAFE_ADDRESS_USER}: `, history); })();