-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a78acd
commit 1bbf246
Showing
13 changed files
with
536 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,29 @@ | ||
import * as eth from './src/eth' | ||
import { NFTOptions } from './src/models'; | ||
import { type NFTOptions, } from './src/models' | ||
import { setIpfsHostnames, setArweaveHostnames } from './src/services' | ||
|
||
async function getERC721(NFTOptions: NFTOptions) { | ||
let NFTs = await eth.getERC721(NFTOptions) | ||
const result = NFTs.map((nft) => nft.toDict()); | ||
return result | ||
const NFTs = await eth.getERC721(NFTOptions,); | ||
const result = NFTs.map((nft) => nft.toDict()); | ||
return result; | ||
} | ||
module.exports.setArweaveHostnames = async (hostnames: string[]) => setArweaveHostnames(hostnames); | ||
module.exports.setIpfsHostnames = async (hostnames: string[]) => setIpfsHostnames(hostnames); | ||
module.exports.setEthProvider = async (provider: string) => eth.setProvider(provider); | ||
module.exports.getERC721 = async (options: NFTOptions) => await getERC721(options); | ||
|
||
async function getERC1155(NFTOptions: NFTOptions) { | ||
const NFTs = await eth.getERC1155(NFTOptions,); | ||
const result = NFTs.map((nft) => nft.toDict()); | ||
return result; | ||
} | ||
|
||
async function getEthNFTs(NFTOptions: NFTOptions) { | ||
const NFTs = await eth.getNFTs(NFTOptions,); | ||
const result = NFTs.map((nft) => nft.toDict()); | ||
return result; | ||
} | ||
|
||
|
||
module.exports.setArweaveHostnames = async (hostnames: string[]) => { setArweaveHostnames(hostnames,); } | ||
module.exports.setIpfsHostnames = async (hostnames: string[]) => { setIpfsHostnames(hostnames,); } | ||
module.exports.setEthProvider = async (provider: string) => { eth.setProvider(provider,); } | ||
module.exports.getERC721 = async (options: NFTOptions) => await getERC721(options); | ||
module.exports.getERC1155 = async (options: NFTOptions) => await getERC1155(options); | ||
module.exports.getEthNFTs = async (options: NFTOptions) => await getEthNFTs(options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,62 @@ | ||
import { AbiItem } from 'web3-utils' | ||
|
||
|
||
const ERC721Transfer = [{ | ||
type: 'address', | ||
name: 'from', | ||
indexed: true, | ||
}, { | ||
type: 'address', | ||
name: 'to', | ||
indexed: true, | ||
}, { | ||
type: 'uint256', | ||
name: 'tokenId', | ||
indexed: true, | ||
}, | ||
]; | ||
|
||
const ERC721TokenURI: AbiItem= | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'uint256', | ||
name: 'tokenId', | ||
type: 'uint256' | ||
} | ||
], | ||
import { type AbiItem } from 'web3-utils' | ||
const ERC721Transfer = [ | ||
{ type: 'address', name: 'from', indexed: true }, | ||
{ type: 'address', name: 'to', indexed: true }, | ||
{ type: 'uint256', name: 'tokenId', indexed: true } | ||
] | ||
const ERC721: AbiItem[] = [ | ||
{ | ||
constant: true, | ||
inputs: [{ name: '_tokenId', type: 'uint256' }], | ||
name: 'tokenURI', | ||
outputs: [ | ||
{ | ||
internalType: 'string', | ||
name: '', | ||
type: 'string' | ||
} | ||
], | ||
outputs: [{ name: '', type: 'string' }], | ||
payable: false, | ||
stateMutability: 'view', | ||
type: 'function' | ||
}; | ||
} | ||
] | ||
const ERC1155TransferSingle = [ | ||
{ type: 'address', name: 'operator', indexed: true }, | ||
{ type: 'address', name: 'from', indexed: true }, | ||
{ type: 'address', name: 'to', indexed: true }, | ||
{ type: 'uint256', name: 'id' }, | ||
{ type: 'uint256', name: 'value' } | ||
] | ||
|
||
const ERC721: AbiItem[]= [ | ||
{ | ||
"constant": true, | ||
"inputs": [ | ||
{ | ||
"name": "_tokenId", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "tokenURI", | ||
"outputs": [ | ||
{ | ||
"name": "", | ||
"type": "string" | ||
} | ||
], | ||
"payable": false, | ||
"stateMutability": "view", | ||
"type": "function", | ||
}] | ||
; | ||
const ERC1155TransferMulti = [ | ||
{ type: 'address', name: 'operator', indexed: true }, | ||
{ type: 'address', name: 'from', indexed: true }, | ||
{ type: 'address', name: 'to', indexed: true }, | ||
{ type: 'uint256[]', name: 'ids' }, | ||
{ type: 'uint256[]', name: 'values' } | ||
] | ||
|
||
export { ERC721TokenURI, ERC721Transfer, ERC721 }; | ||
const ERC1155: AbiItem[] = [ | ||
{ | ||
inputs: [{ internalType: 'uint256', name: 'id', type: 'uint256' }], | ||
name: 'uri', | ||
outputs: [{ internalType: 'string', name: '', type: 'string' }], | ||
stateMutability: 'view', | ||
type: 'function' | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: false, | ||
internalType: "string", | ||
name: "value", | ||
type: "string" | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: "uint256", | ||
name: "id", | ||
type: "uint256" | ||
} | ||
], | ||
name: "URI", | ||
type: "event" | ||
} | ||
] | ||
export { ERC721Transfer, ERC721, ERC1155TransferSingle, ERC1155TransferMulti, ERC1155, } |
Oops, something went wrong.