diff --git a/public/graphql/schema.graphql b/public/graphql/schema.graphql index 7236ea5..3c7d2f6 100644 --- a/public/graphql/schema.graphql +++ b/public/graphql/schema.graphql @@ -1065,11 +1065,11 @@ type Query implements Node { """ nodeId: ID! ): _PrismaMigration - getAccountTokens(address: String!, name: String): JSON! - getTokensTotalByAddress(address: String!, name: String): JSON! - getTokensTotalForEntities(address: String!, name: String): JSON! - getTokensTotalForCollection(did: String!, name: String): JSON! - getTokensTotalForCollectionAmounts(did: String!, name: String): JSON! + getAccountTokens(address: String!, name: String, allEntityRetired: Boolean): JSON! + getTokensTotalByAddress(address: String!, name: String, allEntityRetired: Boolean): JSON! + getTokensTotalForEntities(address: String!, name: String, allEntityRetired: Boolean): JSON! + getTokensTotalForCollection(did: String!, name: String, allEntityRetired: Boolean): JSON! + getTokensTotalForCollectionAmounts(did: String!, name: String, allEntityRetired: Boolean): JSON! } """An object with a globally unique `ID`.""" @@ -1131,8 +1131,8 @@ type Bond implements Node { outcomePayment: String! oracleDid: String! - """Reads and enables pagination through a set of `BondBuy`.""" - bondBuysByBondDid( + """Reads and enables pagination through a set of `BondAlpha`.""" + bondAlphasByBondDid( """Only read the first `n` values of the set.""" first: Int @@ -1151,22 +1151,22 @@ type Bond implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `BondBuy`.""" - orderBy: [BondBuysOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `BondAlpha`.""" + orderBy: [BondAlphasOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: BondBuyCondition + condition: BondAlphaCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: BondBuyFilter - ): BondBuysConnection! + filter: BondAlphaFilter + ): BondAlphasConnection! - """Reads and enables pagination through a set of `BondSell`.""" - bondSellsByBondDid( + """Reads and enables pagination through a set of `BondBuy`.""" + bondBuysByBondDid( """Only read the first `n` values of the set.""" first: Int @@ -1185,22 +1185,22 @@ type Bond implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `BondSell`.""" - orderBy: [BondSellsOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `BondBuy`.""" + orderBy: [BondBuysOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: BondSellCondition + condition: BondBuyCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: BondSellFilter - ): BondSellsConnection! + filter: BondBuyFilter + ): BondBuysConnection! - """Reads and enables pagination through a set of `BondSwap`.""" - bondSwapsByBondDid( + """Reads and enables pagination through a set of `BondSell`.""" + bondSellsByBondDid( """Only read the first `n` values of the set.""" first: Int @@ -1219,22 +1219,22 @@ type Bond implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `BondSwap`.""" - orderBy: [BondSwapsOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `BondSell`.""" + orderBy: [BondSellsOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: BondSwapCondition + condition: BondSellCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: BondSwapFilter - ): BondSwapsConnection! + filter: BondSellFilter + ): BondSellsConnection! - """Reads and enables pagination through a set of `ReserveWithdrawal`.""" - reserveWithdrawalsByBondDid( + """Reads and enables pagination through a set of `BondSwap`.""" + bondSwapsByBondDid( """Only read the first `n` values of the set.""" first: Int @@ -1253,22 +1253,22 @@ type Bond implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `ReserveWithdrawal`.""" - orderBy: [ReserveWithdrawalsOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `BondSwap`.""" + orderBy: [BondSwapsOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: ReserveWithdrawalCondition + condition: BondSwapCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: ReserveWithdrawalFilter - ): ReserveWithdrawalsConnection! + filter: BondSwapFilter + ): BondSwapsConnection! - """Reads and enables pagination through a set of `ShareWithdrawal`.""" - shareWithdrawalsByBondDid( + """Reads and enables pagination through a set of `OutcomePayment`.""" + outcomePaymentsByBondDid( """Only read the first `n` values of the set.""" first: Int @@ -1287,22 +1287,22 @@ type Bond implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `ShareWithdrawal`.""" - orderBy: [ShareWithdrawalsOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `OutcomePayment`.""" + orderBy: [OutcomePaymentsOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: ShareWithdrawalCondition + condition: OutcomePaymentCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: ShareWithdrawalFilter - ): ShareWithdrawalsConnection! + filter: OutcomePaymentFilter + ): OutcomePaymentsConnection! - """Reads and enables pagination through a set of `OutcomePayment`.""" - outcomePaymentsByBondDid( + """Reads and enables pagination through a set of `ReserveWithdrawal`.""" + reserveWithdrawalsByBondDid( """Only read the first `n` values of the set.""" first: Int @@ -1321,22 +1321,22 @@ type Bond implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `OutcomePayment`.""" - orderBy: [OutcomePaymentsOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `ReserveWithdrawal`.""" + orderBy: [ReserveWithdrawalsOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: OutcomePaymentCondition + condition: ReserveWithdrawalCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: OutcomePaymentFilter - ): OutcomePaymentsConnection! + filter: ReserveWithdrawalFilter + ): ReserveWithdrawalsConnection! - """Reads and enables pagination through a set of `BondAlpha`.""" - bondAlphasByBondDid( + """Reads and enables pagination through a set of `ShareWithdrawal`.""" + shareWithdrawalsByBondDid( """Only read the first `n` values of the set.""" first: Int @@ -1355,19 +1355,19 @@ type Bond implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `BondAlpha`.""" - orderBy: [BondAlphasOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `ShareWithdrawal`.""" + orderBy: [ShareWithdrawalsOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: BondAlphaCondition + condition: ShareWithdrawalCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: BondAlphaFilter - ): BondAlphasConnection! + filter: ShareWithdrawalFilter + ): ShareWithdrawalsConnection! } """ @@ -1375,37 +1375,36 @@ The `JSON` scalar type represents JSON values as specified by [ECMA-404](http:// """ scalar JSON -"""A connection to a list of `BondBuy` values.""" -type BondBuysConnection { - """A list of `BondBuy` objects.""" - nodes: [BondBuy!]! +"""A connection to a list of `BondAlpha` values.""" +type BondAlphasConnection { + """A list of `BondAlpha` objects.""" + nodes: [BondAlpha!]! """ - A list of edges which contains the `BondBuy` and cursor to aid in pagination. + A list of edges which contains the `BondAlpha` and cursor to aid in pagination. """ - edges: [BondBuysEdge!]! + edges: [BondAlphasEdge!]! """Information to aid in pagination.""" pageInfo: PageInfo! - """The count of *all* `BondBuy` you could get from the connection.""" + """The count of *all* `BondAlpha` you could get from the connection.""" totalCount: Int! } -type BondBuy implements Node { +type BondAlpha implements Node { """ A globally unique identifier. Can be used in various places throughout the system to identify this single value. """ nodeId: ID! id: Int! bondDid: String! - accountDid: String! - amount: JSON! - maxPrices: JSON! + alpha: String! + oracleDid: String! height: Int! timestamp: Datetime! - """Reads a single `Bond` that is related to this `BondBuy`.""" + """Reads a single `Bond` that is related to this `BondAlpha`.""" bondByBondDid: Bond } @@ -1415,13 +1414,13 @@ A point in time as described by the [ISO """ scalar Datetime -"""A `BondBuy` edge in the connection.""" -type BondBuysEdge { +"""A `BondAlpha` edge in the connection.""" +type BondAlphasEdge { """A cursor for use in pagination.""" cursor: Cursor - """The `BondBuy` at the end of the edge.""" - node: BondBuy! + """The `BondAlpha` at the end of the edge.""" + node: BondAlpha! } """A location in a connection that can be used for resuming pagination.""" @@ -1442,19 +1441,17 @@ type PageInfo { endCursor: Cursor } -"""Methods to use when ordering `BondBuy`.""" -enum BondBuysOrderBy { +"""Methods to use when ordering `BondAlpha`.""" +enum BondAlphasOrderBy { NATURAL ID_ASC ID_DESC BOND_DID_ASC BOND_DID_DESC - ACCOUNT_DID_ASC - ACCOUNT_DID_DESC - AMOUNT_ASC - AMOUNT_DESC - MAX_PRICES_ASC - MAX_PRICES_DESC + ALPHA_ASC + ALPHA_DESC + ORACLE_DID_ASC + ORACLE_DID_DESC HEIGHT_ASC HEIGHT_DESC TIMESTAMP_ASC @@ -1464,23 +1461,21 @@ enum BondBuysOrderBy { } """ -A condition to be used against `BondBuy` object types. All fields are tested for equality and combined with a logical ‘and.’ +A condition to be used against `BondAlpha` object types. All fields are tested +for equality and combined with a logical ‘and.’ """ -input BondBuyCondition { +input BondAlphaCondition { """Checks for equality with the object’s `id` field.""" id: Int """Checks for equality with the object’s `bondDid` field.""" bondDid: String - """Checks for equality with the object’s `accountDid` field.""" - accountDid: String - - """Checks for equality with the object’s `amount` field.""" - amount: JSON + """Checks for equality with the object’s `alpha` field.""" + alpha: String - """Checks for equality with the object’s `maxPrices` field.""" - maxPrices: JSON + """Checks for equality with the object’s `oracleDid` field.""" + oracleDid: String """Checks for equality with the object’s `height` field.""" height: Int @@ -1490,23 +1485,20 @@ input BondBuyCondition { } """ -A filter to be used against `BondBuy` object types. All fields are combined with a logical ‘and.’ +A filter to be used against `BondAlpha` object types. All fields are combined with a logical ‘and.’ """ -input BondBuyFilter { +input BondAlphaFilter { """Filter by the object’s `id` field.""" id: IntFilter """Filter by the object’s `bondDid` field.""" bondDid: StringFilter - """Filter by the object’s `accountDid` field.""" - accountDid: StringFilter - - """Filter by the object’s `amount` field.""" - amount: JSONFilter + """Filter by the object’s `alpha` field.""" + alpha: StringFilter - """Filter by the object’s `maxPrices` field.""" - maxPrices: JSONFilter + """Filter by the object’s `oracleDid` field.""" + oracleDid: StringFilter """Filter by the object’s `height` field.""" height: IntFilter @@ -1518,13 +1510,13 @@ input BondBuyFilter { bondByBondDid: BondFilter """Checks for all expressions in this list.""" - and: [BondBuyFilter!] + and: [BondAlphaFilter!] """Checks for any expressions in this list.""" - or: [BondBuyFilter!] + or: [BondAlphaFilter!] """Negates the expression.""" - not: BondBuyFilter + not: BondAlphaFilter } """ @@ -1701,63 +1693,6 @@ input StringFilter { greaterThanOrEqualToInsensitive: String } -""" -A filter to be used against JSON fields. All fields are combined with a logical ‘and.’ -""" -input JSONFilter { - """ - Is null (if `true` is specified) or is not null (if `false` is specified). - """ - isNull: Boolean - - """Equal to the specified value.""" - equalTo: JSON - - """Not equal to the specified value.""" - notEqualTo: JSON - - """ - Not equal to the specified value, treating null like an ordinary value. - """ - distinctFrom: JSON - - """Equal to the specified value, treating null like an ordinary value.""" - notDistinctFrom: JSON - - """Included in the specified list.""" - in: [JSON!] - - """Not included in the specified list.""" - notIn: [JSON!] - - """Less than the specified value.""" - lessThan: JSON - - """Less than or equal to the specified value.""" - lessThanOrEqualTo: JSON - - """Greater than the specified value.""" - greaterThan: JSON - - """Greater than or equal to the specified value.""" - greaterThanOrEqualTo: JSON - - """Contains the specified JSON.""" - contains: JSON - - """Contains the specified key.""" - containsKey: String - - """Contains all of the specified keys.""" - containsAllKeys: [String!] - - """Contains any of the specified keys.""" - containsAnyKeys: [String!] - - """Contained by the specified JSON.""" - containedBy: JSON -} - """ A filter to be used against Datetime fields. All fields are combined with a logical ‘and.’ """ @@ -1888,6 +1823,12 @@ input BondFilter { """Filter by the object’s `oracleDid` field.""" oracleDid: StringFilter + """Filter by the object’s `bondAlphasByBondDid` relation.""" + bondAlphasByBondDid: BondToManyBondAlphaFilter + + """Some related `bondAlphasByBondDid` exist.""" + bondAlphasByBondDidExist: Boolean + """Filter by the object’s `bondBuysByBondDid` relation.""" bondBuysByBondDid: BondToManyBondBuyFilter @@ -1906,6 +1847,12 @@ input BondFilter { """Some related `bondSwapsByBondDid` exist.""" bondSwapsByBondDidExist: Boolean + """Filter by the object’s `outcomePaymentsByBondDid` relation.""" + outcomePaymentsByBondDid: BondToManyOutcomePaymentFilter + + """Some related `outcomePaymentsByBondDid` exist.""" + outcomePaymentsByBondDidExist: Boolean + """Filter by the object’s `reserveWithdrawalsByBondDid` relation.""" reserveWithdrawalsByBondDid: BondToManyReserveWithdrawalFilter @@ -1918,20 +1865,8 @@ input BondFilter { """Some related `shareWithdrawalsByBondDid` exist.""" shareWithdrawalsByBondDidExist: Boolean - """Filter by the object’s `outcomePaymentsByBondDid` relation.""" - outcomePaymentsByBondDid: BondToManyOutcomePaymentFilter - - """Some related `outcomePaymentsByBondDid` exist.""" - outcomePaymentsByBondDidExist: Boolean - - """Filter by the object’s `bondAlphasByBondDid` relation.""" - bondAlphasByBondDid: BondToManyBondAlphaFilter - - """Some related `bondAlphasByBondDid` exist.""" - bondAlphasByBondDidExist: Boolean - - """Checks for all expressions in this list.""" - and: [BondFilter!] + """Checks for all expressions in this list.""" + and: [BondFilter!] """Checks for any expressions in this list.""" or: [BondFilter!] @@ -1940,6 +1875,63 @@ input BondFilter { not: BondFilter } +""" +A filter to be used against JSON fields. All fields are combined with a logical ‘and.’ +""" +input JSONFilter { + """ + Is null (if `true` is specified) or is not null (if `false` is specified). + """ + isNull: Boolean + + """Equal to the specified value.""" + equalTo: JSON + + """Not equal to the specified value.""" + notEqualTo: JSON + + """ + Not equal to the specified value, treating null like an ordinary value. + """ + distinctFrom: JSON + + """Equal to the specified value, treating null like an ordinary value.""" + notDistinctFrom: JSON + + """Included in the specified list.""" + in: [JSON!] + + """Not included in the specified list.""" + notIn: [JSON!] + + """Less than the specified value.""" + lessThan: JSON + + """Less than or equal to the specified value.""" + lessThanOrEqualTo: JSON + + """Greater than the specified value.""" + greaterThan: JSON + + """Greater than or equal to the specified value.""" + greaterThanOrEqualTo: JSON + + """Contains the specified JSON.""" + contains: JSON + + """Contains the specified key.""" + containsKey: String + + """Contains all of the specified keys.""" + containsAllKeys: [String!] + + """Contains any of the specified keys.""" + containsAnyKeys: [String!] + + """Contained by the specified JSON.""" + containedBy: JSON +} + """ A filter to be used against String List fields. All fields are combined with a logical ‘and.’ """ @@ -2045,6 +2037,26 @@ input BooleanFilter { greaterThanOrEqualTo: Boolean } +""" +A filter to be used against many `BondAlpha` object types. All fields are combined with a logical ‘and.’ +""" +input BondToManyBondAlphaFilter { + """ + Every related `BondAlpha` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + every: BondAlphaFilter + + """ + Some related `BondAlpha` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + some: BondAlphaFilter + + """ + No related `BondAlpha` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + none: BondAlphaFilter +} + """ A filter to be used against many `BondBuy` object types. All fields are combined with a logical ‘and.’ """ @@ -2065,6 +2077,44 @@ input BondToManyBondBuyFilter { none: BondBuyFilter } +""" +A filter to be used against `BondBuy` object types. All fields are combined with a logical ‘and.’ +""" +input BondBuyFilter { + """Filter by the object’s `id` field.""" + id: IntFilter + + """Filter by the object’s `bondDid` field.""" + bondDid: StringFilter + + """Filter by the object’s `accountDid` field.""" + accountDid: StringFilter + + """Filter by the object’s `amount` field.""" + amount: JSONFilter + + """Filter by the object’s `maxPrices` field.""" + maxPrices: JSONFilter + + """Filter by the object’s `height` field.""" + height: IntFilter + + """Filter by the object’s `timestamp` field.""" + timestamp: DatetimeFilter + + """Filter by the object’s `bondByBondDid` relation.""" + bondByBondDid: BondFilter + + """Checks for all expressions in this list.""" + and: [BondBuyFilter!] + + """Checks for any expressions in this list.""" + or: [BondBuyFilter!] + + """Negates the expression.""" + not: BondBuyFilter +} + """ A filter to be used against many `BondSell` object types. All fields are combined with a logical ‘and.’ """ @@ -2178,6 +2228,64 @@ input BondSwapFilter { not: BondSwapFilter } +""" +A filter to be used against many `OutcomePayment` object types. All fields are combined with a logical ‘and.’ +""" +input BondToManyOutcomePaymentFilter { + """ + Every related `OutcomePayment` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + every: OutcomePaymentFilter + + """ + Some related `OutcomePayment` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + some: OutcomePaymentFilter + + """ + No related `OutcomePayment` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + none: OutcomePaymentFilter +} + +""" +A filter to be used against `OutcomePayment` object types. All fields are combined with a logical ‘and.’ +""" +input OutcomePaymentFilter { + """Filter by the object’s `id` field.""" + id: IntFilter + + """Filter by the object’s `bondDid` field.""" + bondDid: StringFilter + + """Filter by the object’s `senderDid` field.""" + senderDid: StringFilter + + """Filter by the object’s `senderAddress` field.""" + senderAddress: StringFilter + + """Filter by the object’s `amount` field.""" + amount: JSONFilter + + """Filter by the object’s `height` field.""" + height: IntFilter + + """Filter by the object’s `timestamp` field.""" + timestamp: DatetimeFilter + + """Filter by the object’s `bondByBondDid` relation.""" + bondByBondDid: BondFilter + + """Checks for all expressions in this list.""" + and: [OutcomePaymentFilter!] + + """Checks for any expressions in this list.""" + or: [OutcomePaymentFilter!] + + """Negates the expression.""" + not: OutcomePaymentFilter +} + """ A filter to be used against many `ReserveWithdrawal` object types. All fields are combined with a logical ‘and.’ """ @@ -2297,117 +2405,94 @@ input ShareWithdrawalFilter { not: ShareWithdrawalFilter } -""" -A filter to be used against many `OutcomePayment` object types. All fields are combined with a logical ‘and.’ -""" -input BondToManyOutcomePaymentFilter { - """ - Every related `OutcomePayment` matches the filter criteria. All fields are combined with a logical ‘and.’ - """ - every: OutcomePaymentFilter - - """ - Some related `OutcomePayment` matches the filter criteria. All fields are combined with a logical ‘and.’ - """ - some: OutcomePaymentFilter +"""A connection to a list of `BondBuy` values.""" +type BondBuysConnection { + """A list of `BondBuy` objects.""" + nodes: [BondBuy!]! """ - No related `OutcomePayment` matches the filter criteria. All fields are combined with a logical ‘and.’ + A list of edges which contains the `BondBuy` and cursor to aid in pagination. """ - none: OutcomePaymentFilter -} - -""" -A filter to be used against `OutcomePayment` object types. All fields are combined with a logical ‘and.’ -""" -input OutcomePaymentFilter { - """Filter by the object’s `id` field.""" - id: IntFilter - - """Filter by the object’s `bondDid` field.""" - bondDid: StringFilter - - """Filter by the object’s `senderDid` field.""" - senderDid: StringFilter + edges: [BondBuysEdge!]! - """Filter by the object’s `senderAddress` field.""" - senderAddress: StringFilter + """Information to aid in pagination.""" + pageInfo: PageInfo! - """Filter by the object’s `amount` field.""" - amount: JSONFilter + """The count of *all* `BondBuy` you could get from the connection.""" + totalCount: Int! +} - """Filter by the object’s `height` field.""" - height: IntFilter +type BondBuy implements Node { + """ + A globally unique identifier. Can be used in various places throughout the system to identify this single value. + """ + nodeId: ID! + id: Int! + bondDid: String! + accountDid: String! + amount: JSON! + maxPrices: JSON! + height: Int! + timestamp: Datetime! - """Filter by the object’s `timestamp` field.""" - timestamp: DatetimeFilter + """Reads a single `Bond` that is related to this `BondBuy`.""" + bondByBondDid: Bond +} - """Filter by the object’s `bondByBondDid` relation.""" - bondByBondDid: BondFilter +"""A `BondBuy` edge in the connection.""" +type BondBuysEdge { + """A cursor for use in pagination.""" + cursor: Cursor - """Checks for all expressions in this list.""" - and: [OutcomePaymentFilter!] + """The `BondBuy` at the end of the edge.""" + node: BondBuy! +} - """Checks for any expressions in this list.""" - or: [OutcomePaymentFilter!] - - """Negates the expression.""" - not: OutcomePaymentFilter -} - -""" -A filter to be used against many `BondAlpha` object types. All fields are combined with a logical ‘and.’ -""" -input BondToManyBondAlphaFilter { - """ - Every related `BondAlpha` matches the filter criteria. All fields are combined with a logical ‘and.’ - """ - every: BondAlphaFilter - - """ - Some related `BondAlpha` matches the filter criteria. All fields are combined with a logical ‘and.’ - """ - some: BondAlphaFilter - - """ - No related `BondAlpha` matches the filter criteria. All fields are combined with a logical ‘and.’ - """ - none: BondAlphaFilter +"""Methods to use when ordering `BondBuy`.""" +enum BondBuysOrderBy { + NATURAL + ID_ASC + ID_DESC + BOND_DID_ASC + BOND_DID_DESC + ACCOUNT_DID_ASC + ACCOUNT_DID_DESC + AMOUNT_ASC + AMOUNT_DESC + MAX_PRICES_ASC + MAX_PRICES_DESC + HEIGHT_ASC + HEIGHT_DESC + TIMESTAMP_ASC + TIMESTAMP_DESC + PRIMARY_KEY_ASC + PRIMARY_KEY_DESC } """ -A filter to be used against `BondAlpha` object types. All fields are combined with a logical ‘and.’ +A condition to be used against `BondBuy` object types. All fields are tested for equality and combined with a logical ‘and.’ """ -input BondAlphaFilter { - """Filter by the object’s `id` field.""" - id: IntFilter - - """Filter by the object’s `bondDid` field.""" - bondDid: StringFilter - - """Filter by the object’s `alpha` field.""" - alpha: StringFilter - - """Filter by the object’s `oracleDid` field.""" - oracleDid: StringFilter +input BondBuyCondition { + """Checks for equality with the object’s `id` field.""" + id: Int - """Filter by the object’s `height` field.""" - height: IntFilter + """Checks for equality with the object’s `bondDid` field.""" + bondDid: String - """Filter by the object’s `timestamp` field.""" - timestamp: DatetimeFilter + """Checks for equality with the object’s `accountDid` field.""" + accountDid: String - """Filter by the object’s `bondByBondDid` relation.""" - bondByBondDid: BondFilter + """Checks for equality with the object’s `amount` field.""" + amount: JSON - """Checks for all expressions in this list.""" - and: [BondAlphaFilter!] + """Checks for equality with the object’s `maxPrices` field.""" + maxPrices: JSON - """Checks for any expressions in this list.""" - or: [BondAlphaFilter!] + """Checks for equality with the object’s `height` field.""" + height: Int - """Negates the expression.""" - not: BondAlphaFilter + """Checks for equality with the object’s `timestamp` field.""" + timestamp: Datetime } """A connection to a list of `BondSell` values.""" @@ -2586,6 +2671,97 @@ input BondSwapCondition { timestamp: Datetime } +"""A connection to a list of `OutcomePayment` values.""" +type OutcomePaymentsConnection { + """A list of `OutcomePayment` objects.""" + nodes: [OutcomePayment!]! + + """ + A list of edges which contains the `OutcomePayment` and cursor to aid in pagination. + """ + edges: [OutcomePaymentsEdge!]! + + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """The count of *all* `OutcomePayment` you could get from the connection.""" + totalCount: Int! +} + +type OutcomePayment implements Node { + """ + A globally unique identifier. Can be used in various places throughout the system to identify this single value. + """ + nodeId: ID! + id: Int! + bondDid: String! + senderDid: String! + senderAddress: String! + amount: JSON! + height: Int! + timestamp: Datetime! + + """Reads a single `Bond` that is related to this `OutcomePayment`.""" + bondByBondDid: Bond +} + +"""A `OutcomePayment` edge in the connection.""" +type OutcomePaymentsEdge { + """A cursor for use in pagination.""" + cursor: Cursor + + """The `OutcomePayment` at the end of the edge.""" + node: OutcomePayment! +} + +"""Methods to use when ordering `OutcomePayment`.""" +enum OutcomePaymentsOrderBy { + NATURAL + ID_ASC + ID_DESC + BOND_DID_ASC + BOND_DID_DESC + SENDER_DID_ASC + SENDER_DID_DESC + SENDER_ADDRESS_ASC + SENDER_ADDRESS_DESC + AMOUNT_ASC + AMOUNT_DESC + HEIGHT_ASC + HEIGHT_DESC + TIMESTAMP_ASC + TIMESTAMP_DESC + PRIMARY_KEY_ASC + PRIMARY_KEY_DESC +} + +""" +A condition to be used against `OutcomePayment` object types. All fields are +tested for equality and combined with a logical ‘and.’ +""" +input OutcomePaymentCondition { + """Checks for equality with the object’s `id` field.""" + id: Int + + """Checks for equality with the object’s `bondDid` field.""" + bondDid: String + + """Checks for equality with the object’s `senderDid` field.""" + senderDid: String + + """Checks for equality with the object’s `senderAddress` field.""" + senderAddress: String + + """Checks for equality with the object’s `amount` field.""" + amount: JSON + + """Checks for equality with the object’s `height` field.""" + height: Int + + """Checks for equality with the object’s `timestamp` field.""" + timestamp: Datetime +} + """A connection to a list of `ReserveWithdrawal` values.""" type ReserveWithdrawalsConnection { """A list of `ReserveWithdrawal` objects.""" @@ -2780,193 +2956,17 @@ input ShareWithdrawalCondition { timestamp: Datetime } -"""A connection to a list of `OutcomePayment` values.""" -type OutcomePaymentsConnection { - """A list of `OutcomePayment` objects.""" - nodes: [OutcomePayment!]! - - """ - A list of edges which contains the `OutcomePayment` and cursor to aid in pagination. - """ - edges: [OutcomePaymentsEdge!]! - - """Information to aid in pagination.""" - pageInfo: PageInfo! - - """The count of *all* `OutcomePayment` you could get from the connection.""" - totalCount: Int! -} - -type OutcomePayment implements Node { - """ - A globally unique identifier. Can be used in various places throughout the system to identify this single value. - """ - nodeId: ID! - id: Int! - bondDid: String! - senderDid: String! - senderAddress: String! - amount: JSON! - height: Int! - timestamp: Datetime! - - """Reads a single `Bond` that is related to this `OutcomePayment`.""" - bondByBondDid: Bond -} - -"""A `OutcomePayment` edge in the connection.""" -type OutcomePaymentsEdge { +"""A `Bond` edge in the connection.""" +type BondsEdge { """A cursor for use in pagination.""" cursor: Cursor - """The `OutcomePayment` at the end of the edge.""" - node: OutcomePayment! + """The `Bond` at the end of the edge.""" + node: Bond! } -"""Methods to use when ordering `OutcomePayment`.""" -enum OutcomePaymentsOrderBy { - NATURAL - ID_ASC - ID_DESC - BOND_DID_ASC - BOND_DID_DESC - SENDER_DID_ASC - SENDER_DID_DESC - SENDER_ADDRESS_ASC - SENDER_ADDRESS_DESC - AMOUNT_ASC - AMOUNT_DESC - HEIGHT_ASC - HEIGHT_DESC - TIMESTAMP_ASC - TIMESTAMP_DESC - PRIMARY_KEY_ASC - PRIMARY_KEY_DESC -} - -""" -A condition to be used against `OutcomePayment` object types. All fields are -tested for equality and combined with a logical ‘and.’ -""" -input OutcomePaymentCondition { - """Checks for equality with the object’s `id` field.""" - id: Int - - """Checks for equality with the object’s `bondDid` field.""" - bondDid: String - - """Checks for equality with the object’s `senderDid` field.""" - senderDid: String - - """Checks for equality with the object’s `senderAddress` field.""" - senderAddress: String - - """Checks for equality with the object’s `amount` field.""" - amount: JSON - - """Checks for equality with the object’s `height` field.""" - height: Int - - """Checks for equality with the object’s `timestamp` field.""" - timestamp: Datetime -} - -"""A connection to a list of `BondAlpha` values.""" -type BondAlphasConnection { - """A list of `BondAlpha` objects.""" - nodes: [BondAlpha!]! - - """ - A list of edges which contains the `BondAlpha` and cursor to aid in pagination. - """ - edges: [BondAlphasEdge!]! - - """Information to aid in pagination.""" - pageInfo: PageInfo! - - """The count of *all* `BondAlpha` you could get from the connection.""" - totalCount: Int! -} - -type BondAlpha implements Node { - """ - A globally unique identifier. Can be used in various places throughout the system to identify this single value. - """ - nodeId: ID! - id: Int! - bondDid: String! - alpha: String! - oracleDid: String! - height: Int! - timestamp: Datetime! - - """Reads a single `Bond` that is related to this `BondAlpha`.""" - bondByBondDid: Bond -} - -"""A `BondAlpha` edge in the connection.""" -type BondAlphasEdge { - """A cursor for use in pagination.""" - cursor: Cursor - - """The `BondAlpha` at the end of the edge.""" - node: BondAlpha! -} - -"""Methods to use when ordering `BondAlpha`.""" -enum BondAlphasOrderBy { - NATURAL - ID_ASC - ID_DESC - BOND_DID_ASC - BOND_DID_DESC - ALPHA_ASC - ALPHA_DESC - ORACLE_DID_ASC - ORACLE_DID_DESC - HEIGHT_ASC - HEIGHT_DESC - TIMESTAMP_ASC - TIMESTAMP_DESC - PRIMARY_KEY_ASC - PRIMARY_KEY_DESC -} - -""" -A condition to be used against `BondAlpha` object types. All fields are tested -for equality and combined with a logical ‘and.’ -""" -input BondAlphaCondition { - """Checks for equality with the object’s `id` field.""" - id: Int - - """Checks for equality with the object’s `bondDid` field.""" - bondDid: String - - """Checks for equality with the object’s `alpha` field.""" - alpha: String - - """Checks for equality with the object’s `oracleDid` field.""" - oracleDid: String - - """Checks for equality with the object’s `height` field.""" - height: Int - - """Checks for equality with the object’s `timestamp` field.""" - timestamp: Datetime -} - -"""A `Bond` edge in the connection.""" -type BondsEdge { - """A cursor for use in pagination.""" - cursor: Cursor - - """The `Bond` at the end of the edge.""" - node: Bond! -} - -"""Methods to use when ordering `Bond`.""" -enum BondsOrderBy { +"""Methods to use when ordering `Bond`.""" +enum BondsOrderBy { NATURAL BOND_DID_ASC BOND_DID_DESC @@ -3789,8 +3789,8 @@ type Entity implements Node { """Reads a single `Iid` that is related to this `Entity`.""" iidById: Iid - """Reads and enables pagination through a set of `TokenClass`.""" - tokenClassesByClass( + """Reads and enables pagination through a set of `Token`.""" + tokensByCollection( """Only read the first `n` values of the set.""" first: Int @@ -3809,22 +3809,22 @@ type Entity implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `TokenClass`.""" - orderBy: [TokenClassesOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `Token`.""" + orderBy: [TokensOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: TokenClassCondition + condition: TokenCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: TokenClassFilter - ): TokenClassesConnection! + filter: TokenFilter + ): TokensConnection! - """Reads and enables pagination through a set of `Token`.""" - tokensByCollection( + """Reads and enables pagination through a set of `TokenClass`.""" + tokenClassesByClass( """Only read the first `n` values of the set.""" first: Int @@ -3843,19 +3843,19 @@ type Entity implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `Token`.""" - orderBy: [TokensOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `TokenClass`.""" + orderBy: [TokenClassesOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: TokenCondition + condition: TokenClassCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: TokenFilter - ): TokensConnection! + filter: TokenClassFilter + ): TokenClassesConnection! context: JSON! controller: [String!]! verificationMethod: JSON! @@ -3899,45 +3899,41 @@ type Iid implements Node { entityById: Entity } -"""A connection to a list of `TokenClass` values.""" -type TokenClassesConnection { - """A list of `TokenClass` objects.""" - nodes: [TokenClass!]! +"""A connection to a list of `Token` values.""" +type TokensConnection { + """A list of `Token` objects.""" + nodes: [Token!]! """ - A list of edges which contains the `TokenClass` and cursor to aid in pagination. + A list of edges which contains the `Token` and cursor to aid in pagination. """ - edges: [TokenClassesEdge!]! + edges: [TokensEdge!]! """Information to aid in pagination.""" pageInfo: PageInfo! - """The count of *all* `TokenClass` you could get from the connection.""" + """The count of *all* `Token` you could get from the connection.""" totalCount: Int! } -type TokenClass implements Node { +type Token implements Node { """ A globally unique identifier. Can be used in various places throughout the system to identify this single value. """ nodeId: ID! - contractAddress: String! - minter: String! - class: String! + id: String! + index: String! name: String! - description: String! - image: String! - type: String! - cap: String! - supply: String! - paused: Boolean! - stopped: Boolean! + collection: String! - """Reads a single `Entity` that is related to this `TokenClass`.""" - entityByClass: Entity + """Reads a single `TokenClass` that is related to this `Token`.""" + tokenClassByName: TokenClass - """Reads and enables pagination through a set of `Token`.""" - tokensByName( + """Reads a single `Entity` that is related to this `Token`.""" + entityByCollection: Entity + + """Reads and enables pagination through a set of `TokenDatum`.""" + tokenDataByTokenId( """Only read the first `n` values of the set.""" first: Int @@ -3956,22 +3952,22 @@ type TokenClass implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `Token`.""" - orderBy: [TokensOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `TokenDatum`.""" + orderBy: [TokenDataOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: TokenCondition + condition: TokenDatumCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: TokenFilter - ): TokensConnection! + filter: TokenDatumFilter + ): TokenDataConnection! """Reads and enables pagination through a set of `TokenRetired`.""" - tokenRetiredsByName( + tokenRetiredsById( """Only read the first `n` values of the set.""" first: Int @@ -4004,8 +4000,8 @@ type TokenClass implements Node { filter: TokenRetiredFilter ): TokenRetiredsConnection! - """Reads and enables pagination through a set of `TokenCancelled`.""" - tokenCancelledsByName( + """Reads and enables pagination through a set of `TokenTransaction`.""" + tokenTransactionsByTokenId( """Only read the first `n` values of the set.""" first: Int @@ -4024,56 +4020,43 @@ type TokenClass implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `TokenCancelled`.""" - orderBy: [TokenCancelledsOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `TokenTransaction`.""" + orderBy: [TokenTransactionsOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: TokenCancelledCondition + condition: TokenTransactionCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: TokenCancelledFilter - ): TokenCancelledsConnection! -} - -"""A connection to a list of `Token` values.""" -type TokensConnection { - """A list of `Token` objects.""" - nodes: [Token!]! - - """ - A list of edges which contains the `Token` and cursor to aid in pagination. - """ - edges: [TokensEdge!]! - - """Information to aid in pagination.""" - pageInfo: PageInfo! - - """The count of *all* `Token` you could get from the connection.""" - totalCount: Int! + filter: TokenTransactionFilter + ): TokenTransactionsConnection! } -type Token implements Node { +type TokenClass implements Node { """ A globally unique identifier. Can be used in various places throughout the system to identify this single value. """ nodeId: ID! - id: String! - index: String! + contractAddress: String! + minter: String! + class: String! name: String! - collection: String! - - """Reads a single `TokenClass` that is related to this `Token`.""" - tokenClassByName: TokenClass + description: String! + image: String! + type: String! + cap: String! + supply: String! + paused: Boolean! + stopped: Boolean! - """Reads a single `Entity` that is related to this `Token`.""" - entityByCollection: Entity + """Reads a single `Entity` that is related to this `TokenClass`.""" + entityByClass: Entity - """Reads and enables pagination through a set of `TokenDatum`.""" - tokenDataByTokenId( + """Reads and enables pagination through a set of `Token`.""" + tokensByName( """Only read the first `n` values of the set.""" first: Int @@ -4092,22 +4075,22 @@ type Token implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `TokenDatum`.""" - orderBy: [TokenDataOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `Token`.""" + orderBy: [TokensOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: TokenDatumCondition + condition: TokenCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: TokenDatumFilter - ): TokenDataConnection! + filter: TokenFilter + ): TokensConnection! - """Reads and enables pagination through a set of `TokenTransaction`.""" - tokenTransactionsByTokenId( + """Reads and enables pagination through a set of `TokenCancelled`.""" + tokenCancelledsByName( """Only read the first `n` values of the set.""" first: Int @@ -4126,148 +4109,85 @@ type Token implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering `TokenTransaction`.""" - orderBy: [TokenTransactionsOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering `TokenCancelled`.""" + orderBy: [TokenCancelledsOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: TokenTransactionCondition + condition: TokenCancelledCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: TokenTransactionFilter - ): TokenTransactionsConnection! -} + filter: TokenCancelledFilter + ): TokenCancelledsConnection! -"""A connection to a list of `TokenDatum` values.""" -type TokenDataConnection { - """A list of `TokenDatum` objects.""" - nodes: [TokenDatum!]! + """Reads and enables pagination through a set of `TokenRetired`.""" + tokenRetiredsByName( + """Only read the first `n` values of the set.""" + first: Int - """ - A list of edges which contains the `TokenDatum` and cursor to aid in pagination. - """ - edges: [TokenDataEdge!]! + """Only read the last `n` values of the set.""" + last: Int - """Information to aid in pagination.""" - pageInfo: PageInfo! + """ + Skip the first `n` values from our `after` cursor, an alternative to cursor + based pagination. May not be used with `last`. + """ + offset: Int - """The count of *all* `TokenDatum` you could get from the connection.""" - totalCount: Int! -} + """Read all values in the set before (above) this cursor.""" + before: Cursor -type TokenDatum implements Node { - """ - A globally unique identifier. Can be used in various places throughout the system to identify this single value. - """ - nodeId: ID! - aid: Int! - uri: String! - encrypted: Boolean! - proof: String! - type: String! - id: String! - tokenId: String! + """Read all values in the set after (below) this cursor.""" + after: Cursor - """Reads a single `Token` that is related to this `TokenDatum`.""" - token: Token -} + """The method to use when ordering `TokenRetired`.""" + orderBy: [TokenRetiredsOrderBy!] = [PRIMARY_KEY_ASC] -"""A `TokenDatum` edge in the connection.""" -type TokenDataEdge { - """A cursor for use in pagination.""" - cursor: Cursor + """ + A condition to be used in determining which values should be returned by the collection. + """ + condition: TokenRetiredCondition - """The `TokenDatum` at the end of the edge.""" - node: TokenDatum! + """ + A filter to be used in determining which values should be returned by the collection. + """ + filter: TokenRetiredFilter + ): TokenRetiredsConnection! } -"""Methods to use when ordering `TokenDatum`.""" -enum TokenDataOrderBy { +"""Methods to use when ordering `Token`.""" +enum TokensOrderBy { NATURAL - AID_ASC - AID_DESC - URI_ASC - URI_DESC - ENCRYPTED_ASC - ENCRYPTED_DESC - PROOF_ASC - PROOF_DESC - TYPE_ASC - TYPE_DESC ID_ASC ID_DESC - TOKEN_ID_ASC - TOKEN_ID_DESC + INDEX_ASC + INDEX_DESC + NAME_ASC + NAME_DESC + COLLECTION_ASC + COLLECTION_DESC PRIMARY_KEY_ASC PRIMARY_KEY_DESC } """ -A condition to be used against `TokenDatum` object types. All fields are tested -for equality and combined with a logical ‘and.’ +A condition to be used against `Token` object types. All fields are tested for equality and combined with a logical ‘and.’ """ -input TokenDatumCondition { - """Checks for equality with the object’s `aid` field.""" - aid: Int - - """Checks for equality with the object’s `uri` field.""" - uri: String - - """Checks for equality with the object’s `encrypted` field.""" - encrypted: Boolean - - """Checks for equality with the object’s `proof` field.""" - proof: String - - """Checks for equality with the object’s `type` field.""" - type: String - +input TokenCondition { """Checks for equality with the object’s `id` field.""" id: String - """Checks for equality with the object’s `tokenId` field.""" - tokenId: String -} - -""" -A filter to be used against `TokenDatum` object types. All fields are combined with a logical ‘and.’ -""" -input TokenDatumFilter { - """Filter by the object’s `aid` field.""" - aid: IntFilter - - """Filter by the object’s `uri` field.""" - uri: StringFilter - - """Filter by the object’s `encrypted` field.""" - encrypted: BooleanFilter - - """Filter by the object’s `proof` field.""" - proof: StringFilter - - """Filter by the object’s `type` field.""" - type: StringFilter - - """Filter by the object’s `id` field.""" - id: StringFilter - - """Filter by the object’s `tokenId` field.""" - tokenId: StringFilter - - """Filter by the object’s `token` relation.""" - token: TokenFilter - - """Checks for all expressions in this list.""" - and: [TokenDatumFilter!] + """Checks for equality with the object’s `index` field.""" + index: String - """Checks for any expressions in this list.""" - or: [TokenDatumFilter!] + """Checks for equality with the object’s `name` field.""" + name: String - """Negates the expression.""" - not: TokenDatumFilter + """Checks for equality with the object’s `collection` field.""" + collection: String } """ @@ -4292,6 +4212,12 @@ input TokenFilter { """Some related `tokenDataByTokenId` exist.""" tokenDataByTokenIdExist: Boolean + """Filter by the object’s `tokenRetiredsById` relation.""" + tokenRetiredsById: TokenToManyTokenRetiredFilter + + """Some related `tokenRetiredsById` exist.""" + tokenRetiredsByIdExist: Boolean + """Filter by the object’s `tokenTransactionsByTokenId` relation.""" tokenTransactionsByTokenId: TokenToManyTokenTransactionFilter @@ -4335,55 +4261,102 @@ input TokenToManyTokenDatumFilter { } """ -A filter to be used against many `TokenTransaction` object types. All fields are combined with a logical ‘and.’ +A filter to be used against `TokenDatum` object types. All fields are combined with a logical ‘and.’ """ -input TokenToManyTokenTransactionFilter { +input TokenDatumFilter { + """Filter by the object’s `aid` field.""" + aid: IntFilter + + """Filter by the object’s `uri` field.""" + uri: StringFilter + + """Filter by the object’s `encrypted` field.""" + encrypted: BooleanFilter + + """Filter by the object’s `proof` field.""" + proof: StringFilter + + """Filter by the object’s `type` field.""" + type: StringFilter + + """Filter by the object’s `id` field.""" + id: StringFilter + + """Filter by the object’s `tokenId` field.""" + tokenId: StringFilter + + """Filter by the object’s `token` relation.""" + token: TokenFilter + + """Checks for all expressions in this list.""" + and: [TokenDatumFilter!] + + """Checks for any expressions in this list.""" + or: [TokenDatumFilter!] + + """Negates the expression.""" + not: TokenDatumFilter +} + +""" +A filter to be used against many `TokenRetired` object types. All fields are combined with a logical ‘and.’ +""" +input TokenToManyTokenRetiredFilter { """ - Every related `TokenTransaction` matches the filter criteria. All fields are combined with a logical ‘and.’ + Every related `TokenRetired` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - every: TokenTransactionFilter + every: TokenRetiredFilter """ - Some related `TokenTransaction` matches the filter criteria. All fields are combined with a logical ‘and.’ + Some related `TokenRetired` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - some: TokenTransactionFilter + some: TokenRetiredFilter """ - No related `TokenTransaction` matches the filter criteria. All fields are combined with a logical ‘and.’ + No related `TokenRetired` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - none: TokenTransactionFilter + none: TokenRetiredFilter } """ -A filter to be used against `TokenTransaction` object types. All fields are combined with a logical ‘and.’ +A filter to be used against `TokenRetired` object types. All fields are combined with a logical ‘and.’ """ -input TokenTransactionFilter { +input TokenRetiredFilter { """Filter by the object’s `aid` field.""" aid: IntFilter - """Filter by the object’s `from` field.""" - from: StringFilter + """Filter by the object’s `id` field.""" + id: StringFilter - """Filter by the object’s `to` field.""" - to: StringFilter + """Filter by the object’s `reason` field.""" + reason: StringFilter + + """Filter by the object’s `jurisdiction` field.""" + jurisdiction: StringFilter """Filter by the object’s `amount` field.""" amount: StringFilter - """Filter by the object’s `tokenId` field.""" - tokenId: StringFilter + """Filter by the object’s `owner` field.""" + owner: StringFilter - """Filter by the object’s `token` relation.""" - token: TokenFilter + """Filter by the object’s `name` field.""" + name: StringFilter + + """Filter by the object’s `tokenById` relation.""" + tokenById: TokenFilter + + """Filter by the object’s `tokenClassByName` relation.""" + tokenClassByName: TokenClassFilter """Checks for all expressions in this list.""" - and: [TokenTransactionFilter!] + and: [TokenRetiredFilter!] """Checks for any expressions in this list.""" - or: [TokenTransactionFilter!] + or: [TokenRetiredFilter!] """Negates the expression.""" - not: TokenTransactionFilter + not: TokenRetiredFilter } """ @@ -4429,18 +4402,18 @@ input TokenClassFilter { """Some related `tokensByName` exist.""" tokensByNameExist: Boolean - """Filter by the object’s `tokenRetiredsByName` relation.""" - tokenRetiredsByName: TokenClassToManyTokenRetiredFilter - - """Some related `tokenRetiredsByName` exist.""" - tokenRetiredsByNameExist: Boolean - """Filter by the object’s `tokenCancelledsByName` relation.""" tokenCancelledsByName: TokenClassToManyTokenCancelledFilter """Some related `tokenCancelledsByName` exist.""" tokenCancelledsByNameExist: Boolean + """Filter by the object’s `tokenRetiredsByName` relation.""" + tokenRetiredsByName: TokenClassToManyTokenRetiredFilter + + """Some related `tokenRetiredsByName` exist.""" + tokenRetiredsByNameExist: Boolean + """Filter by the object’s `entityByClass` relation.""" entityByClass: EntityFilter @@ -4474,64 +4447,6 @@ input TokenClassToManyTokenFilter { none: TokenFilter } -""" -A filter to be used against many `TokenRetired` object types. All fields are combined with a logical ‘and.’ -""" -input TokenClassToManyTokenRetiredFilter { - """ - Every related `TokenRetired` matches the filter criteria. All fields are combined with a logical ‘and.’ - """ - every: TokenRetiredFilter - - """ - Some related `TokenRetired` matches the filter criteria. All fields are combined with a logical ‘and.’ - """ - some: TokenRetiredFilter - - """ - No related `TokenRetired` matches the filter criteria. All fields are combined with a logical ‘and.’ - """ - none: TokenRetiredFilter -} - -""" -A filter to be used against `TokenRetired` object types. All fields are combined with a logical ‘and.’ -""" -input TokenRetiredFilter { - """Filter by the object’s `aid` field.""" - aid: IntFilter - - """Filter by the object’s `id` field.""" - id: StringFilter - - """Filter by the object’s `reason` field.""" - reason: StringFilter - - """Filter by the object’s `jurisdiction` field.""" - jurisdiction: StringFilter - - """Filter by the object’s `amount` field.""" - amount: StringFilter - - """Filter by the object’s `owner` field.""" - owner: StringFilter - - """Filter by the object’s `name` field.""" - name: StringFilter - - """Filter by the object’s `tokenClassByName` relation.""" - tokenClassByName: TokenClassFilter - - """Checks for all expressions in this list.""" - and: [TokenRetiredFilter!] - - """Checks for any expressions in this list.""" - or: [TokenRetiredFilter!] - - """Negates the expression.""" - not: TokenRetiredFilter -} - """ A filter to be used against many `TokenCancelled` object types. All fields are combined with a logical ‘and.’ """ @@ -4587,6 +4502,26 @@ input TokenCancelledFilter { not: TokenCancelledFilter } +""" +A filter to be used against many `TokenRetired` object types. All fields are combined with a logical ‘and.’ +""" +input TokenClassToManyTokenRetiredFilter { + """ + Every related `TokenRetired` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + every: TokenRetiredFilter + + """ + Some related `TokenRetired` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + some: TokenRetiredFilter + + """ + No related `TokenRetired` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + none: TokenRetiredFilter +} + """ A filter to be used against `Entity` object types. All fields are combined with a logical ‘and.’ """ @@ -4627,18 +4562,18 @@ input EntityFilter { """Filter by the object’s `owner` field.""" owner: StringFilter - """Filter by the object’s `tokenClassesByClass` relation.""" - tokenClassesByClass: EntityToManyTokenClassFilter - - """Some related `tokenClassesByClass` exist.""" - tokenClassesByClassExist: Boolean - """Filter by the object’s `tokensByCollection` relation.""" tokensByCollection: EntityToManyTokenFilter """Some related `tokensByCollection` exist.""" tokensByCollectionExist: Boolean + """Filter by the object’s `tokenClassesByClass` relation.""" + tokenClassesByClass: EntityToManyTokenClassFilter + + """Some related `tokenClassesByClass` exist.""" + tokenClassesByClassExist: Boolean + """Filter by the object’s `iidById` relation.""" iidById: IidFilter @@ -4653,43 +4588,43 @@ input EntityFilter { } """ -A filter to be used against many `TokenClass` object types. All fields are combined with a logical ‘and.’ +A filter to be used against many `Token` object types. All fields are combined with a logical ‘and.’ """ -input EntityToManyTokenClassFilter { +input EntityToManyTokenFilter { """ - Every related `TokenClass` matches the filter criteria. All fields are combined with a logical ‘and.’ + Every related `Token` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - every: TokenClassFilter + every: TokenFilter """ - Some related `TokenClass` matches the filter criteria. All fields are combined with a logical ‘and.’ + Some related `Token` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - some: TokenClassFilter + some: TokenFilter """ - No related `TokenClass` matches the filter criteria. All fields are combined with a logical ‘and.’ + No related `Token` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - none: TokenClassFilter + none: TokenFilter } """ -A filter to be used against many `Token` object types. All fields are combined with a logical ‘and.’ +A filter to be used against many `TokenClass` object types. All fields are combined with a logical ‘and.’ """ -input EntityToManyTokenFilter { +input EntityToManyTokenClassFilter { """ - Every related `Token` matches the filter criteria. All fields are combined with a logical ‘and.’ + Every related `TokenClass` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - every: TokenFilter + every: TokenClassFilter """ - Some related `Token` matches the filter criteria. All fields are combined with a logical ‘and.’ + Some related `TokenClass` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - some: TokenFilter + some: TokenClassFilter """ - No related `Token` matches the filter criteria. All fields are combined with a logical ‘and.’ + No related `TokenClass` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - none: TokenFilter + none: TokenClassFilter } """ @@ -4760,126 +4695,141 @@ input IidFilter { not: IidFilter } -"""A connection to a list of `TokenTransaction` values.""" -type TokenTransactionsConnection { - """A list of `TokenTransaction` objects.""" - nodes: [TokenTransaction!]! - +""" +A filter to be used against many `TokenTransaction` object types. All fields are combined with a logical ‘and.’ +""" +input TokenToManyTokenTransactionFilter { """ - A list of edges which contains the `TokenTransaction` and cursor to aid in pagination. + Every related `TokenTransaction` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - edges: [TokenTransactionsEdge!]! - - """Information to aid in pagination.""" - pageInfo: PageInfo! + every: TokenTransactionFilter """ - The count of *all* `TokenTransaction` you could get from the connection. + Some related `TokenTransaction` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - totalCount: Int! -} + some: TokenTransactionFilter -type TokenTransaction implements Node { """ - A globally unique identifier. Can be used in various places throughout the system to identify this single value. + No related `TokenTransaction` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - nodeId: ID! - aid: Int! - from: String! - to: String! - amount: String! - tokenId: String! - - """Reads a single `Token` that is related to this `TokenTransaction`.""" - token: Token + none: TokenTransactionFilter } -"""A `TokenTransaction` edge in the connection.""" -type TokenTransactionsEdge { - """A cursor for use in pagination.""" - cursor: Cursor +""" +A filter to be used against `TokenTransaction` object types. All fields are combined with a logical ‘and.’ +""" +input TokenTransactionFilter { + """Filter by the object’s `aid` field.""" + aid: IntFilter - """The `TokenTransaction` at the end of the edge.""" - node: TokenTransaction! -} + """Filter by the object’s `from` field.""" + from: StringFilter -"""Methods to use when ordering `TokenTransaction`.""" -enum TokenTransactionsOrderBy { - NATURAL - AID_ASC - AID_DESC - FROM_ASC - FROM_DESC - TO_ASC - TO_DESC - AMOUNT_ASC - AMOUNT_DESC - TOKEN_ID_ASC - TOKEN_ID_DESC - PRIMARY_KEY_ASC - PRIMARY_KEY_DESC + """Filter by the object’s `to` field.""" + to: StringFilter + + """Filter by the object’s `amount` field.""" + amount: StringFilter + + """Filter by the object’s `tokenId` field.""" + tokenId: StringFilter + + """Filter by the object’s `token` relation.""" + token: TokenFilter + + """Checks for all expressions in this list.""" + and: [TokenTransactionFilter!] + + """Checks for any expressions in this list.""" + or: [TokenTransactionFilter!] + + """Negates the expression.""" + not: TokenTransactionFilter } -""" -A condition to be used against `TokenTransaction` object types. All fields are -tested for equality and combined with a logical ‘and.’ -""" -input TokenTransactionCondition { - """Checks for equality with the object’s `aid` field.""" - aid: Int +"""A connection to a list of `TokenCancelled` values.""" +type TokenCancelledsConnection { + """A list of `TokenCancelled` objects.""" + nodes: [TokenCancelled!]! - """Checks for equality with the object’s `from` field.""" - from: String + """ + A list of edges which contains the `TokenCancelled` and cursor to aid in pagination. + """ + edges: [TokenCancelledsEdge!]! + + """Information to aid in pagination.""" + pageInfo: PageInfo! - """Checks for equality with the object’s `to` field.""" - to: String + """The count of *all* `TokenCancelled` you could get from the connection.""" + totalCount: Int! +} - """Checks for equality with the object’s `amount` field.""" - amount: String +type TokenCancelled implements Node { + """ + A globally unique identifier. Can be used in various places throughout the system to identify this single value. + """ + nodeId: ID! + aid: Int! + id: String! + reason: String! + amount: String! + owner: String! + name: String! - """Checks for equality with the object’s `tokenId` field.""" - tokenId: String + """Reads a single `TokenClass` that is related to this `TokenCancelled`.""" + tokenClassByName: TokenClass } -"""A `Token` edge in the connection.""" -type TokensEdge { +"""A `TokenCancelled` edge in the connection.""" +type TokenCancelledsEdge { """A cursor for use in pagination.""" cursor: Cursor - """The `Token` at the end of the edge.""" - node: Token! + """The `TokenCancelled` at the end of the edge.""" + node: TokenCancelled! } -"""Methods to use when ordering `Token`.""" -enum TokensOrderBy { +"""Methods to use when ordering `TokenCancelled`.""" +enum TokenCancelledsOrderBy { NATURAL + AID_ASC + AID_DESC ID_ASC ID_DESC - INDEX_ASC - INDEX_DESC + REASON_ASC + REASON_DESC + AMOUNT_ASC + AMOUNT_DESC + OWNER_ASC + OWNER_DESC NAME_ASC NAME_DESC - COLLECTION_ASC - COLLECTION_DESC PRIMARY_KEY_ASC PRIMARY_KEY_DESC } """ -A condition to be used against `Token` object types. All fields are tested for equality and combined with a logical ‘and.’ +A condition to be used against `TokenCancelled` object types. All fields are +tested for equality and combined with a logical ‘and.’ """ -input TokenCondition { +input TokenCancelledCondition { + """Checks for equality with the object’s `aid` field.""" + aid: Int + """Checks for equality with the object’s `id` field.""" id: String - """Checks for equality with the object’s `index` field.""" - index: String + """Checks for equality with the object’s `reason` field.""" + reason: String + + """Checks for equality with the object’s `amount` field.""" + amount: String + + """Checks for equality with the object’s `owner` field.""" + owner: String """Checks for equality with the object’s `name` field.""" name: String - - """Checks for equality with the object’s `collection` field.""" - collection: String } """A connection to a list of `TokenRetired` values.""" @@ -4912,6 +4862,9 @@ type TokenRetired implements Node { owner: String! name: String! + """Reads a single `Token` that is related to this `TokenRetired`.""" + tokenById: Token + """Reads a single `TokenClass` that is related to this `TokenRetired`.""" tokenClassByName: TokenClass } @@ -4973,89 +4926,202 @@ input TokenRetiredCondition { name: String } -"""A connection to a list of `TokenCancelled` values.""" -type TokenCancelledsConnection { - """A list of `TokenCancelled` objects.""" - nodes: [TokenCancelled!]! +"""A connection to a list of `TokenDatum` values.""" +type TokenDataConnection { + """A list of `TokenDatum` objects.""" + nodes: [TokenDatum!]! """ - A list of edges which contains the `TokenCancelled` and cursor to aid in pagination. + A list of edges which contains the `TokenDatum` and cursor to aid in pagination. """ - edges: [TokenCancelledsEdge!]! + edges: [TokenDataEdge!]! """Information to aid in pagination.""" pageInfo: PageInfo! - """The count of *all* `TokenCancelled` you could get from the connection.""" + """The count of *all* `TokenDatum` you could get from the connection.""" totalCount: Int! } -type TokenCancelled implements Node { +type TokenDatum implements Node { """ A globally unique identifier. Can be used in various places throughout the system to identify this single value. """ nodeId: ID! aid: Int! + uri: String! + encrypted: Boolean! + proof: String! + type: String! id: String! - reason: String! - amount: String! - owner: String! - name: String! + tokenId: String! - """Reads a single `TokenClass` that is related to this `TokenCancelled`.""" - tokenClassByName: TokenClass + """Reads a single `Token` that is related to this `TokenDatum`.""" + token: Token } -"""A `TokenCancelled` edge in the connection.""" -type TokenCancelledsEdge { +"""A `TokenDatum` edge in the connection.""" +type TokenDataEdge { """A cursor for use in pagination.""" cursor: Cursor - """The `TokenCancelled` at the end of the edge.""" - node: TokenCancelled! + """The `TokenDatum` at the end of the edge.""" + node: TokenDatum! } -"""Methods to use when ordering `TokenCancelled`.""" -enum TokenCancelledsOrderBy { +"""Methods to use when ordering `TokenDatum`.""" +enum TokenDataOrderBy { NATURAL AID_ASC AID_DESC + URI_ASC + URI_DESC + ENCRYPTED_ASC + ENCRYPTED_DESC + PROOF_ASC + PROOF_DESC + TYPE_ASC + TYPE_DESC ID_ASC ID_DESC - REASON_ASC - REASON_DESC + TOKEN_ID_ASC + TOKEN_ID_DESC + PRIMARY_KEY_ASC + PRIMARY_KEY_DESC +} + +""" +A condition to be used against `TokenDatum` object types. All fields are tested +for equality and combined with a logical ‘and.’ +""" +input TokenDatumCondition { + """Checks for equality with the object’s `aid` field.""" + aid: Int + + """Checks for equality with the object’s `uri` field.""" + uri: String + + """Checks for equality with the object’s `encrypted` field.""" + encrypted: Boolean + + """Checks for equality with the object’s `proof` field.""" + proof: String + + """Checks for equality with the object’s `type` field.""" + type: String + + """Checks for equality with the object’s `id` field.""" + id: String + + """Checks for equality with the object’s `tokenId` field.""" + tokenId: String +} + +"""A connection to a list of `TokenTransaction` values.""" +type TokenTransactionsConnection { + """A list of `TokenTransaction` objects.""" + nodes: [TokenTransaction!]! + + """ + A list of edges which contains the `TokenTransaction` and cursor to aid in pagination. + """ + edges: [TokenTransactionsEdge!]! + + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """ + The count of *all* `TokenTransaction` you could get from the connection. + """ + totalCount: Int! +} + +type TokenTransaction implements Node { + """ + A globally unique identifier. Can be used in various places throughout the system to identify this single value. + """ + nodeId: ID! + aid: Int! + from: String! + to: String! + amount: String! + tokenId: String! + + """Reads a single `Token` that is related to this `TokenTransaction`.""" + token: Token +} + +"""A `TokenTransaction` edge in the connection.""" +type TokenTransactionsEdge { + """A cursor for use in pagination.""" + cursor: Cursor + + """The `TokenTransaction` at the end of the edge.""" + node: TokenTransaction! +} + +"""Methods to use when ordering `TokenTransaction`.""" +enum TokenTransactionsOrderBy { + NATURAL + AID_ASC + AID_DESC + FROM_ASC + FROM_DESC + TO_ASC + TO_DESC AMOUNT_ASC AMOUNT_DESC - OWNER_ASC - OWNER_DESC - NAME_ASC - NAME_DESC + TOKEN_ID_ASC + TOKEN_ID_DESC PRIMARY_KEY_ASC PRIMARY_KEY_DESC } """ -A condition to be used against `TokenCancelled` object types. All fields are +A condition to be used against `TokenTransaction` object types. All fields are tested for equality and combined with a logical ‘and.’ """ -input TokenCancelledCondition { +input TokenTransactionCondition { """Checks for equality with the object’s `aid` field.""" aid: Int - """Checks for equality with the object’s `id` field.""" - id: String + """Checks for equality with the object’s `from` field.""" + from: String - """Checks for equality with the object’s `reason` field.""" - reason: String + """Checks for equality with the object’s `to` field.""" + to: String """Checks for equality with the object’s `amount` field.""" amount: String - """Checks for equality with the object’s `owner` field.""" - owner: String + """Checks for equality with the object’s `tokenId` field.""" + tokenId: String +} - """Checks for equality with the object’s `name` field.""" - name: String +"""A `Token` edge in the connection.""" +type TokensEdge { + """A cursor for use in pagination.""" + cursor: Cursor + + """The `Token` at the end of the edge.""" + node: Token! +} + +"""A connection to a list of `TokenClass` values.""" +type TokenClassesConnection { + """A list of `TokenClass` objects.""" + nodes: [TokenClass!]! + + """ + A list of edges which contains the `TokenClass` and cursor to aid in pagination. + """ + edges: [TokenClassesEdge!]! + + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """The count of *all* `TokenClass` you could get from the connection.""" + totalCount: Int! } """A `TokenClass` edge in the connection.""" @@ -5556,6 +5622,7 @@ type Transaction implements Node { gasUsed: String! gasWanted: String! time: Datetime! + memo: String! """Reads and enables pagination through a set of `Message`.""" messagesByTransactionHash( @@ -5710,6 +5777,9 @@ input TransactionFilter { """Filter by the object’s `time` field.""" time: DatetimeFilter + """Filter by the object’s `memo` field.""" + memo: StringFilter + """Filter by the object’s `messagesByTransactionHash` relation.""" messagesByTransactionHash: TransactionToManyMessageFilter @@ -5798,6 +5868,8 @@ enum TransactionsOrderBy { GAS_WANTED_DESC TIME_ASC TIME_DESC + MEMO_ASC + MEMO_DESC PRIMARY_KEY_ASC PRIMARY_KEY_DESC } @@ -5827,6 +5899,9 @@ input TransactionCondition { """Checks for equality with the object’s `time` field.""" time: Datetime + + """Checks for equality with the object’s `memo` field.""" + memo: String } """A connection to a list of `_PrismaMigration` values.""" diff --git a/src/graphql/token.ts b/src/graphql/token.ts index c87206a..9fcd540 100644 --- a/src/graphql/token.ts +++ b/src/graphql/token.ts @@ -18,11 +18,31 @@ export const TokenPlugin = makeExtendSchemaPlugin((build) => { return { typeDefs: gql` extend type Query { - getAccountTokens(address: String!, name: String): JSON! - getTokensTotalByAddress(address: String!, name: String): JSON! - getTokensTotalForEntities(address: String!, name: String): JSON! - getTokensTotalForCollection(did: String!, name: String): JSON! - getTokensTotalForCollectionAmounts(did: String!, name: String): JSON! + getAccountTokens( + address: String! + name: String + allEntityRetired: Boolean + ): JSON! + getTokensTotalByAddress( + address: String! + name: String + allEntityRetired: Boolean + ): JSON! + getTokensTotalForEntities( + address: String! + name: String + allEntityRetired: Boolean + ): JSON! + getTokensTotalForCollection( + did: String! + name: String + allEntityRetired: Boolean + ): JSON! + getTokensTotalForCollectionAmounts( + did: String! + name: String + allEntityRetired: Boolean + ): JSON! } `, resolvers: { @@ -31,35 +51,40 @@ export const TokenPlugin = makeExtendSchemaPlugin((build) => { return await TokenHandler.getAccountTokens( args.address, args.name, - ctx.getAccountTransactionsLoader + ctx.getAccountTransactionsLoader, + args.allEntityRetired ); }, getTokensTotalByAddress: async (c, args, ctx, rInfo) => { return await TokenHandler.getTokensTotalByAddress( args.address, args.name, - ctx.getAccountTransactionsLoader + ctx.getAccountTransactionsLoader, + args.allEntityRetired ); }, getTokensTotalForEntities: async (c, args, ctx, rInfo) => { return await TokenHandler.getTokensTotalForEntities( args.address, args.name, - ctx.getAccountTransactionsLoader + ctx.getAccountTransactionsLoader, + args.allEntityRetired ); }, getTokensTotalForCollection: async (c, args, ctx, rInfo) => { return await TokenHandler.getTokensTotalForCollection( args.did, args.name, - ctx.getAccountTransactionsLoader + ctx.getAccountTransactionsLoader, + args.allEntityRetired ); }, getTokensTotalForCollectionAmounts: async (c, args, ctx, rInfo) => { return await TokenHandler.getTokensTotalForCollectionAmounts( args.did, args.name, - ctx.getAccountTransactionsLoader + ctx.getAccountTransactionsLoader, + args.allEntityRetired ); }, }, diff --git a/src/handlers/token_handler.ts b/src/handlers/token_handler.ts index b6f2d1f..e7e4123 100644 --- a/src/handlers/token_handler.ts +++ b/src/handlers/token_handler.ts @@ -10,9 +10,15 @@ export const createGetAccountTransactionsKey = ( export const getTokensTotalByAddress = async ( address: string, name?: string, - transactionsLoader? + transactionsLoader?: any, + allEntityRetired?: boolean ) => { - const tokens = await getAccountTokens(address, name, transactionsLoader); + const tokens = await getAccountTokens( + address, + name, + transactionsLoader, + allEntityRetired + ); Object.keys(tokens).forEach((key) => { const newTokens = {}; Object.values(tokens[key].tokens).forEach((t: any) => { @@ -36,7 +42,8 @@ export const getTokensTotalByAddress = async ( export const getTokensTotalForEntities = async ( address: string, name?: string, - transactionsLoader? + transactionsLoader?: any, + allEntityRetired?: boolean ) => { const entities = await prisma.entity.findMany({ where: { owner: address, type: "asset/device" }, @@ -47,7 +54,8 @@ export const getTokensTotalForEntities = async ( const entityTokens = await getTokensTotalByAddress( entity.accounts.find((a) => a.name === "admin")?.address, name, - transactionsLoader + transactionsLoader, + allEntityRetired ); return { entity: entity.id, tokens: entityTokens }; }); @@ -114,7 +122,8 @@ export const getAccountTransactions = async ( export const getAccountTokens = async ( address: string, name?: string, - transactionLoader? + transactionLoader?: any, + allEntityRetired?: boolean ) => { let tokenTransactions: any[] = transactionLoader ? await transactionLoader.load( @@ -179,10 +188,43 @@ export const getAccountTokens = async ( } } + // if allEntityRetired is true then for retired values get all retired ever from + // any address for the tokens minted to this address + if (allEntityRetired) { + for (const [key, value] of Object.entries(tokens)) { + const ids = Object.entries((value as any).tokens) + .map(([key2, value2]: any[]) => { + tokens[key].tokens[key2].retired = 0; + // if token minted it means it is the address(entity's) token and all retired must be counted + if (value2.minted !== 0) return key2; + return null; + }) + .filter((t) => t !== null); + const retiredTokens = await prisma.token.findMany({ + where: { id: { in: ids } }, + select: { + id: true, + TokenRetired: { + select: { amount: true }, + }, + }, + }); + retiredTokens.forEach((t) => { + tokens[key].tokens[t.id].retired = t.TokenRetired.reduce( + (a, b) => a + Number(b.amount), + 0 + ); + }); + } + } + Object.entries(tokens).forEach(([key, value]: any[]) => { Object.entries(value.tokens).forEach(([key2, value2]: any[]) => { - if (value2.amount === 0 && value2.minted === 0) delete tokens[key][key2]; + // if all 3 values is 0 then remove token id from list of tokens + if (value2.amount === 0 && value2.minted === 0 && value2.retired === 0) + delete tokens[key].tokens[key2]; }); + // if list of tokens for the NAME is empty then remove the NAME if (Object.keys(tokens[key].tokens).length === 0) delete tokens[key]; }); @@ -192,7 +234,8 @@ export const getAccountTokens = async ( export const getTokensTotalForCollection = async ( did: string, name?: string, - transactionLoader? + transactionLoader?: any, + allEntityRetired?: boolean ) => { const entities = await prisma.entity.findMany({ where: { @@ -209,7 +252,8 @@ export const getTokensTotalForCollection = async ( const entityTokens = await getTokensTotalByAddress( (entity.accounts as any).find((a) => a.name === "admin")?.address, name, - transactionLoader + transactionLoader, + allEntityRetired ); return { entity: entity.id, tokens: entityTokens }; }); @@ -222,12 +266,14 @@ export const getTokensTotalForCollection = async ( export const getTokensTotalForCollectionAmounts = async ( did: string, name?: string, - transactionLoader? + transactionLoader?: any, + allEntityRetired?: boolean ) => { const tokens = await getTokensTotalForCollection( did, name, - transactionLoader + transactionLoader, + allEntityRetired ); let newTokens = {}; tokens.forEach((t) => { diff --git a/src/index.ts b/src/index.ts index aa99f29..ae8cc41 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,6 +6,7 @@ import http from "http"; import * as SyncBlocks from "./sync/sync_blocks"; import { PORT } from "./util/secrets"; import * as SyncChain from "./sync/sync_chain"; +import * as SyncBlocksCustom from "./sync/sync_custom"; SyncChain.syncChain().then(() => SyncBlocks.startSync()); diff --git a/src/prisma/migrations/20231003144359_init/migration.sql b/src/prisma/migrations/20231117103041_init/migration.sql similarity index 97% rename from src/prisma/migrations/20231003144359_init/migration.sql rename to src/prisma/migrations/20231117103041_init/migration.sql index 7d81065..7108bc6 100644 --- a/src/prisma/migrations/20231003144359_init/migration.sql +++ b/src/prisma/migrations/20231117103041_init/migration.sql @@ -314,6 +314,7 @@ CREATE TABLE "Transaction" ( "gasUsed" TEXT NOT NULL, "gasWanted" TEXT NOT NULL, "time" TIMESTAMP(3) NOT NULL, + "memo" TEXT NOT NULL DEFAULT '', CONSTRAINT "Transaction_pkey" PRIMARY KEY ("hash") ); @@ -357,7 +358,7 @@ CREATE INDEX "Token_name_idx" ON "Token"("name"); CREATE INDEX "TokenData_tokenId_idx" ON "TokenData"("tokenId"); -- CreateIndex -CREATE INDEX "TokenRetired_name_owner_idx" ON "TokenRetired"("name", "owner"); +CREATE INDEX "TokenRetired_name_owner_id_idx" ON "TokenRetired"("name", "owner", "id"); -- CreateIndex CREATE INDEX "TokenCancelled_name_idx" ON "TokenCancelled"("name"); @@ -395,6 +396,9 @@ ALTER TABLE "TokenData" ADD CONSTRAINT "TokenData_tokenId_fkey" FOREIGN KEY ("to -- AddForeignKey ALTER TABLE "TokenRetired" ADD CONSTRAINT "TokenRetired_name_fkey" FOREIGN KEY ("name") REFERENCES "TokenClass"("name") ON DELETE RESTRICT ON UPDATE CASCADE; +-- AddForeignKey +ALTER TABLE "TokenRetired" ADD CONSTRAINT "TokenRetired_id_fkey" FOREIGN KEY ("id") REFERENCES "Token"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + -- AddForeignKey ALTER TABLE "TokenCancelled" ADD CONSTRAINT "TokenCancelled_name_fkey" FOREIGN KEY ("name") REFERENCES "TokenClass"("name") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/src/prisma/schema.prisma b/src/prisma/schema.prisma index 440e348..319711c 100644 --- a/src/prisma/schema.prisma +++ b/src/prisma/schema.prisma @@ -147,6 +147,7 @@ model Token { tokenData TokenData[] tokenTransaction TokenTransaction[] tokenClass TokenClass @relation(fields: [name], references: [name]) + TokenRetired TokenRetired[] @@index([name]) } @@ -172,9 +173,11 @@ model TokenRetired { amount String owner String Token TokenClass @relation(fields: [name], references: [name]) + // Token to TokenClass already existed so making TokenAsset to Token to prevent breaking clients + TokenAsset Token @relation(fields: [id], references: [id]) name String - @@index([name, owner]) + @@index([name, owner, id]) } model TokenCancelled { @@ -348,6 +351,7 @@ model Transaction { gasUsed String gasWanted String time DateTime + memo String @default("") messages Message[] @@index([height]) diff --git a/src/prisma/schema_core.prisma b/src/prisma/schema_core.prisma index 0d2cdf6..dee8766 100644 --- a/src/prisma/schema_core.prisma +++ b/src/prisma/schema_core.prisma @@ -38,6 +38,7 @@ model TransactionCore { messages MessageCore[] Block BlockCore? @relation(fields: [blockHeight], references: [height], onDelete: Cascade) blockHeight Int + memo String @default("") @@index([blockHeight]) } diff --git a/src/sync/sync_blocks.ts b/src/sync/sync_blocks.ts index b25ff0b..6a0ec04 100644 --- a/src/sync/sync_blocks.ts +++ b/src/sync/sync_blocks.ts @@ -73,6 +73,7 @@ export const getBlock = async (blockHeight: number) => { fee: true, gasUsed: true, gasWanted: true, + memo: true, messages: { select: { typeUrl: true, value: true } }, }, }, diff --git a/src/sync/sync_custom.ts b/src/sync/sync_custom.ts new file mode 100644 index 0000000..f1ce796 --- /dev/null +++ b/src/sync/sync_custom.ts @@ -0,0 +1,63 @@ +import { prisma, prismaCore } from "../prisma/prisma_client"; +import { sleep } from "../util/sleep"; + +export const startSync = async () => { + const syncing = true; + let index = 0; + let pageSize = 100; + let nextCursor: string | undefined = undefined; + + const query = async (take = 1, cursor?: string) => + await prisma.transaction.findMany({ + take: take, + ...(cursor + ? { + cursor: { hash: cursor }, + skip: 1, + } + : {}), + orderBy: { + height: "asc", + }, + select: { + hash: true, + }, + }); + + while (syncing) { + try { + console.log("Batch Index: ", index++); + const res = await query(pageSize, nextCursor); + if (res.length == 0) { + console.log("Done!!!!!!!!!!!"); + break; + } + nextCursor = res[res.length - 1].hash; + + for (const tx of res) { + const txRes = await prismaCore.transactionCore.findFirst({ + where: { hash: tx.hash }, + select: { memo: true }, + }); + if (!txRes) { + console.log("Tx not found, skipping"); + continue; + } + if (txRes.memo) { + console.log("hash: ", tx.hash, " memo: ", txRes.memo); + await prisma.transaction.update({ + where: { hash: tx.hash }, + data: { + memo: txRes.memo, + }, + }); + } + } + + // wait 1 second to not overload the node + await sleep(1000); + } catch (error) { + console.error(`Error Getting Transactions: ${error}`); + } + } +}; diff --git a/src/sync_handlers/transaction_sync_handler.ts b/src/sync_handlers/transaction_sync_handler.ts index c485d89..ba231fc 100644 --- a/src/sync_handlers/transaction_sync_handler.ts +++ b/src/sync_handlers/transaction_sync_handler.ts @@ -57,6 +57,7 @@ export const syncTransactions = async ( height: blockHeight, code: transaction.code, fee: transaction.fee as any, + memo: transaction.memo, gasUsed: transaction.gasUsed, gasWanted: transaction.gasWanted, time: timestamp,