Creating offer by Chia RPC API

I would like create offer by Chia RPC API,
but it is a some gap about Chia RPC API documentation.

  • 12.1
  • 12.2
  • ?
  • ?
  • 12.5
  • 12.6

In another site i found function create_offer_for_ids(agent, params)
( chia-agent/README.md at main · Chia-Mine/chia-agent · GitHub )
but i don’t know how to use it.

Maybe someone can show some example ? :slight_smile:

params:

{
offer: Record<int, int>;
fee?: uint64;
validate_only?: bool;
driver_dict?: TDriverDict;
min_coin_amount?: uint64;
}

Please use markdown for your code blocks: Basic Syntax | Markdown Guide

This might be useful for you: Chia RPC

1 Like

To create an offer via Chia RPC, the json payload should look like this:

{
    "offer": {
        "1": -1000000000000,
        "2": 1000
    },
    "fee": 50000000
}

Above is the offer of 1 XCH (1 trillion mojo) for 1 CAT. 1 and 2 are your wallet id. For NFT, you can replace the wallet id with the launcher id instead.

2 Likes

Hi, is there any way to request nft?
chia just set the requested launcher_id as cat id… :sweat_smile:

ths!

1 Like

i don’t understand how to request an NFT.
if i offer it, it works,
if i request it, it fails.
Why? Some example?

error: Error creating offer: driver_dict specified PuzzleInfo(info={'type': 'CAT', 'tail': '0x9a1eefb87d5d71526299a3ddab969aac88737153b8b100e8c70de2b6345bcf87'}), was expecting PuzzleInfo(info={'type': 'singleton', 'launcher_id': '0x9a1eefb87d5d7152 6299a3ddab969aac88737153b8b100e8c70de2b6345bcf87', 'launcher_ph': '0xeff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9', 'also': {'type': 'metadata', 'metadata': '((117 "https://nftstorage.link/ipfs/bafybeiejjyoylqffgtqjpyj3lob46b6gkh4la mkxdkaxbimqimwexazvry/p.png" "ipfs://bafybeiejjyoylqffgtqjpyj3lob46b6gkh4lamkxdkaxbimqimwexazvry/p.png") (104 . 0xd93efc76a0389e2c3375babb545a3ca9c577e1550159e096af8e3dcaf56b69bc) (28021 "https://nftstorage.link/ipfs/bafybeiejjyoylqffgtqjpyj3lob46b6gkh 4lamkxdkaxbimqimwexazvry/p-eae8c77b.json" "ipfs://bafybeiejjyoylqffgtqjpyj3lob46b6gkh4lamkxdkaxbimqimwexazvry/p-eae8c77b.json") (27765 "https://nftstorage.link/ipfs/bafybeigcchmtoutumunhlu426icrztx5zdbsrhm7q45jcfwq623z32nb2u/p.png") (29550 . 1) (29556 . 1) (28008 . 0xeae8c77b44775836c5ccaff4d2b8e2c597ec976cae5bfc2c8100abcb7dc08dc5) (27752 . 0xd93efc76a0389e2c3375babb545a3ca9c577e1550159e096af8e3dcaf56b69bc))', 'updater_hash': '0xfe8a4b4e27a2e29a4d3fc7ce9d527adbcaccbab6ada3903ccf3ba9a769d2d78b', 'als o': {'type': 'ownership', 'owner': '()', 'transfer_program': {'type': 'royalty transfer program', 'launcher_id': '0x9a1eefb87d5d71526299a3ddab969aac88737153b8b100e8c70de2b6345bcf87', 'royalty_address': '0x1c949b361c73b682c64091d68c5c9dbaf144734eb76eec2 997221c1329fba6f8', 'royalty_percentage': '200'}}}}),

To request NFT, you will need to provide driver_dict for that NFT using nft_get_info RPC.

The example 2 in documentation should give you more detail on how to get that.