Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Construction preprocess #95

Merged
merged 12 commits into from
Jan 20, 2025
Merged

Construction preprocess #95

merged 12 commits into from
Jan 20, 2025

Conversation

piotr-iohk
Copy link
Collaborator

@piotr-iohk piotr-iohk commented Jan 17, 2025

Addressing #87.

Preprocess payment:

curl -X POST 'http://localhost:3000/construction/preprocess' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
  "network_identifier": {
	"blockchain": "mina",
	"network": "testnet"
  },
  "operations": [
	{
	  "operation_identifier": {
		"index": 0
	  },
	  "related_operations": [],
	  "type": "fee_payment",
	  "account": {
		"address": "B62qkUHaJUHERZuCHQhXCQ8xsGBqyYSgjQsKnKN5HhSJecakuJ4pYyk",
		"metadata": {
		  "token_id": "1"
		}
	  },
	  "amount": {
		"value": "-2000000000",
		"currency": {
		  "symbol": "MINA",
		  "decimals": 9
		}
	  }
	},
	{
	  "operation_identifier": {
		"index": 1
	  },
	  "related_operations": [],
	  "type": "payment_source_dec",
	  "account": {
		"address": "B62qkUHaJUHERZuCHQhXCQ8xsGBqyYSgjQsKnKN5HhSJecakuJ4pYyk",
		"metadata": {
		  "token_id": "1"
		}
	  },
	  "amount": {
		"value": "-5000000000",
		"currency": {
		  "symbol": "MINA",
		  "decimals": 9
		}
	  }
	},
	{
	  "operation_identifier": {
		"index": 2
	  },
	  "related_operations": [
		{
		  "index": 1
		}
	  ],
	  "type": "payment_receiver_inc",
	  "account": {
		"address": "B62qoDWfBZUxKpaoQCoFqr12wkaY84FrhxXNXzgBkMUi2Tz4K8kBDiv",
		"metadata": {
		  "token_id": "1"
		}
	  },
	  "amount": {
		"value": "5000000000",
		"currency": {
		  "symbol": "MINA",
		  "decimals": 9
		}
	  }
	}
  ],
  "metadata": {
	"valid_until": "200000",
	"memo": "hello"
  }
}'|jq
....
{
  "options": {
    "memo": "hello",
    "receiver": "B62qoDWfBZUxKpaoQCoFqr12wkaY84FrhxXNXzgBkMUi2Tz4K8kBDiv",
    "sender": "B62qkUHaJUHERZuCHQhXCQ8xsGBqyYSgjQsKnKN5HhSJecakuJ4pYyk",
    "token_id": "1",
    "valid_until": "200000"
  },
  "required_public_keys": []
}

Preprocess delegation:

curl -X POST 'http://localhost:3000/construction/preprocess' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
  "network_identifier": {
	"blockchain": "mina",
	"network": "testnet"
  },
"operations": [
		  {
			"operation_identifier": {
			  "index": 0
			},
			"type": "fee_payment",
			"account": {
			  "address": "B62qkXajxfnicuCNtaurdAhQpkFsqjoyPJuw53aeJP848bsa3Ne3RvB",
			  "metadata": {
				"token_id": "wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf"
			  }
			},
			"amount": {
			  "value": "-10100000",
			  "currency": {
				"symbol": "MINA",
				"decimals": 9
			  }
			}
		  },
		  {
			"operation_identifier": {
			  "index": 1
			},
			"type": "delegate_change",
			"account": {
			  "address": "B62qkXajxfnicuCNtaurdAhQpkFsqjoyPJuw53aeJP848bsa3Ne3RvB",
			  "metadata": {
				"token_id": "wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf"
			  }
			},
			"metadata": {
			  "delegate_change_target": "B62qiburnzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmp7r7UN6X"
			}
		  }
		],
  "metadata": {
	"valid_until": "200000",
	"memo": "hello"
  }
}'|jq
....
{
  "options": {
    "memo": "hello",
    "receiver": "B62qiburnzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmp7r7UN6X",
    "sender": "B62qkXajxfnicuCNtaurdAhQpkFsqjoyPJuw53aeJP848bsa3Ne3RvB",
    "token_id": "wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf",
    "valid_until": "200000"
  },
  "required_public_keys": []
}

@piotr-iohk piotr-iohk self-assigned this Jan 17, 2025
@piotr-iohk piotr-iohk marked this pull request as ready for review January 20, 2025 09:44
@piotr-iohk piotr-iohk merged commit 0644535 into main Jan 20, 2025
6 checks passed
@piotr-iohk piotr-iohk deleted the construction_preprocess branch January 20, 2025 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants