From 7eef29d6c2bac8abf69d31e344362dd1ad8a8dd7 Mon Sep 17 00:00:00 2001 From: "C.G.Vedant" Date: Sun, 7 Jul 2024 05:47:23 +0530 Subject: [PATCH 1/2] Update combine.mdx Add sample request --- .../operations_flow/combine.mdx | 52 ++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/docs/developer-docs/defi/rosetta/icp_rosetta/construction_api/operations_flow/combine.mdx b/docs/developer-docs/defi/rosetta/icp_rosetta/construction_api/operations_flow/combine.mdx index f4e5d7aa2c..939f4a17ac 100644 --- a/docs/developer-docs/defi/rosetta/icp_rosetta/construction_api/operations_flow/combine.mdx +++ b/docs/developer-docs/defi/rosetta/icp_rosetta/construction_api/operations_flow/combine.mdx @@ -21,4 +21,54 @@ Here is an example of such a payload: ``` This means that we need to sign the hex bytes `0a69632d72657175657374df3e33267733b2030e8a4fc1d7eb6e0884ab461806630921a9c0c9749abb99de` with the private key associated with the accountidentifier -`8b84c3a3529d02a9decb5b1a27e7c8d886e17e07ea0a538269697ef09c2a27b4` using an `ecdsa` signature type. \ No newline at end of file +`8b84c3a3529d02a9decb5b1a27e7c8d886e17e07ea0a538269697ef09c2a27b4` using an `ecdsa` signature type. This would result in the signature in hex representation `3046022100ce0807d84c8321bf3525361ad25654be81076e75e8c004970789d385f195fc500221008eebd282efabb878ac54e77dc4230acf54d103ef05253db44cb9fba0fb382764` + +### Fetching a signed transaction +The `construction/combine` endpoint will create a signed transaction and return it. A call to the endpoint may look like the following. +```bash +curl --location '0.0.0.0:8081/construction/combine' --header 'Content-Type: application/json' --data '{ + "network_identifier": { + "blockchain": "Internet Computer", + "network": "00000000000000020101" + }, + "unsigned_transaction": "a2677570646174657381826b5452414e53414354494f4ea56b63616e69737465725f69644a000000000000000201016b6d6574686f645f6e616d656773656e645f70626361726758480a0b08baea959fe0a9e58dbd0112040a02080a1a0308904e2a220a207f622708b363917e3ba0ef8ac1cb0dfe241ef5ffca54f32c1480473ee3a12cad3a0a0899d9c88df3d893e0176673656e646572581d2e70031d8e7ff922b6ad9f2a9eb3c1e77ffa7b6c0d0120dd4ac7e4f7026e696e67726573735f6578706972790070696e67726573735f6578706972696573811b17c04eff12cf8023", + "signatures": [ + { + "signing_payload": { + "account_identifier": { + "address": "8b84c3a3529d02a9decb5b1a27e7c8d886e17e07ea0a538269697ef09c2a27b4" + }, + "hex_bytes": "0a69632d726571756573748c85871f2b1d1edea73797b31cd63094fa82052fed84c06d45d6c719170d8f6f", + "signature_type": "ecdsa" + }, + "signature_type": "ecdsa", + "public_key": { + "hex_bytes": "047a83e378053f87b49aeae53b3ed274c8b2ffbe59d9a51e3c4d850ca8ac1684f7131b778317c0db04de661c7d08321d60c0507868af41fe3150d21b3c6c757367", + "curve_type": "secp256k1" + }, + "hex_bytes": "877f315ab0e84ac781395b4c1ce2978f77e316abe2f6eb058a22e80e14246d5c9e2e2d8ff863dca53be432aa65154a39d4b6b5304774e8ebcbe3117fd17e35dd" + }, + { + "signing_payload": { + "account_identifier": { + "address": "8b84c3a3529d02a9decb5b1a27e7c8d886e17e07ea0a538269697ef09c2a27b4" + }, + "hex_bytes": "0a69632d726571756573747a67e99e9f5e1cdfa741f8f757bb8c04f00a5fdb20a68bb273ce80973af7a6de", + "signature_type": "ecdsa" + }, + "signature_type": "ecdsa", + "public_key": { + "hex_bytes": "047a83e378053f87b49aeae53b3ed274c8b2ffbe59d9a51e3c4d850ca8ac1684f7131b778317c0db04de661c7d08321d60c0507868af41fe3150d21b3c6c757367", + "curve_type": "secp256k1" + }, + "hex_bytes": "bbb93c5e86b8b42128dcac381051e996949f0d8cfc70cc3e8f2bbd2d4788cce7ac8c8d5bc179adf528cebd2c8b61e6288e0b0595d85a11b56fd1649dbaafcffb" + } + ] +}' +``` + +and the response would look something like this. + +```json +{'signed_transaction': '81826b5452414e53414354494f4e81a266757064617465a367636f6e74656e74bf6c726571756573745f747970656463616c6c6b63616e69737465725f69644a000000000000000201016b6d6574686f645f6e616d656773656e645f70626361726758480a0b08baea959fe0a9e58dbd0112040a02080a1a0308904e2a220a207f622708b363917e3ba0ef8ac1cb0dfe241ef5ffca54f32c1480473ee3a12cad3a0a0899d9c88df3d893e0176673656e646572581d2e70031d8e7ff922b6ad9f2a9eb3c1e77ffa7b6c0d0120dd4ac7e4f7026e696e67726573735f6578706972791b17c04eff12cf8023ff6d73656e6465725f7075626b657958583056301006072a8648ce3d020106052b8104000a034200047a83e378053f87b49aeae53b3ed274c8b2ffbe59d9a51e3c4d850ca8ac1684f7131b778317c0db04de661c7d08321d60c0507868af41fe3150d21b3c6c7573676a73656e6465725f7369675840877f315ab0e84ac781395b4c1ce2978f77e316abe2f6eb058a22e80e14246d5c9e2e2d8ff863dca53be432aa65154a39d4b6b5304774e8ebcbe3117fd17e35dd6a726561645f7374617465a367636f6e74656e74bf6c726571756573745f747970656a726561645f73746174656673656e646572581d2e70031d8e7ff922b6ad9f2a9eb3c1e77ffa7b6c0d0120dd4ac7e4f70265706174687381824e726571756573745f73746174757358208c85871f2b1d1edea73797b31cd63094fa82052fed84c06d45d6c719170d8f6f6e696e67726573735f6578706972791b17c04eff12cf8023ff6d73656e6465725f7075626b657958583056301006072a8648ce3d020106052b8104000a034200047a83e378053f87b49aeae53b3ed274c8b2ffbe59d9a51e3c4d850ca8ac1684f7131b778317c0db04de661c7d08321d60c0507868af41fe3150d21b3c6c7573676a73656e6465725f7369675840bbb93c5e86b8b42128dcac381051e996949f0d8cfc70cc3e8f2bbd2d4788cce7ac8c8d5bc179adf528cebd2c8b61e6288e0b0595d85a11b56fd1649dbaafcffb'} +``` From 4698facd76c9ed5151d985813f67e59f3ae1ac6b Mon Sep 17 00:00:00 2001 From: "C.G.Vedant" Date: Wed, 10 Jul 2024 01:36:57 +0530 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Jessie Mongeon <133128541+jessiemongeon1@users.noreply.github.com> --- .../icp_rosetta/construction_api/operations_flow/combine.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/developer-docs/defi/rosetta/icp_rosetta/construction_api/operations_flow/combine.mdx b/docs/developer-docs/defi/rosetta/icp_rosetta/construction_api/operations_flow/combine.mdx index 939f4a17ac..6b70d959e6 100644 --- a/docs/developer-docs/defi/rosetta/icp_rosetta/construction_api/operations_flow/combine.mdx +++ b/docs/developer-docs/defi/rosetta/icp_rosetta/construction_api/operations_flow/combine.mdx @@ -24,7 +24,7 @@ This means that we need to sign the hex bytes `0a69632d72657175657374df3e3326773 `8b84c3a3529d02a9decb5b1a27e7c8d886e17e07ea0a538269697ef09c2a27b4` using an `ecdsa` signature type. This would result in the signature in hex representation `3046022100ce0807d84c8321bf3525361ad25654be81076e75e8c004970789d385f195fc500221008eebd282efabb878ac54e77dc4230acf54d103ef05253db44cb9fba0fb382764` ### Fetching a signed transaction -The `construction/combine` endpoint will create a signed transaction and return it. A call to the endpoint may look like the following. +The `construction/combine` endpoint will create a signed transaction and return it. A call to the endpoint may look like the following: ```bash curl --location '0.0.0.0:8081/construction/combine' --header 'Content-Type: application/json' --data '{ "network_identifier": { @@ -67,7 +67,7 @@ curl --location '0.0.0.0:8081/construction/combine' --header 'Content-Type: app }' ``` -and the response would look something like this. +The response will resemble the following: ```json {'signed_transaction': '81826b5452414e53414354494f4e81a266757064617465a367636f6e74656e74bf6c726571756573745f747970656463616c6c6b63616e69737465725f69644a000000000000000201016b6d6574686f645f6e616d656773656e645f70626361726758480a0b08baea959fe0a9e58dbd0112040a02080a1a0308904e2a220a207f622708b363917e3ba0ef8ac1cb0dfe241ef5ffca54f32c1480473ee3a12cad3a0a0899d9c88df3d893e0176673656e646572581d2e70031d8e7ff922b6ad9f2a9eb3c1e77ffa7b6c0d0120dd4ac7e4f7026e696e67726573735f6578706972791b17c04eff12cf8023ff6d73656e6465725f7075626b657958583056301006072a8648ce3d020106052b8104000a034200047a83e378053f87b49aeae53b3ed274c8b2ffbe59d9a51e3c4d850ca8ac1684f7131b778317c0db04de661c7d08321d60c0507868af41fe3150d21b3c6c7573676a73656e6465725f7369675840877f315ab0e84ac781395b4c1ce2978f77e316abe2f6eb058a22e80e14246d5c9e2e2d8ff863dca53be432aa65154a39d4b6b5304774e8ebcbe3117fd17e35dd6a726561645f7374617465a367636f6e74656e74bf6c726571756573745f747970656a726561645f73746174656673656e646572581d2e70031d8e7ff922b6ad9f2a9eb3c1e77ffa7b6c0d0120dd4ac7e4f70265706174687381824e726571756573745f73746174757358208c85871f2b1d1edea73797b31cd63094fa82052fed84c06d45d6c719170d8f6f6e696e67726573735f6578706972791b17c04eff12cf8023ff6d73656e6465725f7075626b657958583056301006072a8648ce3d020106052b8104000a034200047a83e378053f87b49aeae53b3ed274c8b2ffbe59d9a51e3c4d850ca8ac1684f7131b778317c0db04de661c7d08321d60c0507868af41fe3150d21b3c6c7573676a73656e6465725f7369675840bbb93c5e86b8b42128dcac381051e996949f0d8cfc70cc3e8f2bbd2d4788cce7ac8c8d5bc179adf528cebd2c8b61e6288e0b0595d85a11b56fd1649dbaafcffb'}