UNPKG

polymarket-api

Version:

Node.js SDK for querying Polymarket prediction market data. Get new prediction markets, resolved predictions, position tokens, and trading data from Polymarket using Bitquery APIs.

157 lines (155 loc) 1.87 kB
const payoutRecievedQuery = (address, count) => ` { EVM(dataset: realtime, network: matic) { Events( orderBy: {descending: Block_Time} where: {Log: {Signature: {Name: {in: ["PayoutRedemption"]}}}, Arguments:{ includes:{ Name:{is:"redeemer"} Value:{Address:{is:"${address}"}} } } LogHeader: {Address: {is: "0x4d97dcd97ec945f40cf65f87097ace5ea0476045"}}} limit: {count: ${count}} ) { Block { Time Number Hash } Receipt { ContractAddress } Topics { Hash } TransactionStatus { Success } LogHeader { Address Index Data } Transaction { Hash From To } Log { EnterIndex ExitIndex Index LogAfterCallIndex Pc SmartContract Signature { Name Signature } } Arguments { Name Value { ... on EVM_ABI_Integer_Value_Arg { integer } ... on EVM_ABI_Address_Value_Arg { address } ... on EVM_ABI_String_Value_Arg { string } ... on EVM_ABI_BigInt_Value_Arg { bigInteger } ... on EVM_ABI_Bytes_Value_Arg { hex } ... on EVM_ABI_Boolean_Value_Arg { bool } } } } } }`; const payoutRecievedStream = (address) => ` subscription{ EVM(network: matic) { Events( where: {Log: {Signature: {Name: {in: ["PayoutRedemption"]}}}, Arguments:{ includes:{ Name:{is:"redeemer"} Value:{Address:{is:"${address}"}} } } LogHeader: {Address: {is: "0x4d97dcd97ec945f40cf65f87097ace5ea0476045"}}} ) { Block { Time Number Hash } Receipt { ContractAddress } Topics { Hash } TransactionStatus { Success } LogHeader { Address Index Data } Transaction { Hash From To } Log { EnterIndex ExitIndex Index LogAfterCallIndex Pc SmartContract Signature { Name Signature } } Arguments { Name Value { ... on EVM_ABI_Integer_Value_Arg { integer } ... on EVM_ABI_Address_Value_Arg { address } ... on EVM_ABI_String_Value_Arg { string } ... on EVM_ABI_BigInt_Value_Arg { bigInteger } ... on EVM_ABI_Bytes_Value_Arg { hex } ... on EVM_ABI_Boolean_Value_Arg { bool } } } } } }`; export { payoutRecievedQuery, payoutRecievedStream };