Replies: 8 comments 11 replies
-
Given that the |
Beta Was this translation helpful? Give feedback.
-
@yash-luna This is a great proposal. I'm excited to see some payments going over XMTP, and this is a solid format to conform to. When thinking about the UX here, one thing that I'm left feeling is that the fallback might not be as useful as we'd really like. With the current string formatted as:
…you'd end up with a string that has both the prefix to the txn hash and the hash itself. Even a standard copy/paste (especially on mobile) would make for a lot of steps to go through before you could get to the result in a non-supporting client. This is where I wonder if fallback text could occasionally be "opinionated" for the sake of a better user experience. Clients would still conform to a general format, but they could include text that might be more helpful to the recipient's experience. Here's what I'm thinking: Recommended fallback text for XIP:
Opinionated fallback text using above recommendation:
In the above example, the client follows the recommended guideline for the fallback text, but chooses to be opinionated for the sake of the target recipient's user experience, including a block explorer URL. Going further, in the case of a wallet or client app that has its own block explorer, this may be a desirable format. Further considerations:
Just my $0.02. Would love your thoughts @yash-luna |
Beta Was this translation helpful? Give feedback.
-
Is the primary purpose of this content type to be able to request crypto within a chat? If so, could it have multiple recipients (e.g., I'm requesting 5 USDC from each person in a group chat)? |
Beta Was this translation helpful? Give feedback.
-
I sort of feel like "payments" is actually a couple things. Off the top of my head it seems like we should have two different content types for requests and confirmations. I'm also a bit wary of conflating "payments" with "crypto" payments. It'd be nice to have a system that can accommodate multiple types of payments (but still supports crypto as a first class concept). Here's sort of what I've been thinking payments could look like: type PaymentRequest = {
// A random UUID for matching a request with a confirmation
requestID: string
// The address of the user who should be sending the payment
payer: string
// The address of the user who should be receiving the payment
payee: string
// The way this payment should be fulfilled (eth, cash app, etc)
fulfillmentMethod: FulfillmentMethod
}
type PaymentConfirmation = {
// The requestID of a PaymentRequest if there was one
requestID: string | undefined;
// The address of the user who sent the payment
payer: string;
// The address of the user who received the payment
payee: string;
// The way this payment was fulfilled (eth, cash app, etc)
fulfillmentMethod: FulfillmentMethod;
}
type FulfillmentMethod = {
// The name of the method for display in an app
name: string
// The amount of the payment
amount: number
// The units of the payment (cents, eth, etc)
units: string
// Any additional information needed to process the payment
metadata: { [key: string]: [value: string] }
} For a concrete example, here's how it'd work for an ETH transaction. Bob owes Alice 0.1 ETH. Alice sends Bob a PaymentRequest message that looks like this: const id = randomUUID()
const paymentRequest = {
requestID: id,
payer: bob.address,
payee: alice.address,
fulfillmentMethod: {
name: "Crypto Currency",
amount: 0.1,
units: "ETH",
}
}
await aliceConversation.send(paymentRequest, {
contentType: ContentTypePaymentRequest,
contentFallback: "Can u send me 0.1 ETH pls"
}) Bob's client sees the const paymentConfirmation = {
requestID: requestID, // The request ID sent with the payment request
payer: bob.address,
payee: alice.address,
fulfillmentMethod: {
name: "Crypto Currency",
amount: 0.1,
units: "ETH",
metadata: {
transactionHash: "...",
chainId: 123
}
}
}
await bobConversation.send(paymentConfirmation, {
contentType: ContentTypePaymentConfirmation,
contentFallback: "I just sent u 0.1 ETH"
}) Fulfillment strategies should be standardized so that their metadata is well defined. This should let clients receiving a payment confirmation do independent verification that the payment was actually received. This approach gives clients enough information to allow their users to perform payments without being too descriptive about the mechanism by which that gets done. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
Sounds like a very exciting proposal @yash-luna ! Here are questions / comments:
thank you! |
Beta Was this translation helpful? Give feedback.
-
Wanted to hop in and propose that, along the lines of what @nakajima recommended, this content type might get scoped to just registering an onchain event, specifically a transaction. Transaction ReferenceWith the recent launch of Coinbase Wallet messaging, powered by XMTP, they've introduced the concept of a payment that takes place in the context of a conversation. The payment itself is still happening by way of an onchain transaction, and the record of the tx is being displayed in the chat. CBW already supports sending crypto assets via different chains, so not just Ethereum mainnet. For instance, I can send $1 USDC to another address via Polygon, and CBW actually provides the gas for that tx. Here's an example transaction. But this is where things get a little bit challenging in that not all transfers, certainly not all transactions, are created equal. If you look at the transaction mentioned above you'll see a "From" and a "To". The "From" happens to be my wallet, All of this means that the actual logic of parsing a transaction could actually be a lot of work, and it may be hard to account for the various ways that could be done. But standardizing around a way to have a transaction record type could be really valuable—in the case of Coinbase Wallet they've already got one, it's just not standardized yet. So it's with that context that I thought I'd contribute a few more resources to the mix. First is EIP-155, which established Chain IDs for EVM networks. Another is CAIP-2 (Chain Agnostic Improvement Proposal) which proposes a human and machine-readable way to identify a chain. The last is Chainlist, which is a resource for identifying the different Network IDs present in the EVM space. All of this is to say that there still isn't a specific consensus or standard convention around how to identify the network/chain IDs alongside a transaction hash. We can try and settle on something that works for us for now, and revise as things solidify. Currently the proposal above suggests the following format:
chainId is listed as an integer, such as I do like how CAIP-2 also adds the designation One additional consideration is that "chainId" might be better described as "networkId" to better accommodate L2's and other constructs. With these considerations, what do we think about this update? Content Type: Transaction ReferenceNote the name "transactionReference" which intends to be a bit more literal as to what it is. We could build on this type, to enable specific examples like payment or request, as @nakajima recommends elsewhere. {
"authorityId": "xmtp.org",
"typeId": "transactionReference",
"versionMajor": 0,
"versionMinor": 1
} Schema could be: {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "transactionReference",
"description": "XMTP transaction reference content type",
"type": "object",
"properties": {
"namespace": {
"description": "The namespace for the networkId",
"type": "string"
},
"networkId": {
"description": "The networkId for the transaction, in {decimal/hexidecimal} format",
"type": "{integer/string}"
},
"reference": {
"description": "The transaction hash",
"type": "string"
}
},
"required": ["networkId", "reference"],
} So, in total the recommendations would be a minor change the proposal from @yash-luna, but it felt worthwhile to add the additional context and explanation. There is still additional work that will need to go into how best to display these, as none of the reference type describes what's going on with the transaction at all. I'm intentionally leaving that out for now, as it could be added here to this type, or future types that extend from this one. |
Beta Was this translation helpful? Give feedback.
-
The Content Type: "Transaction Reference" proposed by @galligan in the last post looks pretty good. Currently, Coinbase Wallet uses its own content-type for 2 subtypes of transactions (see doc):
Coinbase Wallet is ready to move regular payments to the “Transaction Reference” content type above, and Converse would love to integrate it as well, paving the way for future wallets that would integrate XMTP to show transactions in a unified way. However, it would be useful - and necessary for Coinbase Wallet to keep offering the same level of experience - to add a field to that content type. We could call it Indeed, while the transaction is pending, there is no way to decode the transaction and see the state changes it produces. During that time, it is nice for clients to have some more information on the intent of the user (for instance, “a USDC transfer on Base”). This would be especially useful on blockchains with a longer block times. Clients would know to rely on that metadata only while the transaction is still pending, as of course this data could be fake. This new field would be a key-value dict and wallets & inboxes could agree together on fields they want to put in there. One example of full content-type could be
|
Beta Was this translation helpful? Give feedback.
-
I've just opened a pull request with a proposed implementation of the "Transaction Reference" content type: xmtp/xmtp-js-content-types#50 |
Beta Was this translation helpful? Give feedback.
-
[PROPOSAL HAS BEEN UPDATES BASED ON THE LATEST DISCUSSION TO MOVE TOWARDS A GENERIC TRANSACTION REFERENCE CONTENT TYPE]
This is a proposal for on-chain transaction references in the context of chat conversations. A popular use-case is crypto token sends which enable users to easily send crypto inside the context of XMTP conversations without having to copy/paste long hex addresses.
Background
Bringing ease-of-use to referencing on-chain transactions, such as crypto payments, to empower users so they can leverage the trust and context built in conversations to split bills, settle up Splitwise balances, tip creators, or reference transactions for other purposes.
Specification
Proposed content type:
The encoded content can use a schema such as:
Presentation
Clients that support transaction references content type SHOULD:
reference
andnetworkId
data indicate that the transaction wasn't between the participants in the chat and that the message sending and receiving addresses match with the sending and receiving addresses for the transaction.A link to the transaction can be created with the appropriate blockchain explorer using a list such as https://github.com/ethereum-lists/chains.
The details and format of the UI design for the transaction reference cards are client dependent and can take different forms.
Beta Was this translation helpful? Give feedback.
All reactions