From 5a69541ec3ba6654d51786651754883455f26aa1 Mon Sep 17 00:00:00 2001 From: Tarik Gul <47201679+TarikGul@users.noreply.github.com> Date: Mon, 18 Sep 2023 10:35:38 -0700 Subject: [PATCH] docs: enhance the documentation and add inline code examples (#286) Co-authored-by: Dominique --- docs/assets/search.js | 2 +- ... AssetsTransferApi.AssetsTransferApi.html} | 63 +++--- .../errors_BaseError.BaseErrorsEnum.html | 205 ++++++++++++++++++ .../{Direction.html => types.Direction.html} | 65 +++--- ...structApiPromise.constructApiPromise.html} | 36 +-- docs/index.html | 16 +- docs/interfaces/ApiInfo.html | 54 ----- .../constructApiPromise.ApiInfo.html | 98 +++++++++ ...sOpts.html => types.TransferArgsOpts.html} | 71 +++--- .../{TxResult.html => types.TxResult.html} | 69 +++--- docs/modules.html | 69 ------ docs/modules/AssetsTransferApi.html | 51 +++++ docs/modules/constructApiPromise.html | 56 +++++ docs/modules/errors_BaseError.html | 51 +++++ docs/modules/types.html | 69 ++++++ docs/types/Methods.html | 50 ----- ...rmat.html => types.ConstructedFormat.html} | 33 +-- docs/types/{Format.html => types.Format.html} | 33 +-- ...pes.html => types.LocalTransferTypes.html} | 33 +-- docs/types/types.Methods.html | 55 +++++ src/AssetsTransferApi.ts | 111 +++++++--- src/constructApiPromise.ts | 19 +- typedoc.config.cjs | 5 +- 23 files changed, 908 insertions(+), 406 deletions(-) rename docs/classes/{AssetsTransferApi.html => AssetsTransferApi.AssetsTransferApi.html} (56%) create mode 100644 docs/enums/errors_BaseError.BaseErrorsEnum.html rename docs/enums/{Direction.html => types.Direction.html} (66%) rename docs/functions/{constructApiPromise.html => constructApiPromise.constructApiPromise.html} (54%) delete mode 100644 docs/interfaces/ApiInfo.html create mode 100644 docs/interfaces/constructApiPromise.ApiInfo.html rename docs/interfaces/{TransferArgsOpts.html => types.TransferArgsOpts.html} (71%) rename docs/interfaces/{TxResult.html => types.TxResult.html} (63%) delete mode 100644 docs/modules.html create mode 100644 docs/modules/AssetsTransferApi.html create mode 100644 docs/modules/constructApiPromise.html create mode 100644 docs/modules/errors_BaseError.html create mode 100644 docs/modules/types.html delete mode 100644 docs/types/Methods.html rename docs/types/{ConstructedFormat.html => types.ConstructedFormat.html} (62%) rename docs/types/{Format.html => types.Format.html} (56%) rename docs/types/{LocalTransferTypes.html => types.LocalTransferTypes.html} (58%) create mode 100644 docs/types/types.Methods.html diff --git a/docs/assets/search.js b/docs/assets/search.js index 19de7797..5712604c 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = JSON.parse("{\"rows\":[{\"kind\":128,\"name\":\"AssetsTransferApi\",\"url\":\"classes/AssetsTransferApi.html\",\"classes\":\"\"},{\"kind\":2048,\"name\":\"createTransferTransaction\",\"url\":\"classes/AssetsTransferApi.html#createTransferTransaction\",\"classes\":\"\",\"parent\":\"AssetsTransferApi\"},{\"kind\":2048,\"name\":\"fetchFeeInfo\",\"url\":\"classes/AssetsTransferApi.html#fetchFeeInfo\",\"classes\":\"\",\"parent\":\"AssetsTransferApi\"},{\"kind\":2048,\"name\":\"decodeExtrinsic\",\"url\":\"classes/AssetsTransferApi.html#decodeExtrinsic\",\"classes\":\"\",\"parent\":\"AssetsTransferApi\"},{\"kind\":256,\"name\":\"ApiInfo\",\"url\":\"interfaces/ApiInfo.html\",\"classes\":\"\"},{\"kind\":64,\"name\":\"constructApiPromise\",\"url\":\"functions/constructApiPromise.html\",\"classes\":\"\"},{\"kind\":8,\"name\":\"Direction\",\"url\":\"enums/Direction.html\",\"classes\":\"\"},{\"kind\":16,\"name\":\"SystemToPara\",\"url\":\"enums/Direction.html#SystemToPara\",\"classes\":\"\",\"parent\":\"Direction\"},{\"kind\":16,\"name\":\"SystemToRelay\",\"url\":\"enums/Direction.html#SystemToRelay\",\"classes\":\"\",\"parent\":\"Direction\"},{\"kind\":16,\"name\":\"SystemToSystem\",\"url\":\"enums/Direction.html#SystemToSystem\",\"classes\":\"\",\"parent\":\"Direction\"},{\"kind\":16,\"name\":\"ParaToPara\",\"url\":\"enums/Direction.html#ParaToPara\",\"classes\":\"\",\"parent\":\"Direction\"},{\"kind\":16,\"name\":\"ParaToRelay\",\"url\":\"enums/Direction.html#ParaToRelay\",\"classes\":\"\",\"parent\":\"Direction\"},{\"kind\":16,\"name\":\"ParaToSystem\",\"url\":\"enums/Direction.html#ParaToSystem\",\"classes\":\"\",\"parent\":\"Direction\"},{\"kind\":16,\"name\":\"RelayToSystem\",\"url\":\"enums/Direction.html#RelayToSystem\",\"classes\":\"\",\"parent\":\"Direction\"},{\"kind\":16,\"name\":\"RelayToPara\",\"url\":\"enums/Direction.html#RelayToPara\",\"classes\":\"\",\"parent\":\"Direction\"},{\"kind\":4194304,\"name\":\"Format\",\"url\":\"types/Format.html\",\"classes\":\"\"},{\"kind\":4194304,\"name\":\"ConstructedFormat\",\"url\":\"types/ConstructedFormat.html\",\"classes\":\"\"},{\"kind\":4194304,\"name\":\"LocalTransferTypes\",\"url\":\"types/LocalTransferTypes.html\",\"classes\":\"\"},{\"kind\":4194304,\"name\":\"Methods\",\"url\":\"types/Methods.html\",\"classes\":\"\"},{\"kind\":256,\"name\":\"TxResult\",\"url\":\"interfaces/TxResult.html\",\"classes\":\"\"},{\"kind\":1024,\"name\":\"dest\",\"url\":\"interfaces/TxResult.html#dest\",\"classes\":\"\",\"parent\":\"TxResult\"},{\"kind\":1024,\"name\":\"origin\",\"url\":\"interfaces/TxResult.html#origin\",\"classes\":\"\",\"parent\":\"TxResult\"},{\"kind\":1024,\"name\":\"format\",\"url\":\"interfaces/TxResult.html#format\",\"classes\":\"\",\"parent\":\"TxResult\"},{\"kind\":1024,\"name\":\"xcmVersion\",\"url\":\"interfaces/TxResult.html#xcmVersion\",\"classes\":\"\",\"parent\":\"TxResult\"},{\"kind\":1024,\"name\":\"direction\",\"url\":\"interfaces/TxResult.html#direction\",\"classes\":\"\",\"parent\":\"TxResult\"},{\"kind\":1024,\"name\":\"method\",\"url\":\"interfaces/TxResult.html#method\",\"classes\":\"\",\"parent\":\"TxResult\"},{\"kind\":1024,\"name\":\"tx\",\"url\":\"interfaces/TxResult.html#tx\",\"classes\":\"\",\"parent\":\"TxResult\"},{\"kind\":256,\"name\":\"TransferArgsOpts\",\"url\":\"interfaces/TransferArgsOpts.html\",\"classes\":\"\"},{\"kind\":1024,\"name\":\"format\",\"url\":\"interfaces/TransferArgsOpts.html#format\",\"classes\":\"\",\"parent\":\"TransferArgsOpts\"},{\"kind\":1024,\"name\":\"paysWithFeeOrigin\",\"url\":\"interfaces/TransferArgsOpts.html#paysWithFeeOrigin\",\"classes\":\"\",\"parent\":\"TransferArgsOpts\"},{\"kind\":1024,\"name\":\"paysWithFeeDest\",\"url\":\"interfaces/TransferArgsOpts.html#paysWithFeeDest\",\"classes\":\"\",\"parent\":\"TransferArgsOpts\"},{\"kind\":1024,\"name\":\"sendersAddr\",\"url\":\"interfaces/TransferArgsOpts.html#sendersAddr\",\"classes\":\"\",\"parent\":\"TransferArgsOpts\"},{\"kind\":1024,\"name\":\"isLimited\",\"url\":\"interfaces/TransferArgsOpts.html#isLimited\",\"classes\":\"\",\"parent\":\"TransferArgsOpts\"},{\"kind\":1024,\"name\":\"weightLimit\",\"url\":\"interfaces/TransferArgsOpts.html#weightLimit\",\"classes\":\"\",\"parent\":\"TransferArgsOpts\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/TransferArgsOpts.html#weightLimit.__type\",\"classes\":\"\",\"parent\":\"TransferArgsOpts.weightLimit\"},{\"kind\":1024,\"name\":\"refTime\",\"url\":\"interfaces/TransferArgsOpts.html#weightLimit.__type.refTime\",\"classes\":\"\",\"parent\":\"TransferArgsOpts.weightLimit.__type\"},{\"kind\":1024,\"name\":\"proofSize\",\"url\":\"interfaces/TransferArgsOpts.html#weightLimit.__type.proofSize\",\"classes\":\"\",\"parent\":\"TransferArgsOpts.weightLimit.__type\"},{\"kind\":1024,\"name\":\"xcmVersion\",\"url\":\"interfaces/TransferArgsOpts.html#xcmVersion\",\"classes\":\"\",\"parent\":\"TransferArgsOpts\"},{\"kind\":1024,\"name\":\"keepAlive\",\"url\":\"interfaces/TransferArgsOpts.html#keepAlive\",\"classes\":\"\",\"parent\":\"TransferArgsOpts\"},{\"kind\":1024,\"name\":\"transferLiquidToken\",\"url\":\"interfaces/TransferArgsOpts.html#transferLiquidToken\",\"classes\":\"\",\"parent\":\"TransferArgsOpts\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"comment\"],\"fieldVectors\":[[\"name/0\",[0,33.081]],[\"comment/0\",[]],[\"name/1\",[1,33.081]],[\"comment/1\",[]],[\"name/2\",[2,33.081]],[\"comment/2\",[]],[\"name/3\",[3,33.081]],[\"comment/3\",[]],[\"name/4\",[4,33.081]],[\"comment/4\",[]],[\"name/5\",[5,33.081]],[\"comment/5\",[]],[\"name/6\",[6,27.973]],[\"comment/6\",[]],[\"name/7\",[7,33.081]],[\"comment/7\",[]],[\"name/8\",[8,33.081]],[\"comment/8\",[]],[\"name/9\",[9,33.081]],[\"comment/9\",[]],[\"name/10\",[10,33.081]],[\"comment/10\",[]],[\"name/11\",[11,33.081]],[\"comment/11\",[]],[\"name/12\",[12,33.081]],[\"comment/12\",[]],[\"name/13\",[13,33.081]],[\"comment/13\",[]],[\"name/14\",[14,33.081]],[\"comment/14\",[]],[\"name/15\",[15,24.608]],[\"comment/15\",[]],[\"name/16\",[16,33.081]],[\"comment/16\",[]],[\"name/17\",[17,33.081]],[\"comment/17\",[]],[\"name/18\",[18,33.081]],[\"comment/18\",[]],[\"name/19\",[19,33.081]],[\"comment/19\",[]],[\"name/20\",[20,33.081]],[\"comment/20\",[]],[\"name/21\",[21,33.081]],[\"comment/21\",[]],[\"name/22\",[15,24.608]],[\"comment/22\",[]],[\"name/23\",[22,27.973]],[\"comment/23\",[]],[\"name/24\",[6,27.973]],[\"comment/24\",[]],[\"name/25\",[23,33.081]],[\"comment/25\",[]],[\"name/26\",[24,33.081]],[\"comment/26\",[]],[\"name/27\",[25,33.081]],[\"comment/27\",[]],[\"name/28\",[15,24.608]],[\"comment/28\",[]],[\"name/29\",[26,33.081]],[\"comment/29\",[]],[\"name/30\",[27,33.081]],[\"comment/30\",[]],[\"name/31\",[28,33.081]],[\"comment/31\",[]],[\"name/32\",[29,33.081]],[\"comment/32\",[]],[\"name/33\",[30,33.081]],[\"comment/33\",[]],[\"name/34\",[31,33.081]],[\"comment/34\",[]],[\"name/35\",[32,33.081]],[\"comment/35\",[]],[\"name/36\",[33,33.081]],[\"comment/36\",[]],[\"name/37\",[22,27.973]],[\"comment/37\",[]],[\"name/38\",[34,33.081]],[\"comment/38\",[]],[\"name/39\",[35,33.081]],[\"comment/39\",[]]],\"invertedIndex\":[[\"__type\",{\"_index\":31,\"name\":{\"34\":{}},\"comment\":{}}],[\"apiinfo\",{\"_index\":4,\"name\":{\"4\":{}},\"comment\":{}}],[\"assetstransferapi\",{\"_index\":0,\"name\":{\"0\":{}},\"comment\":{}}],[\"constructapipromise\",{\"_index\":5,\"name\":{\"5\":{}},\"comment\":{}}],[\"constructedformat\",{\"_index\":16,\"name\":{\"16\":{}},\"comment\":{}}],[\"createtransfertransaction\",{\"_index\":1,\"name\":{\"1\":{}},\"comment\":{}}],[\"decodeextrinsic\",{\"_index\":3,\"name\":{\"3\":{}},\"comment\":{}}],[\"dest\",{\"_index\":20,\"name\":{\"20\":{}},\"comment\":{}}],[\"direction\",{\"_index\":6,\"name\":{\"6\":{},\"24\":{}},\"comment\":{}}],[\"fetchfeeinfo\",{\"_index\":2,\"name\":{\"2\":{}},\"comment\":{}}],[\"format\",{\"_index\":15,\"name\":{\"15\":{},\"22\":{},\"28\":{}},\"comment\":{}}],[\"islimited\",{\"_index\":29,\"name\":{\"32\":{}},\"comment\":{}}],[\"keepalive\",{\"_index\":34,\"name\":{\"38\":{}},\"comment\":{}}],[\"localtransfertypes\",{\"_index\":17,\"name\":{\"17\":{}},\"comment\":{}}],[\"method\",{\"_index\":23,\"name\":{\"25\":{}},\"comment\":{}}],[\"methods\",{\"_index\":18,\"name\":{\"18\":{}},\"comment\":{}}],[\"origin\",{\"_index\":21,\"name\":{\"21\":{}},\"comment\":{}}],[\"paratopara\",{\"_index\":10,\"name\":{\"10\":{}},\"comment\":{}}],[\"paratorelay\",{\"_index\":11,\"name\":{\"11\":{}},\"comment\":{}}],[\"paratosystem\",{\"_index\":12,\"name\":{\"12\":{}},\"comment\":{}}],[\"payswithfeedest\",{\"_index\":27,\"name\":{\"30\":{}},\"comment\":{}}],[\"payswithfeeorigin\",{\"_index\":26,\"name\":{\"29\":{}},\"comment\":{}}],[\"proofsize\",{\"_index\":33,\"name\":{\"36\":{}},\"comment\":{}}],[\"reftime\",{\"_index\":32,\"name\":{\"35\":{}},\"comment\":{}}],[\"relaytopara\",{\"_index\":14,\"name\":{\"14\":{}},\"comment\":{}}],[\"relaytosystem\",{\"_index\":13,\"name\":{\"13\":{}},\"comment\":{}}],[\"sendersaddr\",{\"_index\":28,\"name\":{\"31\":{}},\"comment\":{}}],[\"systemtopara\",{\"_index\":7,\"name\":{\"7\":{}},\"comment\":{}}],[\"systemtorelay\",{\"_index\":8,\"name\":{\"8\":{}},\"comment\":{}}],[\"systemtosystem\",{\"_index\":9,\"name\":{\"9\":{}},\"comment\":{}}],[\"transferargsopts\",{\"_index\":25,\"name\":{\"27\":{}},\"comment\":{}}],[\"transferliquidtoken\",{\"_index\":35,\"name\":{\"39\":{}},\"comment\":{}}],[\"tx\",{\"_index\":24,\"name\":{\"26\":{}},\"comment\":{}}],[\"txresult\",{\"_index\":19,\"name\":{\"19\":{}},\"comment\":{}}],[\"weightlimit\",{\"_index\":30,\"name\":{\"33\":{}},\"comment\":{}}],[\"xcmversion\",{\"_index\":22,\"name\":{\"23\":{},\"37\":{}},\"comment\":{}}]],\"pipeline\":[]}}"); \ No newline at end of file +window.searchData = JSON.parse("{\"rows\":[{\"kind\":2,\"name\":\"AssetsTransferApi\",\"url\":\"modules/AssetsTransferApi.html\",\"classes\":\"\"},{\"kind\":128,\"name\":\"AssetsTransferApi\",\"url\":\"classes/AssetsTransferApi.AssetsTransferApi.html\",\"classes\":\"\",\"parent\":\"AssetsTransferApi\"},{\"kind\":2048,\"name\":\"createTransferTransaction\",\"url\":\"classes/AssetsTransferApi.AssetsTransferApi.html#createTransferTransaction\",\"classes\":\"\",\"parent\":\"AssetsTransferApi.AssetsTransferApi\"},{\"kind\":2048,\"name\":\"fetchFeeInfo\",\"url\":\"classes/AssetsTransferApi.AssetsTransferApi.html#fetchFeeInfo\",\"classes\":\"\",\"parent\":\"AssetsTransferApi.AssetsTransferApi\"},{\"kind\":2048,\"name\":\"decodeExtrinsic\",\"url\":\"classes/AssetsTransferApi.AssetsTransferApi.html#decodeExtrinsic\",\"classes\":\"\",\"parent\":\"AssetsTransferApi.AssetsTransferApi\"},{\"kind\":2,\"name\":\"constructApiPromise\",\"url\":\"modules/constructApiPromise.html\",\"classes\":\"\"},{\"kind\":256,\"name\":\"ApiInfo\",\"url\":\"interfaces/constructApiPromise.ApiInfo.html\",\"classes\":\"\",\"parent\":\"constructApiPromise\"},{\"kind\":1024,\"name\":\"api\",\"url\":\"interfaces/constructApiPromise.ApiInfo.html#api\",\"classes\":\"\",\"parent\":\"constructApiPromise.ApiInfo\"},{\"kind\":1024,\"name\":\"specName\",\"url\":\"interfaces/constructApiPromise.ApiInfo.html#specName\",\"classes\":\"\",\"parent\":\"constructApiPromise.ApiInfo\"},{\"kind\":1024,\"name\":\"safeXcmVersion\",\"url\":\"interfaces/constructApiPromise.ApiInfo.html#safeXcmVersion\",\"classes\":\"\",\"parent\":\"constructApiPromise.ApiInfo\"},{\"kind\":64,\"name\":\"constructApiPromise\",\"url\":\"functions/constructApiPromise.constructApiPromise.html\",\"classes\":\"\",\"parent\":\"constructApiPromise\"},{\"kind\":2,\"name\":\"types\",\"url\":\"modules/types.html\",\"classes\":\"\"},{\"kind\":8,\"name\":\"Direction\",\"url\":\"enums/types.Direction.html\",\"classes\":\"\",\"parent\":\"types\"},{\"kind\":16,\"name\":\"SystemToPara\",\"url\":\"enums/types.Direction.html#SystemToPara\",\"classes\":\"\",\"parent\":\"types.Direction\"},{\"kind\":16,\"name\":\"SystemToRelay\",\"url\":\"enums/types.Direction.html#SystemToRelay\",\"classes\":\"\",\"parent\":\"types.Direction\"},{\"kind\":16,\"name\":\"SystemToSystem\",\"url\":\"enums/types.Direction.html#SystemToSystem\",\"classes\":\"\",\"parent\":\"types.Direction\"},{\"kind\":16,\"name\":\"ParaToPara\",\"url\":\"enums/types.Direction.html#ParaToPara\",\"classes\":\"\",\"parent\":\"types.Direction\"},{\"kind\":16,\"name\":\"ParaToRelay\",\"url\":\"enums/types.Direction.html#ParaToRelay\",\"classes\":\"\",\"parent\":\"types.Direction\"},{\"kind\":16,\"name\":\"ParaToSystem\",\"url\":\"enums/types.Direction.html#ParaToSystem\",\"classes\":\"\",\"parent\":\"types.Direction\"},{\"kind\":16,\"name\":\"RelayToSystem\",\"url\":\"enums/types.Direction.html#RelayToSystem\",\"classes\":\"\",\"parent\":\"types.Direction\"},{\"kind\":16,\"name\":\"RelayToPara\",\"url\":\"enums/types.Direction.html#RelayToPara\",\"classes\":\"\",\"parent\":\"types.Direction\"},{\"kind\":4194304,\"name\":\"Format\",\"url\":\"types/types.Format.html\",\"classes\":\"\",\"parent\":\"types\"},{\"kind\":4194304,\"name\":\"ConstructedFormat\",\"url\":\"types/types.ConstructedFormat.html\",\"classes\":\"\",\"parent\":\"types\"},{\"kind\":4194304,\"name\":\"LocalTransferTypes\",\"url\":\"types/types.LocalTransferTypes.html\",\"classes\":\"\",\"parent\":\"types\"},{\"kind\":4194304,\"name\":\"Methods\",\"url\":\"types/types.Methods.html\",\"classes\":\"\",\"parent\":\"types\"},{\"kind\":256,\"name\":\"TxResult\",\"url\":\"interfaces/types.TxResult.html\",\"classes\":\"\",\"parent\":\"types\"},{\"kind\":1024,\"name\":\"dest\",\"url\":\"interfaces/types.TxResult.html#dest\",\"classes\":\"\",\"parent\":\"types.TxResult\"},{\"kind\":1024,\"name\":\"origin\",\"url\":\"interfaces/types.TxResult.html#origin\",\"classes\":\"\",\"parent\":\"types.TxResult\"},{\"kind\":1024,\"name\":\"format\",\"url\":\"interfaces/types.TxResult.html#format\",\"classes\":\"\",\"parent\":\"types.TxResult\"},{\"kind\":1024,\"name\":\"xcmVersion\",\"url\":\"interfaces/types.TxResult.html#xcmVersion\",\"classes\":\"\",\"parent\":\"types.TxResult\"},{\"kind\":1024,\"name\":\"direction\",\"url\":\"interfaces/types.TxResult.html#direction\",\"classes\":\"\",\"parent\":\"types.TxResult\"},{\"kind\":1024,\"name\":\"method\",\"url\":\"interfaces/types.TxResult.html#method\",\"classes\":\"\",\"parent\":\"types.TxResult\"},{\"kind\":1024,\"name\":\"tx\",\"url\":\"interfaces/types.TxResult.html#tx\",\"classes\":\"\",\"parent\":\"types.TxResult\"},{\"kind\":256,\"name\":\"TransferArgsOpts\",\"url\":\"interfaces/types.TransferArgsOpts.html\",\"classes\":\"\",\"parent\":\"types\"},{\"kind\":1024,\"name\":\"format\",\"url\":\"interfaces/types.TransferArgsOpts.html#format\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts\"},{\"kind\":1024,\"name\":\"paysWithFeeOrigin\",\"url\":\"interfaces/types.TransferArgsOpts.html#paysWithFeeOrigin\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts\"},{\"kind\":1024,\"name\":\"paysWithFeeDest\",\"url\":\"interfaces/types.TransferArgsOpts.html#paysWithFeeDest\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts\"},{\"kind\":1024,\"name\":\"sendersAddr\",\"url\":\"interfaces/types.TransferArgsOpts.html#sendersAddr\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts\"},{\"kind\":1024,\"name\":\"isLimited\",\"url\":\"interfaces/types.TransferArgsOpts.html#isLimited\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts\"},{\"kind\":1024,\"name\":\"weightLimit\",\"url\":\"interfaces/types.TransferArgsOpts.html#weightLimit\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types.TransferArgsOpts.html#weightLimit.__type\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts.weightLimit\"},{\"kind\":1024,\"name\":\"refTime\",\"url\":\"interfaces/types.TransferArgsOpts.html#weightLimit.__type.refTime\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts.weightLimit.__type\"},{\"kind\":1024,\"name\":\"proofSize\",\"url\":\"interfaces/types.TransferArgsOpts.html#weightLimit.__type.proofSize\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts.weightLimit.__type\"},{\"kind\":1024,\"name\":\"xcmVersion\",\"url\":\"interfaces/types.TransferArgsOpts.html#xcmVersion\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts\"},{\"kind\":1024,\"name\":\"keepAlive\",\"url\":\"interfaces/types.TransferArgsOpts.html#keepAlive\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts\"},{\"kind\":1024,\"name\":\"transferLiquidToken\",\"url\":\"interfaces/types.TransferArgsOpts.html#transferLiquidToken\",\"classes\":\"\",\"parent\":\"types.TransferArgsOpts\"},{\"kind\":2,\"name\":\"errors/BaseError\",\"url\":\"modules/errors_BaseError.html\",\"classes\":\"\"},{\"kind\":8,\"name\":\"BaseErrorsEnum\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html\",\"classes\":\"\",\"parent\":\"errors/BaseError\"},{\"kind\":16,\"name\":\"InvalidInput\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#InvalidInput\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"InvalidAsset\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#InvalidAsset\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"AssetNotFound\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#AssetNotFound\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"InvalidPallet\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#InvalidPallet\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"PalletNotFound\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#PalletNotFound\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"InvalidDirection\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#InvalidDirection\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"InvalidMultiLocationAsset\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#InvalidMultiLocationAsset\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"MultipleNonUniqueAssetsFound\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#MultipleNonUniqueAssetsFound\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"RegistryNotFound\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#RegistryNotFound\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"InvalidXcmVersion\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#InvalidXcmVersion\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"NotImplemented\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#NotImplemented\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"InternalError\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#InternalError\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"InvalidAddress\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#InvalidAddress\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"},{\"kind\":16,\"name\":\"DisabledOption\",\"url\":\"enums/errors_BaseError.BaseErrorsEnum.html#DisabledOption\",\"classes\":\"\",\"parent\":\"errors/BaseError.BaseErrorsEnum\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"comment\"],\"fieldVectors\":[[\"name/0\",[0,32.268]],[\"comment/0\",[]],[\"name/1\",[0,32.268]],[\"comment/1\",[]],[\"name/2\",[1,37.377]],[\"comment/2\",[]],[\"name/3\",[2,37.377]],[\"comment/3\",[]],[\"name/4\",[3,37.377]],[\"comment/4\",[]],[\"name/5\",[4,32.268]],[\"comment/5\",[]],[\"name/6\",[5,37.377]],[\"comment/6\",[]],[\"name/7\",[6,37.377]],[\"comment/7\",[]],[\"name/8\",[7,37.377]],[\"comment/8\",[]],[\"name/9\",[8,37.377]],[\"comment/9\",[]],[\"name/10\",[4,32.268]],[\"comment/10\",[]],[\"name/11\",[9,37.377]],[\"comment/11\",[]],[\"name/12\",[10,32.268]],[\"comment/12\",[]],[\"name/13\",[11,37.377]],[\"comment/13\",[]],[\"name/14\",[12,37.377]],[\"comment/14\",[]],[\"name/15\",[13,37.377]],[\"comment/15\",[]],[\"name/16\",[14,37.377]],[\"comment/16\",[]],[\"name/17\",[15,37.377]],[\"comment/17\",[]],[\"name/18\",[16,37.377]],[\"comment/18\",[]],[\"name/19\",[17,37.377]],[\"comment/19\",[]],[\"name/20\",[18,37.377]],[\"comment/20\",[]],[\"name/21\",[19,28.904]],[\"comment/21\",[]],[\"name/22\",[20,37.377]],[\"comment/22\",[]],[\"name/23\",[21,37.377]],[\"comment/23\",[]],[\"name/24\",[22,37.377]],[\"comment/24\",[]],[\"name/25\",[23,37.377]],[\"comment/25\",[]],[\"name/26\",[24,37.377]],[\"comment/26\",[]],[\"name/27\",[25,37.377]],[\"comment/27\",[]],[\"name/28\",[19,28.904]],[\"comment/28\",[]],[\"name/29\",[26,32.268]],[\"comment/29\",[]],[\"name/30\",[10,32.268]],[\"comment/30\",[]],[\"name/31\",[27,37.377]],[\"comment/31\",[]],[\"name/32\",[28,37.377]],[\"comment/32\",[]],[\"name/33\",[29,37.377]],[\"comment/33\",[]],[\"name/34\",[19,28.904]],[\"comment/34\",[]],[\"name/35\",[30,37.377]],[\"comment/35\",[]],[\"name/36\",[31,37.377]],[\"comment/36\",[]],[\"name/37\",[32,37.377]],[\"comment/37\",[]],[\"name/38\",[33,37.377]],[\"comment/38\",[]],[\"name/39\",[34,37.377]],[\"comment/39\",[]],[\"name/40\",[35,37.377]],[\"comment/40\",[]],[\"name/41\",[36,37.377]],[\"comment/41\",[]],[\"name/42\",[37,37.377]],[\"comment/42\",[]],[\"name/43\",[26,32.268]],[\"comment/43\",[]],[\"name/44\",[38,37.377]],[\"comment/44\",[]],[\"name/45\",[39,37.377]],[\"comment/45\",[]],[\"name/46\",[40,37.377]],[\"comment/46\",[]],[\"name/47\",[41,37.377]],[\"comment/47\",[]],[\"name/48\",[42,37.377]],[\"comment/48\",[]],[\"name/49\",[43,37.377]],[\"comment/49\",[]],[\"name/50\",[44,37.377]],[\"comment/50\",[]],[\"name/51\",[45,37.377]],[\"comment/51\",[]],[\"name/52\",[46,37.377]],[\"comment/52\",[]],[\"name/53\",[47,37.377]],[\"comment/53\",[]],[\"name/54\",[48,37.377]],[\"comment/54\",[]],[\"name/55\",[49,37.377]],[\"comment/55\",[]],[\"name/56\",[50,37.377]],[\"comment/56\",[]],[\"name/57\",[51,37.377]],[\"comment/57\",[]],[\"name/58\",[52,37.377]],[\"comment/58\",[]],[\"name/59\",[53,37.377]],[\"comment/59\",[]],[\"name/60\",[54,37.377]],[\"comment/60\",[]],[\"name/61\",[55,37.377]],[\"comment/61\",[]]],\"invertedIndex\":[[\"__type\",{\"_index\":35,\"name\":{\"40\":{}},\"comment\":{}}],[\"api\",{\"_index\":6,\"name\":{\"7\":{}},\"comment\":{}}],[\"apiinfo\",{\"_index\":5,\"name\":{\"6\":{}},\"comment\":{}}],[\"assetnotfound\",{\"_index\":44,\"name\":{\"50\":{}},\"comment\":{}}],[\"assetstransferapi\",{\"_index\":0,\"name\":{\"0\":{},\"1\":{}},\"comment\":{}}],[\"baseerrorsenum\",{\"_index\":41,\"name\":{\"47\":{}},\"comment\":{}}],[\"constructapipromise\",{\"_index\":4,\"name\":{\"5\":{},\"10\":{}},\"comment\":{}}],[\"constructedformat\",{\"_index\":20,\"name\":{\"22\":{}},\"comment\":{}}],[\"createtransfertransaction\",{\"_index\":1,\"name\":{\"2\":{}},\"comment\":{}}],[\"decodeextrinsic\",{\"_index\":3,\"name\":{\"4\":{}},\"comment\":{}}],[\"dest\",{\"_index\":24,\"name\":{\"26\":{}},\"comment\":{}}],[\"direction\",{\"_index\":10,\"name\":{\"12\":{},\"30\":{}},\"comment\":{}}],[\"disabledoption\",{\"_index\":55,\"name\":{\"61\":{}},\"comment\":{}}],[\"errors/baseerror\",{\"_index\":40,\"name\":{\"46\":{}},\"comment\":{}}],[\"fetchfeeinfo\",{\"_index\":2,\"name\":{\"3\":{}},\"comment\":{}}],[\"format\",{\"_index\":19,\"name\":{\"21\":{},\"28\":{},\"34\":{}},\"comment\":{}}],[\"internalerror\",{\"_index\":53,\"name\":{\"59\":{}},\"comment\":{}}],[\"invalidaddress\",{\"_index\":54,\"name\":{\"60\":{}},\"comment\":{}}],[\"invalidasset\",{\"_index\":43,\"name\":{\"49\":{}},\"comment\":{}}],[\"invaliddirection\",{\"_index\":47,\"name\":{\"53\":{}},\"comment\":{}}],[\"invalidinput\",{\"_index\":42,\"name\":{\"48\":{}},\"comment\":{}}],[\"invalidmultilocationasset\",{\"_index\":48,\"name\":{\"54\":{}},\"comment\":{}}],[\"invalidpallet\",{\"_index\":45,\"name\":{\"51\":{}},\"comment\":{}}],[\"invalidxcmversion\",{\"_index\":51,\"name\":{\"57\":{}},\"comment\":{}}],[\"islimited\",{\"_index\":33,\"name\":{\"38\":{}},\"comment\":{}}],[\"keepalive\",{\"_index\":38,\"name\":{\"44\":{}},\"comment\":{}}],[\"localtransfertypes\",{\"_index\":21,\"name\":{\"23\":{}},\"comment\":{}}],[\"method\",{\"_index\":27,\"name\":{\"31\":{}},\"comment\":{}}],[\"methods\",{\"_index\":22,\"name\":{\"24\":{}},\"comment\":{}}],[\"multiplenonuniqueassetsfound\",{\"_index\":49,\"name\":{\"55\":{}},\"comment\":{}}],[\"notimplemented\",{\"_index\":52,\"name\":{\"58\":{}},\"comment\":{}}],[\"origin\",{\"_index\":25,\"name\":{\"27\":{}},\"comment\":{}}],[\"palletnotfound\",{\"_index\":46,\"name\":{\"52\":{}},\"comment\":{}}],[\"paratopara\",{\"_index\":14,\"name\":{\"16\":{}},\"comment\":{}}],[\"paratorelay\",{\"_index\":15,\"name\":{\"17\":{}},\"comment\":{}}],[\"paratosystem\",{\"_index\":16,\"name\":{\"18\":{}},\"comment\":{}}],[\"payswithfeedest\",{\"_index\":31,\"name\":{\"36\":{}},\"comment\":{}}],[\"payswithfeeorigin\",{\"_index\":30,\"name\":{\"35\":{}},\"comment\":{}}],[\"proofsize\",{\"_index\":37,\"name\":{\"42\":{}},\"comment\":{}}],[\"reftime\",{\"_index\":36,\"name\":{\"41\":{}},\"comment\":{}}],[\"registrynotfound\",{\"_index\":50,\"name\":{\"56\":{}},\"comment\":{}}],[\"relaytopara\",{\"_index\":18,\"name\":{\"20\":{}},\"comment\":{}}],[\"relaytosystem\",{\"_index\":17,\"name\":{\"19\":{}},\"comment\":{}}],[\"safexcmversion\",{\"_index\":8,\"name\":{\"9\":{}},\"comment\":{}}],[\"sendersaddr\",{\"_index\":32,\"name\":{\"37\":{}},\"comment\":{}}],[\"specname\",{\"_index\":7,\"name\":{\"8\":{}},\"comment\":{}}],[\"systemtopara\",{\"_index\":11,\"name\":{\"13\":{}},\"comment\":{}}],[\"systemtorelay\",{\"_index\":12,\"name\":{\"14\":{}},\"comment\":{}}],[\"systemtosystem\",{\"_index\":13,\"name\":{\"15\":{}},\"comment\":{}}],[\"transferargsopts\",{\"_index\":29,\"name\":{\"33\":{}},\"comment\":{}}],[\"transferliquidtoken\",{\"_index\":39,\"name\":{\"45\":{}},\"comment\":{}}],[\"tx\",{\"_index\":28,\"name\":{\"32\":{}},\"comment\":{}}],[\"txresult\",{\"_index\":23,\"name\":{\"25\":{}},\"comment\":{}}],[\"types\",{\"_index\":9,\"name\":{\"11\":{}},\"comment\":{}}],[\"weightlimit\",{\"_index\":34,\"name\":{\"39\":{}},\"comment\":{}}],[\"xcmversion\",{\"_index\":26,\"name\":{\"29\":{},\"43\":{}},\"comment\":{}}]],\"pipeline\":[]}}"); \ No newline at end of file diff --git a/docs/classes/AssetsTransferApi.html b/docs/classes/AssetsTransferApi.AssetsTransferApi.html similarity index 56% rename from docs/classes/AssetsTransferApi.html rename to docs/classes/AssetsTransferApi.AssetsTransferApi.html index 62b64084..2c5c9280 100644 --- a/docs/classes/AssetsTransferApi.html +++ b/docs/classes/AssetsTransferApi.AssetsTransferApi.html @@ -12,12 +12,15 @@

Holds open an api connection to a specified chain within the ApiPromise in order to help construct transactions for assets and estimating fees.

+
import { AssetsTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'

const main = () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://some_ws_url');
const assetsApi = new AssetsTransferApi(api, specName, safeXcmVersion);
} +
@@ -25,7 +28,7 @@

Hierarchy

  • AssetsTransferApi
+
  • Defined in AssetsTransferApi.ts:77
  • @@ -33,25 +36,27 @@

    Methods

      - +
    • Create an asset transfer transaction. This can be either locally on a systems parachain or relay chain, or between chains using xcm.

      +
      import { TxResult } from '@substrate/asset-transfer-api'

      let callInfo: TxResult<'call'>;
      try {
      callInfo = await assetsApi.createTransferTransaction(
      '1000',
      '5EWNeodpcQ6iYibJ3jmWVe85nsok1EDG8Kk3aFg8ZzpfY1qX',
      ['WND'],
      ['1000000000000'],
      {
      format: 'call',
      isLimited: true,
      xcmVersion: 2,
      }
      )
      } catch (e) {
      console.error(e);
      throw Error(e);
      } +

      Type Parameters

      +

      T extends Format

    Parameters

      @@ -76,26 +81,28 @@
      amounts:
  • -
    opts: TransferArgsOpts<T> = {}
    +
    opts: TransferArgsOpts<T> = {}

    Options

  • -

    Returns Promise<TxResult<T>>

    +

    Returns Promise<TxResult<T>>

    +
  • Defined in AssetsTransferApi.ts:124
  • Parameters

    +
  • Defined in AssetsTransferApi.ts:506
    • Fetch estimated fee information for an extrinsic

      +
      const feeInfo = assetApi.fetchFeeInfo(tx, 'call');
      console.log(feeInfo.toJSON()); +

      Type Parameters

      +

      T extends Format

    Parameters

    +
  • Defined in AssetsTransferApi.ts:460
  • +
  • +
    AssetsTransferApi +
  • +
  • constructApiPromise
  • +
  • errors/BaseError
  • +
  • types
  • \ No newline at end of file diff --git a/docs/enums/errors_BaseError.BaseErrorsEnum.html b/docs/enums/errors_BaseError.BaseErrorsEnum.html new file mode 100644 index 00000000..a93c630a --- /dev/null +++ b/docs/enums/errors_BaseError.BaseErrorsEnum.html @@ -0,0 +1,205 @@ +BaseErrorsEnum | @substrate/asset-transfer-api - v0.1.0-beta.5
    +
    + +
    +
    +
    + +
    +

    Errors that may be returned by the API.

    +
    +
    +
    +
    +
    + +
    +
    +

    Enumeration Members

    +
    + +
    AssetNotFound: "AssetNotFound"
    +

    Not able to find the asset.

    +
    +
    +
    + +
    DisabledOption: "DisabledOption"
    +

    The following option is disabled given the inputs.

    +
    +
    +
    + +
    InternalError: "InternalError"
    +

    An issue has happened internally.

    +
    +
    +
    + +
    InvalidAddress: "InvalidAddress"
    +

    The inputted address is invalid.

    +
    +
    +
    + +
    InvalidAsset: "InvalidAsset"
    +

    The inputted asset is incorrect or invalid, and does not exist given the surrounding specs. +This exlcudes MultiLocation assets which are handled using InvalidMultiLocationAsset.

    +
    +
    +
    + +
    InvalidDirection: "InvalidDirection"
    +

    The direction in which these assets are going to be sent is incorrect.

    +
    +
    +
    + +
    InvalidInput: "InvalidInput"
    +

    An input or lack of input to any public facing function by the user is incorrect, and or invalid. +This may include using options incorrectly.

    +
    +
    +
    + +
    InvalidMultiLocationAsset: "InvalidMultiLocationAsset"
    +

    The inputted multilocation is incorrect.

    +
    +
    +
    + +
    InvalidPallet: "InvalidPallet"
    +

    The following pallet does not support the method to be used.

    +
    +
    +
    + +
    InvalidXcmVersion: "InvalidXcmVersion"
    +

    The xcm version is invalid.

    +
    +
    +
    + +
    MultipleNonUniqueAssetsFound: "MultipleNonUniqueAssetsFound"
    +

    Multiple assets have been found for a single token symbol.

    +
    +
    +
    + +
    NotImplemented: "NotImplemented"
    +

    Not Implemented yet.

    +
    +
    +
    + +
    PalletNotFound: "PalletNotFound"
    +

    The following pallet is not found.

    +
    +
    +
    + +
    RegistryNotFound: "RegistryNotFound"
    +

    Not able to find the pertinent registry to gather certain information. This can refer to xcAssets.

    +
    +
    +
    +
    \ No newline at end of file diff --git a/docs/enums/Direction.html b/docs/enums/types.Direction.html similarity index 66% rename from docs/enums/Direction.html rename to docs/enums/types.Direction.html index 180133fc..39e479e9 100644 --- a/docs/enums/Direction.html +++ b/docs/enums/types.Direction.html @@ -12,15 +12,16 @@

    The direction of the cross chain transfer. This only concerns XCM transactions.

    +
  • Defined in types.ts:25
  • @@ -28,14 +29,14 @@

    Enumeration Members

    @@ -46,7 +47,7 @@
    +
  • Defined in types.ts:41
  • ParaToRelay: "ParaToRelay"
    @@ -54,7 +55,7 @@
    +
  • Defined in types.ts:45
  • ParaToSystem: "ParaToSystem"
    @@ -62,7 +63,7 @@
    +
  • Defined in types.ts:49
  • RelayToPara: "RelayToPara"
    @@ -70,7 +71,7 @@
    +
  • Defined in types.ts:57
  • RelayToSystem: "RelayToSystem"
    @@ -78,7 +79,7 @@
    +
  • Defined in types.ts:53
  • SystemToPara: "SystemToPara"
    @@ -86,7 +87,7 @@
    +
  • Defined in types.ts:29
  • SystemToRelay: "SystemToRelay"
    @@ -94,7 +95,7 @@
    +
  • Defined in types.ts:33
  • SystemToSystem: "SystemToSystem"
    @@ -102,7 +103,7 @@
    +
  • Defined in types.ts:37
  • +
  • AssetsTransferApi
  • +
  • constructApiPromise
  • +
  • errors/BaseError
  • +
  • +
    types +
  • \ No newline at end of file diff --git a/docs/functions/constructApiPromise.html b/docs/functions/constructApiPromise.constructApiPromise.html similarity index 54% rename from docs/functions/constructApiPromise.html rename to docs/functions/constructApiPromise.constructApiPromise.html index 0012872e..8fb2495e 100644 --- a/docs/functions/constructApiPromise.html +++ b/docs/functions/constructApiPromise.constructApiPromise.html @@ -12,14 +12,17 @@
      - +
    • -

      Construct an Polkadot-js ApiPromise, and and retrieve the specName of the chain

      +

      Construct an Polkadot-js ApiPromise, and and retrieve the specName of the chain.

      +
      import { constructApiPromise } from '@substrate/asset-transfer-api';

      const { api, specName, safeXcmVersion } = constructApiPromise('wss://some_ws_url'); +

      Parameters

      @@ -34,10 +37,10 @@
      opts:

      ApiOptions

    -

    Returns Promise<ApiInfo>

    +

    Returns Promise<ApiInfo>

    +
  • Defined in constructApiPromise.ts:39
  • +
  • AssetsTransferApi
  • +
  • +
    constructApiPromise +
  • +
  • errors/BaseError
  • +
  • types
  • \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 76520387..b0809dd4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -188,16 +188,10 @@

    Running Zombienet
  • Create an asset
  • +
  • AssetsTransferApi
  • +
  • constructApiPromise
  • +
  • errors/BaseError
  • +
  • types
  • \ No newline at end of file diff --git a/docs/interfaces/ApiInfo.html b/docs/interfaces/ApiInfo.html deleted file mode 100644 index 13a88d86..00000000 --- a/docs/interfaces/ApiInfo.html +++ /dev/null @@ -1,54 +0,0 @@ -ApiInfo | @substrate/asset-transfer-api - v0.1.0-beta.5
    -
    - -
    -
    -
    -
    - -

    Interface ApiInfo

    -
    -

    the api promise, specName and safeXcmVersion for the currently connected rpc endpoint

    -
    -
    -
    -

    Hierarchy

    -
      -
    • ApiInfo
    -
    -
    \ No newline at end of file diff --git a/docs/interfaces/constructApiPromise.ApiInfo.html b/docs/interfaces/constructApiPromise.ApiInfo.html new file mode 100644 index 00000000..b646ad99 --- /dev/null +++ b/docs/interfaces/constructApiPromise.ApiInfo.html @@ -0,0 +1,98 @@ +ApiInfo | @substrate/asset-transfer-api - v0.1.0-beta.5
    +
    + +
    +
    +
    + +
    +

    Return value for constructApiPromise

    +
    +
    +
    +

    Hierarchy

    +
      +
    • ApiInfo
    +
    +
    +
    + +
    +
    +

    Properties

    +
    +
    +

    Properties

    +
    + +
    api: ApiPromise
    +

    Polkadot-js ApiPromise

    +
    +
    +
    + +
    safeXcmVersion: number
    +

    SafeXcmVersion for the chain which the api is connected too.

    +
    +
    +
    + +
    specName: string
    +

    SpecName of the chain which the api is connected too.

    +
    +
    +
    + +
    +
    \ No newline at end of file diff --git a/docs/interfaces/TransferArgsOpts.html b/docs/interfaces/types.TransferArgsOpts.html similarity index 71% rename from docs/interfaces/TransferArgsOpts.html rename to docs/interfaces/types.TransferArgsOpts.html index c445e5d6..5907864a 100644 --- a/docs/interfaces/TransferArgsOpts.html +++ b/docs/interfaces/types.TransferArgsOpts.html @@ -12,8 +12,9 @@

    The TransferArgsOpts are the options passed into createTransferTransaction.

    @@ -23,13 +24,13 @@

    Interface TransferArgsOpts<T>

    Type Parameters

    +

    T extends Format

    Hierarchy

    • TransferArgsOpts
    +
  • Defined in types.ts:158
  • @@ -37,15 +38,15 @@

    Properties

    @@ -59,7 +60,7 @@
    +
  • Defined in types.ts:166
  • isLimited?: boolean
    @@ -68,7 +69,7 @@
    +
  • Defined in types.ts:186
  • keepAlive?: boolean
    @@ -77,7 +78,7 @@
    +
  • Defined in types.ts:213
  • paysWithFeeDest?: string
    @@ -85,7 +86,7 @@
    +
  • Defined in types.ts:176
  • paysWithFeeOrigin?: string
    @@ -95,7 +96,7 @@
    +
  • Defined in types.ts:172
  • sendersAddr?: string
    @@ -104,7 +105,7 @@
    +
  • Defined in types.ts:181
  • transferLiquidToken?: boolean
    @@ -113,7 +114,7 @@
    +
  • Defined in types.ts:218
  • weightLimit?: {
        proofSize?: string;
        refTime?: string;
    }
    @@ -137,7 +138,7 @@
    Optional
    +
  • Defined in types.ts:191
  • xcmVersion?: number
    @@ -146,7 +147,7 @@
    +
  • Defined in types.ts:208
  • +
  • AssetsTransferApi
  • +
  • constructApiPromise
  • +
  • errors/BaseError
  • +
  • +
    types +
  • \ No newline at end of file diff --git a/docs/interfaces/TxResult.html b/docs/interfaces/types.TxResult.html similarity index 63% rename from docs/interfaces/TxResult.html rename to docs/interfaces/types.TxResult.html index bb2e206c..8c5cee97 100644 --- a/docs/interfaces/TxResult.html +++ b/docs/interfaces/types.TxResult.html @@ -12,8 +12,9 @@

    The TxResult is the result of constructing a transaction. @@ -30,7 +31,7 @@

    Hierarchy

    • TxResult
    +
  • Defined in types.ts:124
  • @@ -38,13 +39,13 @@

    Properties

    @@ -55,31 +56,31 @@
    +
  • Defined in types.ts:128
  • -
    direction: "local" | Direction
    +
    direction: "local" | Direction

    Description

    The direction of the cross chain transfer.

    +
  • Defined in types.ts:144
  • -
    format: Format | "local"
    +
    format: Format | "local"

    Description

    The format type the tx is ouputted in.

    +
  • Defined in types.ts:136
  • -
    method: Methods
    +
    method: Methods

    Description

    The method used in the transaction.

    +
  • Defined in types.ts:148
  • origin: string
    @@ -87,15 +88,15 @@
    +
  • Defined in types.ts:132
  • - +

    Description

    The constructed transaction.

    +
  • Defined in types.ts:152
  • xcmVersion: null | number
    @@ -103,7 +104,7 @@

    The xcm version that was used to construct the tx.

    +
  • Defined in types.ts:140
  • +
  • AssetsTransferApi
  • +
  • constructApiPromise
  • +
  • errors/BaseError
  • +
  • +
    types +
  • \ No newline at end of file diff --git a/docs/modules.html b/docs/modules.html deleted file mode 100644 index 7e444ec2..00000000 --- a/docs/modules.html +++ /dev/null @@ -1,69 +0,0 @@ -@substrate/asset-transfer-api - v0.1.0-beta.5
    -
    - -
    -
    -
    -
    -

    @substrate/asset-transfer-api - v0.1.0-beta.5

    -
    -
    -

    Index

    -
    -

    Enumerations

    -
    -
    -

    Classes

    -
    -
    -

    Interfaces

    -
    -
    -

    Type Aliases

    -
    -
    -

    Functions

    -
    -
    -
    \ No newline at end of file diff --git a/docs/modules/AssetsTransferApi.html b/docs/modules/AssetsTransferApi.html new file mode 100644 index 00000000..e0b67c35 --- /dev/null +++ b/docs/modules/AssetsTransferApi.html @@ -0,0 +1,51 @@ +AssetsTransferApi | @substrate/asset-transfer-api - v0.1.0-beta.5
    +
    + +
    +
    +
    +
    + +

    Module AssetsTransferApi

    +
    +
    +

    Index

    +
    +

    Classes

    +
    +
    + +
    +
    \ No newline at end of file diff --git a/docs/modules/constructApiPromise.html b/docs/modules/constructApiPromise.html new file mode 100644 index 00000000..72e021e9 --- /dev/null +++ b/docs/modules/constructApiPromise.html @@ -0,0 +1,56 @@ +constructApiPromise | @substrate/asset-transfer-api - v0.1.0-beta.5
    +
    + +
    +
    +
    +
    + +

    Module constructApiPromise

    +
    +
    +

    Index

    +
    +

    Interfaces

    +
    +
    +

    Functions

    +
    +
    + +
    +
    \ No newline at end of file diff --git a/docs/modules/errors_BaseError.html b/docs/modules/errors_BaseError.html new file mode 100644 index 00000000..ebaf4e39 --- /dev/null +++ b/docs/modules/errors_BaseError.html @@ -0,0 +1,51 @@ +errors/BaseError | @substrate/asset-transfer-api - v0.1.0-beta.5
    +
    + +
    +
    +
    +
    + +

    Module errors/BaseError

    +
    +
    +

    Index

    +
    +

    Enumerations

    +
    +
    + +
    +
    \ No newline at end of file diff --git a/docs/modules/types.html b/docs/modules/types.html new file mode 100644 index 00000000..dcc2d698 --- /dev/null +++ b/docs/modules/types.html @@ -0,0 +1,69 @@ +types | @substrate/asset-transfer-api - v0.1.0-beta.5
    +
    + +
    +
    +
    + +
    +
    +

    Index

    +
    +

    Enumerations

    +
    +
    +

    Interfaces

    +
    +
    +

    Type Aliases

    +
    +
    +
    \ No newline at end of file diff --git a/docs/types/Methods.html b/docs/types/Methods.html deleted file mode 100644 index 9d7b8997..00000000 --- a/docs/types/Methods.html +++ /dev/null @@ -1,50 +0,0 @@ -Methods | @substrate/asset-transfer-api - v0.1.0-beta.5
    -
    - -
    -
    -
    -
    - -

    Type alias Methods

    -
    Methods: LocalTransferTypes | "reserveTransferAssets" | "limitedReserveTransferAssets" | "teleportAssets" | "limitedTeleportAssets" | "transferMultiAsset" | "transferMultiAssets" | "transferMultiAssetWithFee"
    -

    The Methods are the collections of methods the API will use to construct a transaction.

    -
    -
    -
    -
    \ No newline at end of file diff --git a/docs/types/ConstructedFormat.html b/docs/types/types.ConstructedFormat.html similarity index 62% rename from docs/types/ConstructedFormat.html rename to docs/types/types.ConstructedFormat.html index 54903612..1ff30220 100644 --- a/docs/types/ConstructedFormat.html +++ b/docs/types/types.ConstructedFormat.html @@ -12,8 +12,9 @@
    ConstructedFormat<T>: T extends "payload"
        ? `0x${string}`
        : T extends "call"
            ? `0x${string}`
            : T extends "submittable"
                ? SubmittableExtrinsic<"promise", ISubmittableResult>
                : never

    The Format types possible for a constructed transaction.

    @@ -25,7 +26,7 @@

    Type Parameters

    T

    +
  • Defined in types.ts:81
  • +
  • AssetsTransferApi
  • +
  • constructApiPromise
  • +
  • errors/BaseError
  • +
  • +
    types +
  • \ No newline at end of file diff --git a/docs/types/Format.html b/docs/types/types.Format.html similarity index 56% rename from docs/types/Format.html rename to docs/types/types.Format.html index b5ee5ed7..cc1fa0c9 100644 --- a/docs/types/Format.html +++ b/docs/types/types.Format.html @@ -12,8 +12,9 @@
    Format: "payload" | "call" | "submittable"

    AssetTransferApi supports three formats to be returned:

    @@ -25,7 +26,7 @@

    Type alias Format

    +
  • Defined in types.ts:76
  • +
  • AssetsTransferApi
  • +
  • constructApiPromise
  • +
  • errors/BaseError
  • +
  • +
    types +
  • \ No newline at end of file diff --git a/docs/types/LocalTransferTypes.html b/docs/types/types.LocalTransferTypes.html similarity index 58% rename from docs/types/LocalTransferTypes.html rename to docs/types/types.LocalTransferTypes.html index ad51d494..94d68ce3 100644 --- a/docs/types/LocalTransferTypes.html +++ b/docs/types/types.LocalTransferTypes.html @@ -12,15 +12,16 @@
    LocalTransferTypes: "assets::transfer" | "assets::transferKeepAlive" | "foreignAssets::transfer" | "foreignAssets::transferKeepAlive" | "balances::transfer" | "balances::transferKeepAlive" | "poolAssets::transfer" | "poolAssets::transferKeepAlive"

    The types of local transactions the api can construct.

    +
  • Defined in types.ts:92
  • +
  • AssetsTransferApi
  • +
  • constructApiPromise
  • +
  • errors/BaseError
  • +
  • +
    types +
  • \ No newline at end of file diff --git a/docs/types/types.Methods.html b/docs/types/types.Methods.html new file mode 100644 index 00000000..07c4d5b4 --- /dev/null +++ b/docs/types/types.Methods.html @@ -0,0 +1,55 @@ +Methods | @substrate/asset-transfer-api - v0.1.0-beta.5
    +
    + +
    +
    +
    +
    + +

    Type alias Methods

    +
    Methods: LocalTransferTypes | "reserveTransferAssets" | "limitedReserveTransferAssets" | "teleportAssets" | "limitedTeleportAssets" | "transferMultiAsset" | "transferMultiAssets" | "transferMultiAssetWithFee"
    +

    The Methods are the collections of methods the API will use to construct a transaction.

    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/AssetsTransferApi.ts b/src/AssetsTransferApi.ts index bb06b8ba..c012f671 100644 --- a/src/AssetsTransferApi.ts +++ b/src/AssetsTransferApi.ts @@ -60,6 +60,15 @@ import { validateNumber } from './validate'; * Holds open an api connection to a specified chain within the ApiPromise in order to help * construct transactions for assets and estimating fees. * + * ```ts + * import { AssetsTransferApi, constructApiPromise } from '@substrate/asset-transfer-api' + * + * const main = () => { + * const { api, specName, safeXcmVersion } = await constructApiPromise('wss://some_ws_url'); + * const assetsApi = new AssetsTransferApi(api, specName, safeXcmVersion); + * } + * ``` + * * @constructor api ApiPromise provided by Polkadot-js * @constructor specName The specName of the provided chains api * @constructor safeXcmVersion The safeXcmVersion of the chain. @@ -84,6 +93,28 @@ export class AssetsTransferApi { * Create an asset transfer transaction. This can be either locally on a systems parachain or relay chain, * or between chains using xcm. * + * ```ts + * import { TxResult } from '@substrate/asset-transfer-api' + * + * let callInfo: TxResult<'call'>; + * try { + * callInfo = await assetsApi.createTransferTransaction( + * '1000', + * '5EWNeodpcQ6iYibJ3jmWVe85nsok1EDG8Kk3aFg8ZzpfY1qX', + * ['WND'], + * ['1000000000000'], + * { + * format: 'call', + * isLimited: true, + * xcmVersion: 2, + * } + * ) + * } catch (e) { + * console.error(e); + * throw Error(e); + * } + * ``` + * * @param destChainId ID of the destination (para) chain (‘0’ for Relaychain) * @param destAddr Address of destination account * @param assetIds Array of assetId's to be transferred @@ -418,6 +449,11 @@ export class AssetsTransferApi { /** * Fetch estimated fee information for an extrinsic * + * ```ts + * const feeInfo = assetApi.fetchFeeInfo(tx, 'call'); + * console.log(feeInfo.toJSON()); + * ``` + * * @param tx a payload, call or submittable * @param format The format the tx is in */ @@ -456,7 +492,46 @@ export class AssetsTransferApi { return null; } + /** + * Decodes the hex of an extrinsic into a string readable format. + * + * ```ts + * const decodedExt = assetsApi.decodeExtrinsic(tx, 'call'); + * console.log(JSON.parse(decodedExt)); + * ``` + * + * @param encodedTransaction the hex of an extrinsic tx + * @param format The format the tx is in + */ + public decodeExtrinsic(encodedTransaction: string, format: T): string { + const { _api } = this; + const fmt = format ? format : 'payload'; + + if (fmt === 'payload') { + const extrinsicPayload = _api.registry.createType('ExtrinsicPayload', encodedTransaction, { + version: EXTRINSIC_VERSION, + }); + + const call = _api.registry.createType('Call', extrinsicPayload.method); + const decodedMethodInfo = JSON.stringify(call.toHuman()); + + return decodedMethodInfo; + } else if (fmt === 'call') { + const call = _api.registry.createType('Call', encodedTransaction); + + const decodedMethodInfo = JSON.stringify(call.toHuman()); + + return decodedMethodInfo; + } else if (fmt === 'submittable') { + const extrinsic = _api.registry.createType('Extrinsic', encodedTransaction); + + const decodedMethodInfo = JSON.stringify(extrinsic.method.toHuman()); + + return decodedMethodInfo; + } + return ''; + } /** * Declare the direction of the xcm message. * @@ -700,42 +775,6 @@ export class AssetsTransferApi { return AssetCallType.Reserve; } - /** - * Decodes the hex of an extrinsic into a string readable format - * - * @param encodedTransaction the hex of an extrinsic tx - * @param format The format the tx is in - */ - public decodeExtrinsic(encodedTransaction: string, format: T): string { - const { _api } = this; - const fmt = format ? format : 'payload'; - - if (fmt === 'payload') { - const extrinsicPayload = _api.registry.createType('ExtrinsicPayload', encodedTransaction, { - version: EXTRINSIC_VERSION, - }); - - const call = _api.registry.createType('Call', extrinsicPayload.method); - const decodedMethodInfo = JSON.stringify(call.toHuman()); - - return decodedMethodInfo; - } else if (fmt === 'call') { - const call = _api.registry.createType('Call', encodedTransaction); - - const decodedMethodInfo = JSON.stringify(call.toHuman()); - - return decodedMethodInfo; - } else if (fmt === 'submittable') { - const extrinsic = _api.registry.createType('Extrinsic', encodedTransaction); - - const decodedMethodInfo = JSON.stringify(extrinsic.method.toHuman()); - - return decodedMethodInfo; - } - - return ''; - } - /** * returns an ExtrinsicPayload * diff --git a/src/constructApiPromise.ts b/src/constructApiPromise.ts index fc8cedb5..e1f46461 100644 --- a/src/constructApiPromise.ts +++ b/src/constructApiPromise.ts @@ -7,16 +7,31 @@ import { WsProvider } from '@polkadot/rpc-provider'; import { fetchSafeXcmVersion } from './createXcmCalls/util/fetchSafeXcmVersion'; /** - * the api promise, specName and safeXcmVersion for the currently connected rpc endpoint + * Return value for `constructApiPromise` */ export interface ApiInfo { + /** + * Polkadot-js ApiPromise + */ api: ApiPromise; + /** + * SpecName of the chain which the api is connected to. + */ specName: string; + /** + * SafeXcmVersion for the chain which the api is connected too. + */ safeXcmVersion: number; } /** - * Construct an Polkadot-js ApiPromise, and and retrieve the specName of the chain + * Construct a Polkadot-js ApiPromise, and retrieve the specName of the chain. + * + * ```ts + * import { constructApiPromise } from '@substrate/asset-transfer-api'; + * + * const { api, specName, safeXcmVersion } = constructApiPromise('wss://some_ws_url'); + * ``` * * @param wsUrl WebSocket Url to connect to. * @param opts ApiOptions diff --git a/typedoc.config.cjs b/typedoc.config.cjs index 9a6ae301..a237fca1 100644 --- a/typedoc.config.cjs +++ b/typedoc.config.cjs @@ -1,6 +1,9 @@ module.exports = { entryPoints: [ - './src/index.ts', + './src/AssetsTransferApi.ts', + './src/constructApiPromise.ts', + './src/types.ts', + './src/errors/BaseError.ts' ], plugin: ["typedoc-theme-hierarchy"], exclude: [