{"_id":"ternoa-js","_rev":"113-2ac536e7b3dc75d48c887d5d5d09c0da","name":"ternoa-js","dist-tags":{"latest":"1.6.5","alpha":"1.6.6-alpha1","next":"1.6.2-rc0"},"versions":{"0.0.0":{"name":"ternoa-js","version":"0.0.0","description":"Ternoa library of function to interact with the blockchain and manipulate transactions","main":"build/src/index.ts","scripts":{"start":"ts-node index.ts","dev":"nodemon index.ts","build":"tsc --project ./","format":"prettier --write \"src/**/*.ts\"","lint":"eslint -c .eslintrc","test":"jest --config jestconfig.json"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@types/jest":"^27.4.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"gitHead":"9414de6ca1da1d77f14fb465d572a0075820a6f9","_id":"ternoa-js@0.0.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-cW626PSZVGWzJCvb2Ej/siKaI93OETyfhQFqkI73z27DuhSD5FyfCnWkf+EQVRdjzIaaD+cpwkfi9OwsyDHsJQ==","shasum":"552d297d5d697671ec45e5ec129bc0133bfc5283","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.0.tgz","fileCount":6,"unpackedSize":2146,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiJ1yuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp4dBAAjJcXcy81T72JU1L1KJyNzd1qqeeWlfB+jlc5/qHWy9mT5ONf\r\n0b+S0p06uj5h+mEY8gIhqQ0gaGUnY1fgPWH8p5oV9+CCtU62NEl+nsocCy7l\r\nus4jp4DDUES8xgvVFeEsmYfPAx2DlBYzBrXRVM/NF06Kbj6uxrwT9QfRHlUd\r\nJWm3lEdT/3vph39eyoVA3dt02jLypN9CLw94I/YqXQLqv0s8LYWDBk6CBW3A\r\nYeh/UbkdpbRC5WJFqvNWIv19CZKe4ZdNFkZvjrKTq80+lAR18vAqVFQO1hSf\r\nHwlyv/ulLg6EfX9jtMo9bAzAdTCGIroQ53tSBE3O3VhkA5hyDZW2hNpAX4zx\r\n05p2EEgiVv2+ZjsKvJIvq+pLtaoy7XMSqY+hKROaMWWPL7haqJkwcbpl4Pyz\r\n8isuDdmxra9lfd1phbDojVtAsQuiNOqG19ZTmUadA/mb9wc/f4mhlmBV7qcU\r\nbI8/dgIRJwp64cLfwGX1S5WDEOTHYui3BQeyE5R+jZ5YXUJ0aiPwH+SFOCkJ\r\nw/Rw2nF/rAbHaLoq2aAPDnJBifQyfp0hZDvsOB48uLcdmPhNBduqCG1Q9xnf\r\nzIMO2C8zn5Uhf1jOE9rC7XOajUCmflTeQ+F4EuBLnscQZO3ZsCUy9H7aCp1o\r\n+k4KeZnpdsvwHqET+U8bJ2fREmQ5FFrDIDY=\r\n=XHH6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEK3djCFgWt/imtgSFfgFcSZ0mOGmySRoXuQr6yfLLfgAiEA73m5ziLcyQd57snfcz9agY+CR+pB6rY0kwTh/Ao47Yc="}]},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.0_1646746798375_0.6738206683849033"},"_hasShrinkwrap":false},"0.0.1":{"name":"ternoa-js","version":"0.0.1","description":"Ternoa library of function to interact with the blockchain and manipulate transactions","main":"build/index.js","types":"dist/index.d.ts","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"tsc","prepare":"npm run build","format":"prettier --write \"src/**/*.ts\"","lint":"eslint -c .eslintrc","test":"jest --config jestconfig.json"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@types/jest":"^27.4.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"gitHead":"9d7d996e2de06d489cbe24ba7c6dc9ac60b9704a","_id":"ternoa-js@0.0.1","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-h/M4xba9PF0gsRqUJtZziIkoNylKwmx0A7rycx5sGbY0W/aQ0a8G7oJwlSWKBLSiXRyjTL20zMFcKAtEaOa1rQ==","shasum":"5fbccfa540d19c0bc149b9d823c25f8538896c08","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.1.tgz","fileCount":6,"unpackedSize":2396,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiJ2S3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrdFQ//eDPld4f/XL1agOi0mRYuMwZMrIv5vSqwk96jNJhdIkxGFk2/\r\nKLm0UnM32lR+YAbURBG7i+Xa92ceLvVxlK46SLo8CrTqkkMo+7g/6Pdw29It\r\nwDPXBUKHvYQGLk2ArrybI5AgR772AkJTlVB7i1RvJJmN+2iqhAQUwGhsLkZP\r\n5ct+aJNBSiTK1khj578nZo8N1+sAd8B6EVuXgxXMtXEiKzT5+FxSZCOpyc4F\r\n2XAzLY/plzqn4X5j90WTQWTzP50jrUGb0nKjVFHfX9NXMPb/EbAyx7vQSs3H\r\np2LFjB8jeHGRp9HT0riVub6codEsvpROp2jvBgs7ttgVKl014+Rng1VPdZam\r\nYC82cJ+k6uPn7iRPvmai7AgUNZ5S0oOTrvZME+FgIvNM9DDSgoZZnAYZsTOY\r\nvvZ0hItOqt+ftmgAA8dZO/9/EsgQ19I2e6T5YgZdv2r8wQ4uYaa9C39v3SLp\r\npfFYz/ww4rHnlPBnahkqM07CYqfkP9AsSGBh1mgpxKXNWJQYUiZVvyJNDzaf\r\nuT3EskU/R7jS/DstfXnrWX0GP5UreOFQgIHIXHNnb9hxVrpygYqU8O6LDtZy\r\n/nBLSEzbPNM6+2W4tp0J30jisTFpndzd5hP1lQSbgRpCCQhp3U4zAS+ayKM9\r\nChcA2/3ssWFlGE/LLjxfVeMtgUB9boxB93U=\r\n=fi0i\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDnwT31VJruylckYUcAkDeyA8tlI3ZRgj+Of7EsLl1h5AiEA6aMfZ/UqSkT/g2U+yUX3hglxHDVvgC9n0z1ueHBD8dQ="}]},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.1_1646748855848_0.3446649566682136"},"_hasShrinkwrap":false},"0.0.2":{"name":"ternoa-js","version":"0.0.2","description":"Ternoa library of function to interact with the blockchain and manipulate transactions","main":"build/index.js","types":"build/index.d.ts","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"tsc","prepare":"npm run build","format":"prettier --write \"src/**/*.ts\"","lint":"eslint -c .eslintrc","test":"jest --config jestconfig.json"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@types/jest":"^27.4.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"gitHead":"d624b054e1498552064611d6be14c0b9e9983156","_id":"ternoa-js@0.0.2","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-mZdURQYTP3ENP27osJAFhUR17OVTOYfzri1UrTAyQMqzQNBunwt5JBOy+VI7kchk1U94FQvyM4oGHJe6dN3V0g==","shasum":"296daa6ce94e2e1ab186b01410cf574379d15567","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.2.tgz","fileCount":6,"unpackedSize":2397,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiJ2WNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo+CBAAmI107xvPM0gPeHr9RV3yD3wxbzWkswjE+2pWRuXat2udz2Gc\r\nBRB5bkK8o1Jq94oaqqtzwIlna/4/2E0vHBuw6PtLW/tnMQ5hIL3huYljKbwk\r\nImn+l5TpYk2uqq0ITylJaCU7gSxNlfu9Inu1EB4XNPO3FNaxWoEsDZm3YKge\r\nKt7T0IBn1fFfY8TlaL1Xvokd43LX1DeJtg/FNBR37hnuw/HO8alBsGszHFeT\r\nsXLg12WMU9pZfG8ZYpOIW1SDxKxrC/mdJ22+WjBTBPEiNiJoPCWfX9btGZA9\r\nWS8mVHkslLsw66Ajc7Q0B7oGauSxZDr9MSojVknr/YwEgmAFkj/2htW9/MzW\r\nNPfGYahMPGWcbI0A3nXPBTMKt4zdXrVE00gdmdRWU0ctTnQF4AZILfOXE9wO\r\nc7ZwWMYntJUTkDZ/PJZW00WpnA0KO3WaJygUpKNLAFnxyOAUdIxeCWLin/rf\r\nHSPnf5EN4F5HGRJUEyTfaj1rGpYZzj1rB8W2mYn+ASud7O6fDWRp7EPPREt/\r\nlq5AlD7ZaN9BP10e542TSNgrzxwFSuTmGqxSiW/Iq1MYfW5NFlnqvXUlP5go\r\nD1bPDD0+HBmp/JtNQ7spF5Hk3TNl2C81WNAV/7ZoH/8oUKesxEmrMGYZ8XW4\r\nyF+0CB8MUu0/nmVCZNwvitvkrovKFc+T0J4=\r\n=X9vl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIERIn5bm24MoCYkRDakZMErqCOYKUB/KssLnDtS307LKAiEAwhkI8c13kTcgyWeJQ6meBLpMpAlxza/ALJF/oF+HdYA="}]},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.2_1646749068929_0.1940769723360911"},"_hasShrinkwrap":false},"0.0.3":{"name":"ternoa-js","version":"0.0.3","description":"Ternoa library of function to interact with the blockchain and manipulate transactions","main":"build/index.js","types":"build/index.d.ts","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"tsc","lint":"eslint ./src --ext .js,.ts","format":"prettier --write \"src/**/*.ts\"","test":"jest --config jestconfig.json","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@babel/preset-env":"^7.16.11","@babel/preset-typescript":"^7.16.7","@types/jest":"^27.4.1","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","babel-jest":"^27.5.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","eslint-plugin-jest":"^26.1.1","husky":"^7.0.4","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"gitHead":"a8b195306b9fb30b38fdf800ab4de17428dbc7d7","_id":"ternoa-js@0.0.3","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-v+0niPBB9G5BmYNnyUoXReEnBQj8XnKRD4dejD8xcwIY/RyQoM6yRPXTNObfGLKtHP6UC/GQyIfdUcOJ/uVIOw==","shasum":"90187fcbbd302a224ee2a5813f36bd40c5bf2621","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.3.tgz","fileCount":28,"unpackedSize":42492,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiLwyoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoziRAAmuzqzZizK8y/74KBktU/vIh752NCvb++rSQFoUFCGaBaczFB\r\noXq6stVz2Pr/LaBG1hOA88dg3P1VmhDh9mlEousLFQPz9/u8UC2CjpthE89H\r\nPXl2VoqDBsYJpdcwdz5ZZP17YsrT41zgioax89MMyuGxBO2FxFTNuDCUOdxC\r\nidsIkFYzHDYtvnufc4vK01kerwcyVQLDEaxjb8sMt4IHTl2beoyKcXaAkD9u\r\nmeWlYeOe3JZX0c091I3mx6IuT7BwMJ/knKO5izxkIsBR1j2udPb7B5Aj/VJu\r\nGDc2Z2TEGjO74+UzDW4Dt8LkI2q/7Ij7NYhV9fic4Fr842Zfhy00ktc5BnvJ\r\ncBcYeJ7taTb2YNrcE70ZYR/nTnLQ7PIUfYSQRptY2PeUJsNdo3Y4OAC2Pkqq\r\n9CdZZT22yTyC0Aw3yRJvEsZ0kAvXNwk6J6LPN1SOeaZn7ACZ5C6da82GPt+f\r\ng6jtxnC6Wpv3cprLYx9woxmhCPsGgs+8qWLJLzwp6XAmBev/SP7kGpGe/k08\r\nAqgl8t+jie3balCJsvLsiml3ulckyqrWFXJoSVTtp3xwTTl1hhEH7QZog2jc\r\nNp57cZLY/D9U9F1+AlnZ07miQRIEWryGrCOiv2XTXbHdlNPzf8TbwtqGoNSo\r\nN+ceItrX/qaVbCZaCDNHmNE9SeFZmmOo29c=\r\n=DViP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICxh8deA/Kpmk/Rtc+UTy2jjp9LvuF/Ir9Jt43Dn9GwxAiEA0v1I9+ts7lF7CyU3t7X3VTifWUJTg3DhDaRa14SzJ8s="}]},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.3_1647250600742_0.9205544688215728"},"_hasShrinkwrap":false},"0.0.4":{"name":"ternoa-js","version":"0.0.4","description":"Ternoa library of function to interact with the blockchain and manipulate transactions","main":"build/index.js","types":"build/index.d.ts","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"tsc","lint":"eslint ./src --ext .js,.ts","format":"prettier --write \"src/**/*.ts\"","test":"jest --config jestconfig.json","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@babel/preset-env":"^7.16.11","@babel/preset-typescript":"^7.16.7","@types/jest":"^27.4.1","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","babel-jest":"^27.5.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","eslint-plugin-jest":"^26.1.1","husky":"^7.0.4","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"exports":{"./*":"./src/"},"gitHead":"31df8fca69c05655c144e910d19745dbf19f1859","_id":"ternoa-js@0.0.4","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-vpUPi4ucZizgV7WRJcbZFxVC7YT4vK/zAOST1tv4/wUMOnj/2GOunmVbhNExIv7HjgNcY9aIPE3pht/ZpixMZA==","shasum":"eda3be7de7e891d1440fcb152d4f059d27b00842","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.4.tgz","fileCount":22,"unpackedSize":39657,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiLw9UACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpbUg/6Aqbi3g+yC1VrVVXzPy35tiOAAwaLSa0vgRAT/aGdnlRhpyfg\r\n4ttW0U3Dg4BZSjBS9XCZanILcLILsfnjvpIU9pVSL2K1mnrNT0BMvlMLihXw\r\nNmcvaBXP3nxga7VjtR2+8BYtvvPQsTu9/dh1sLEvmrLyBmqj1aayxYAOYKKP\r\nuPkMs/Gq02SrQCiaZj7ZZoPWXe9lYr9rqp3kxhwJmLhmGhaQd3kpdrEhBtgq\r\n5BNwibdniqTneSFEggdYE8PCIvuJaWnO9K4dP6/oWSOuOCDhi3205Fo2dqrQ\r\ng46zejUost1ReA6PZzJap2vAMGUh4+eR+9GWk4UZfBHTWKOKZRhtMlYwl8KE\r\nVVXmhJJxIt5npDWqYAP9ZJZF0xwQsGQqgMuIZY3ZYoLwB6yc/QyP7ZLmc0Ga\r\n9l+vFsrceDGqdT5nOUxY3Gi/nVO/KF7dBJ8Jf+4gacZZEljhelcCAErEsqT0\r\npvFSA22BsxppRQLMkxSkKUADKrOWGu7+5/BcJRwad1epIjp+fOCi2IsBMpDj\r\ndlvuUqAJlf71wLl20Fiz/91CSnEyWZoPn43LrlMTGioKfge458bk9SJ5yZiG\r\naWrm5iwqJL3egNoXeNIQv3mJ7dXoarI5XpS60xODX3N3yM00t+M+rMA6mRPU\r\nCCDPcu9ZUQBe11EEpjfVIAY1UXdyHiDY1MA=\r\n=bGwT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsoShSATBGSZp9nzKc/9crsvue82tw0tezWEc9ttjXCAIhAKrRYrY55pKt0hItxsrIMrEQt8vlZSbjGow0YNycEpUC"}]},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.4_1647251284794_0.8015350092692379"},"_hasShrinkwrap":false},"0.0.5":{"name":"ternoa-js","version":"0.0.5","description":"Ternoa library of function to interact with the blockchain and manipulate transactions","main":"build/index.js","types":"build/index.d.ts","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"tsc","lint":"eslint ./src --ext .js,.ts","format":"prettier --write \"src/**/*.ts\"","test":"jest --config jestconfig.json","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@babel/preset-env":"^7.16.11","@babel/preset-typescript":"^7.16.7","@types/jest":"^27.4.1","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","babel-jest":"^27.5.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","eslint-plugin-jest":"^26.1.1","husky":"^7.0.4","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"exports":{"./*":"./build/"},"gitHead":"f1ad339c0ba22ec387c1fce8e88535ed1fef72af","_id":"ternoa-js@0.0.5","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-ISCOT4u746VUfDFPF9phShYkDKvhVYAvYcVp1c/DEIjLJfPp9cjWCTL0+oupOHT6k+VIlQtaeJygdBuMv4plgA==","shasum":"ef33f0c7df2ef2814aafa04031ba0613523534be","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.5.tgz","fileCount":22,"unpackedSize":39659,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiLxFmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqE3RAAnWOlG5YPifN87IS4Lf1Y/xcP7UM9ACRkOMjDjz6nWVhnLvKB\r\nI6M+SY24vxlTEaWiGzf4xEIVeO0nts9Y0SA7va2aSxiBCVFt5BCEcNy39WX4\r\ngmSwfFkrmNLaMbS4HuK8vhiusvyyEDIifn20yVjWvg4OJhGTb76pQ3lqhdWo\r\nn3mzvpxzkgbQ94oS/t+6XS6w6sktI7hRQmovBykb7CiLHjA2vji4YktFZCnr\r\nYkUBNH0yLaupbyYI6tO7iQwHXcXC4mtPew2PAtAYud7ZEXjiuCvV8WOk3T86\r\n08iTyVjbQniGqZxwUEVM8GPcw/YuYKorPaWVrHzB2oD5mNEqqf3HocqIAVRm\r\nHXp2EIOf6G7nxitUo6UmQnAvBIV/vJw66HrsrRX5MsICxWh4zEqCgBLmqXQi\r\nfz/dn1mrz5e30cf9lvrPTmH7LZEgjC2lkc3bX92y+81c7ZzduNkron7EjdCr\r\nyae9VBJsI3z2pijwsq/LUQf2SiAXeZTSRAKZCiySYheAHL33VuCSB7qInlV+\r\nU3K4h+0wU1G95EocPySU2FIql24UbYWp4eM2J5L8bCOtNapEkvbW9iWq91NA\r\npg7fazZafP4nTHD9XitGO/6A59PqcSrfMNlY+hlC0xYjcC2rAoJ65WVNHzrI\r\nzmZQSpYEztMKtv08RoGzlGgr0twUy3ZhEXk=\r\n=ga4q\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGEK4idFl8/kB4sNKVr2WiB+DwtX/8+4xokMKB88uz4hAiEA7wmtV/+bp/DqQ1OAdrPpjS7dZ9Q6klFKe5KOXp+UA54="}]},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.5_1647251814829_0.12925499612536107"},"_hasShrinkwrap":false},"0.0.6":{"name":"ternoa-js","version":"0.0.6","description":"Ternoa library of function to interact with the blockchain and manipulate transactions","main":"build/index.js","types":"build/index.d.ts","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"tsc","lint":"eslint ./src --ext .js,.ts","format":"prettier --write \"src/**/*.ts\"","test":"jest --config jestconfig.json","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@babel/preset-env":"^7.16.11","@babel/preset-typescript":"^7.16.7","@types/jest":"^27.4.1","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","babel-jest":"^27.5.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","eslint-plugin-jest":"^26.1.1","husky":"^7.0.4","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"gitHead":"89fe7781a59c61a78c9326cd39bfb620dcc5cc53","_id":"ternoa-js@0.0.6","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-gEmE0hwQXMhVFzh/rhhCboO1BVVXCeq7izjwlX1lfLCQXYbIBoT4Xw0xFHkSM5ShwIOUivRJ6I+NGs2vfIkW2w==","shasum":"a279c683877211ad8618df276c4ee67b1600e586","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.6.tgz","fileCount":22,"unpackedSize":39614,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiLxOjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpXjQ/+KoDu+6+3UcK4y05mryJxY3q+s9xFwC0ciTX2wNb9Abwx1rnu\r\nMlnIxvVsI/hzSvnOaxqO66Nse9tV18/wCYXjjX83Gk18J19XU22yCVpJNGXx\r\nB9qrqay7wFzfqlH9+SDuy/rXTKiNUAZoFhpw3B+pTYb7W4hDTbAJR4imsL6A\r\nzSgobztCc4m2TwCI2Ctce8K8oZ0RPYfVF0tGlUipowTsZ1lCuRqjIbe1k+WV\r\n8W9t//tMEbFlh/ns8kissoTF95AulOVkEWzr6tgQ6gfQiip0wwxNOtn2DKyu\r\nyDZfTOnVNkwxL/2S2UfRv5FNDMUI50ab4XfDPAz/sVF8+lyTsXOHfrGEdEPM\r\nH9ZdcYTtwENv5lPzcyBNuER6T5EyORvMH7sFd4ak/qlLkL5s+3oNvylFAwkU\r\n3vaRozPZf92wwCXXYCo5wK0OSsSsXyuWayMmVh0JrPZv2QuW+tz18v/9QDUl\r\nQoiCPubn7bDBlP4/EjzPy93Xe/4LfzeqdpEODWuzaIsUDboQmS1TcXjYp65Q\r\nu/PJMuWAP1v1YKgBXDvhiuJ6vQGJspklHGVONB7svm7xWHaIO52RxMMNB6ez\r\nKqfnF6NttCfi1+w3vyGQaLarteHsGl6V22rZgLR5e2Pdo3Yjx0wdDlrNSTF7\r\nlS39AzsUbAw75WK/ptT+DDYlDDSnerS3/FE=\r\n=Qlrs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIExhMregi4YVHRCLsvA1sF60LLJdlmZDoI1Qmemy3igyAiEA19FV6XexY2XjdoyAwn/VrC4J0N4aVHjP0RNfp7I3hok="}]},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.6_1647252387505_0.3434409436214143"},"_hasShrinkwrap":false},"0.0.7":{"name":"ternoa-js","version":"0.0.7","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","main":"./build/index.js","exports":{".":{"types":"./build/index.d.ts","default":"./build/index.js"},"./account":{"types":"./build/functions/account/index.d.ts","default":"./build/functions/account/index.js"},"./blockchain":{"types":"./build/functions/blockchain/index.d.ts","default":"./build/functions/blockchain/index.js"},"./capsule":{"types":"./build/functions/capsule/index.d.ts","default":"./build/functions/capsule/index.js"},"./fee":{"types":"./build/functions/fee/index.d.ts","default":"./build/functions/fee/index.js"},"./marketplace":{"types":"./build/functions/marketplace/index.d.ts","default":"./build/functions/marketplace/index.js"},"./nft":{"types":"./build/functions/nft/index.d.ts","default":"./build/functions/nft/index.js"}},"types":"build/index.d.ts","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"tsc","lint":"eslint ./src --ext .js,.ts","format":"prettier --write \"src/**/*.ts\"","test":"jest --config jestconfig.json --detectOpenHandles --forceExit","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@babel/preset-env":"^7.16.11","@babel/preset-typescript":"^7.16.7","@types/jest":"^27.4.1","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","babel-jest":"^27.5.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","eslint-plugin-jest":"^26.1.1","husky":"^7.0.4","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"gitHead":"ba8c5ae3e404da95abb9f7748a51735c1b51402f","_id":"ternoa-js@0.0.7","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-KUbLS8cwDhM1n45c1Wva5tYTFV3Uqxmgpw5RhB+CM9zt5vtnQlzqx34BwohUf3/p3fMLFhjcGOFOrWLeJbIAzA==","shasum":"735459e4a87881179840a9e7ea73ec8426c9817e","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.7.tgz","fileCount":28,"unpackedSize":51483,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiMzEdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoP8RAAl4femrzn8TiLnr/+VtcmlKlZ2q7FUMHQ8KapeJ9vf4WwfyYQ\r\nhag/tTOlJmAmeNOyMAa2LP1lxBVBUfCDgPuYA2NH75GcRUnOsDjSqnPpzb9X\r\nrzYdsjgbrhHfc/rnNgj+WL2rHsA/YImkdSeAR6QbFe9g/N4REUrW+3UIuCRc\r\ncy7K5F2SZSlMhUZeblAvPaNL17PUomL8OYt2fWH9JjpgtA6eNWGbgQoYS+t5\r\nYE0cfglGGP1lVByHWaQPWdJIW/icINRB8iicx6SNMlhv7TWSx74rP2GHqpwM\r\nDj/eB85cnsKMyUEsjIqd9LjBgWR22+pQwLekMzbhq2/2PXQA1N31WFoWA9SC\r\nHAgNF3lxwabAo2Dn2AR4uLZ2L1OVUcNgaf1Oq5AicUEgqet0Tgx0EJgdHDXF\r\nnMWB9n0ielgHxFjZKOOAWIqRWfLJXM6BnGOK4ZvHJ5kPWXqf3oG3o5/Hx924\r\nCuyd6Jdvu+E9noNbGZeP4q61uGisCwoqgAjXx34IlMT1gKkbUz1XtPfDhZNM\r\nXItlDp3yZETSjMLTONqFKyDbK2yqFD2OTHJ+9glsmN8f9yt6MbStSXiYftI9\r\nucQAczYH5BkLl9SWi7GD7hESRy3Hxh9ueqnVUlQF4Gljax7ie2wUazmN+aaf\r\nh3sWZutn2/jivF/eWBwKO/7CzKtJWDpfMg4=\r\n=jluL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHe/8K0uyb/PF8oP+MpLrIZUC4jetI76kFYhbLa8s0aAAiBxCq4YxlsYSR1Pj83DvkQscI3pDCtMQ7oYB6D46i/w/g=="}]},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.7_1647522077128_0.6794216154100072"},"_hasShrinkwrap":false},"0.0.8":{"name":"ternoa-js","version":"0.0.8","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","main":"./build/index.js","exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./account":{"types":"./functions/account/index.d.ts","default":"./functions/account/index.js"},"./blockchain":{"types":"./functions/blockchain/index.d.ts","default":"./functions/blockchain/index.js"},"./capsule":{"types":"./functions/capsule/index.d.ts","default":"./functions/capsule/index.js"},"./fee":{"types":"./functions/fee/index.d.ts","default":"./functions/fee/index.js"},"./marketplace":{"types":"./functions/marketplace/index.d.ts","default":"./functions/marketplace/index.js"},"./nft":{"types":"./functions/nft/index.d.ts","default":"./functions/nft/index.js"}},"types":"build/index.d.ts","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"tsc","lint":"eslint ./src --ext .js,.ts","format":"prettier --write \"src/**/*.ts\"","test":"jest --config jestconfig.json --detectOpenHandles --forceExit","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@babel/preset-env":"^7.16.11","@babel/preset-typescript":"^7.16.7","@types/jest":"^27.4.1","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","babel-jest":"^27.5.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","eslint-plugin-jest":"^26.1.1","husky":"^7.0.4","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"gitHead":"f5ff3fbd48bd708b3a21aece4802f2e428d49cd0","_id":"ternoa-js@0.0.8","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-GZ81/AHZ2WDppKil2zr0dAb4Dvaegk08s+4OkcpQslLolG3XioYNAWizU4hk+frYEk06ahPfUCpmPlcdTVcNwA==","shasum":"95080934b2b74abd0dc193cdfccfcba1981ed080","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.8.tgz","fileCount":28,"unpackedSize":51399,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiMzT0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrlfA/8CXYHyAC8JqdXgorDQdhgc0bPVIsBlLutlX47WIhSYxwTWNyS\r\nYCkR1PVTkvS1B+EYpjC0h+ln7ClCisfGnxK8HK8jrpHKQ3MmL6Vy9yexT5Ar\r\nvO4RD64C1RaOqOBNGtDQfgrvoIKXpHHWMYZnFxyO0wGr6toAE2UTj/W6T5+2\r\neJ9xHB6aHwmQtW+LyKDaydCldTuTzfFXsrbR47Sm+NN0gNqShIWtR45HSlH0\r\n5l+mplcItNUtLPinbLQkAuBAYd5pyK2YpJqG3TQCokZWedQg/Or2dz4d8Bgs\r\n2DGjIZVdyHPzkUdgJW+34+lND8lqqlyIx9oKdOfcrBinNgA908QACMhr4VzR\r\n9ziWycbxrEQH4anXyMigqKfIYUPvjuYEd23FuVtmZ8YkGQbol+Mrb+1v/1SS\r\nbos/U7wB5Y1J7UF7dmo4XAYlB4+76BqKOkkTyGS2BxOpa1+6wWXhum00Shl8\r\niOaLiAY0r0KXW1iFJIzbcev6KNZS4A+f3k1POIHoC4Of01akgwVHTJ/92Rjt\r\n4biHTrgYJcvzVHeZrH/g4CnCVjPd4WvoE9Qa3diASQs3ADJ7m3aUyMm/RnTQ\r\nX3PBifW0W9/URH1DlK/jDRjtbtamlSpDpMHrrLDVbFgLo7OPIi+KfyUiC8uk\r\n+mFaj5R7ZqkjSY8SXLqaQqKXI9/MmaHozDw=\r\n=2WPn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHuV7491cMmwzv++cFmQ9CAKGjEeFdgJMwRPXyAnFPICAiEAys4V1M16dxXRTqLUu8tZYbjoORvneZ2WoO8WA0Lao/4="}]},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.8_1647523060074_0.5152587476101296"},"_hasShrinkwrap":false},"0.0.9":{"name":"ternoa-js","version":"0.0.9","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","main":"./build/index.js","types":"./build/index.d.ts","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"rimraf build && tsc && npm run build:frank-build","build:frank-build":"node ./src/scripts/frank-build.mjs","lint":"eslint ./src --ext .js,.ts","format":"prettier --write \"src/**/*.ts\"","test":"jest --config jestconfig.json --detectOpenHandles --forceExit","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@babel/preset-env":"^7.16.11","@babel/preset-typescript":"^7.16.7","@types/jest":"^27.4.1","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","babel-jest":"^27.5.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","eslint-plugin-jest":"^26.1.1","husky":"^7.0.4","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"gitHead":"90c2e527adf6d1f9ed4011dd2993f524eff1a13f","_id":"ternoa-js@0.0.9","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-3hXBL4h0MiUIZxZK1+NV+ACnULZt+BG0F78FFIdJXksEu8/08oa0FxhSZTr9jGSwoKRmFa05c8wDW76zex6mMw==","shasum":"5dd54a0fc20e27d428e8413fc0415a8a5ef7dccd","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.9.tgz","fileCount":5,"unpackedSize":7802,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiM2MjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoTBRAAkDJ5M1Th9cOhDUkni5Babu4Ti/EqmF4/gBOlbWx9adViixGq\r\nKOTcUUWC68uOvhgZ1C66S6Sy4t15GM9ofWQrAJGRMOiS+0eOhIvaXhUR5MxK\r\n1VjjTksMOOuowLqQmqS2s71ABvDMoqRxZQaYH9/SHLeQltxaphSpn+uTINoa\r\nboRlrjl/YcsHDr5s5C/PpV74ZrrT/jGke0KIvrPrb0DkCGHPEqhdAUB3TcyN\r\ne7LxRlcjz/D2jqMXY/kHwNJYo5lo34+Vna5lN00lVv7vuFvgVM1K3HQIRMCI\r\nAKdxk6+RmVMquEaQdZ+eIS8aIcWX0AwuohR4rqBoK5d8V5CT03+fTbrYEaMw\r\ns1bA2kZRKv206CE/fUR6Jiu0lrNLpCCl4COBYxGqyWuHp8NjyCfHpFO47kiD\r\ngxb1nZCnd4BhxRszBzCaOTItlTUQ2udAid2i/Oj5RraLbOO1ctuDla5vcjP6\r\nCEiSRic/rR+d31OC3P4iYUhs9Fw6BMceWO4Te7p7oNKW0zZ+2M9YjbHAO6sc\r\nt3+ROp7pIqrLVyEtcMFy3cKFVpDGcK8/9RKZI+1Ci91NEJ/EwoGwYDlsa5la\r\nsTM5Q2UFudEViqiuTGHSqi4CJbrgjF2rzAlTF/fIN674ql5xv5zWOhwpadnO\r\naSTx2g+lUIX4w9EPshOwCnzRC5Oe83INeXk=\r\n=oZou\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCwAPoB5+fs/MbBZ6vGJunDdMe/Y/FwezoTrMher5bkYAIgIyRHLehXLjcI5f/4RVmnaCCK2TqsVhqz9zd4/27Nuhs="}]},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.9_1647534882942_0.9260943184136805"},"_hasShrinkwrap":false},"0.0.10":{"name":"ternoa-js","version":"0.0.10","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","main":"./build/index.js","types":"./build/index.d.ts","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"rimraf build && tsc && npm run build:frank-build","build:frank-build":"node ./src/scripts/frank-build.mjs","lint":"eslint ./src --ext .js,.ts","format":"prettier --write \"src/**/*.ts\"","test":"jest --config jestconfig.json --detectOpenHandles --forceExit","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@babel/preset-env":"^7.16.11","@babel/preset-typescript":"^7.16.7","@types/jest":"^27.4.1","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","babel-jest":"^27.5.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","eslint-plugin-jest":"^26.1.1","husky":"^7.0.4","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"gitHead":"297763bdd3bb3b2a5a86b66315e1d221ff455088","_id":"ternoa-js@0.0.10","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-+VpPp02i2fsOXoKJ2SUeW5CfyaDHdaxqiQ9JAkBvtBFaM8ZHfPz+mVoDnbQnWlLIa5V7BFpXtALXGj0fcq9xHw==","shasum":"fe77cb914170cffba833ebf06ad0d44a726bb3aa","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.10.tgz","fileCount":5,"unpackedSize":7792,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiM2TVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpUHg//dnpyCtWUYFtDyZmQ3jGcE3Je4aHlN7R/xQpmbRwvl78oSOXv\r\n0P7ihkvi2whYLcLKFFGeN8WksnIu6eAfhDlOXd5C1q1+ZpYRVmaJ4FXQom0N\r\nSuiPuwOT0eLPfzK2wUq1CN2IxdWEZr9jCiUL/NKNCf1BZiweDgRByURjT3fO\r\nqqtIk0fwkEux0AJlIkkisuZ/ysYYBXzrA9PY66L/rBUtOS+TO6HBiV9fd2HZ\r\nD6MJVil1H+rEIazit7pG/1yI9+Yzuhl6mvEp7KTrdZh6+iCl4aELLvCle6Yz\r\n4RJo+kMgHnfFrHbUeLDmmtQT/MZbkf8FczYFsqzftefIHW/dMUDpccCuFNy1\r\nuOBmMUonsCBjKqOzx2v9JYz/XIi8UImehqrLCQfRM0s3XtWeSgo9C26e2agS\r\nuLQCleeqR69QbdvlAD+S8k24QrRQmpNu/0msRvYzNG8buLHiVgIyEO/hXIfw\r\n6q1E8eQmE9FMCU8zyNjLr1gYMa2Tun0/2OPr0KVbK0g6FGiKlIQeXaSqYkxK\r\noqcj5BuDMpPi0NQhGeknUpZdihDEjkDCdlvndA5dh3eULk5iNYCPz2cZL+qR\r\n4qQJ8ZsIdkiFfGLXM4rrUAXJXGUrIn+WrR3zSnNq7SSU5Apx1rZY/XdBn7y7\r\nc4oj9PXano7vg0/1nwtNTK7GEUz041G/sGs=\r\n=exST\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGx18m1XcIfFiMkKfWsp3inxckxbL11kEnLVu8jWm5RSAiBXKEzTGo4tPQliYRpjVVs2tMuc53cVQTJCzOkRfnhxiA=="}]},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.10_1647535317728_0.06626010823741413"},"_hasShrinkwrap":false},"0.0.12":{"name":"ternoa-js","version":"0.0.12","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","main":"index.js","types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"exports":{".":"./index.js","./account":"./functions/account/index.js","./balance":"./functions/balance/index.js","./blockchain":"./functions/blockchain/index.js","./capsule":"./functions/capsule/index.js","./fee":"./functions/fee/index.js","./marketplace":"./functions/marketplace/index.js","./nft":"./functions/nft/index.js"},"_id":"ternoa-js@0.0.12","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-2TrUo57GJCBTqluhxXMr6Z+DgBCJ6zrLXXv0D4FeFYbO9SzjnSQAS2KB76oq40sHlWMy5cqw3K7SwFT7ClReBg==","shasum":"10f2092c682aa6d5b184197ef92dce7cd3b34ea5","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.12.tgz","fileCount":3,"unpackedSize":4854,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiM6h4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmov0xAAkQ+2QHIHmDM1nwVonQGGTXEId4EXE/rF6S7RtB5fsETee5/b\r\nie4aq5/K27ND5EjGiq5kp4YNg6lzcvgljQKhlmPZpVfHhm8VelF/DGf5kq47\r\nC0Dem9gU94unYDu51Sex+TIKoaEOtBAptAbnWECQBqt23MpcwUWOynsJ+Mq8\r\n/BlOxr2aaPBYbOpDaRXCU5vtqYHxPoAhq3gTFv9oxt7Oozi5AgJrHoQfL1xG\r\nYJsyyTEDJFnuOb3wV1+JdNtMZ/lq9F4PNN3nMgoYjGvfD62yVeWEKrT0ccJw\r\nT6I0HFfLvAnt0ItCr877bO3AtC8m1H3/uh46q5iQXWjG3o9NEuSlTstZH8Uo\r\na4678NH6FjAxy0VSx6nw3gfYuanrCw3uhXfgmdULbH2GTwTvmGTREU65iV2k\r\nh5tNbWSCcF6ACdoe/kXQbe0mMB286UD6eFsfEUbZ8KvaDNkPms9vHLmW7bD/\r\nYZRYmp4IsFPXDNF82tRZ7/QiwqS7yoFDawtsfRfK8zGlgEwixxFWIBvkUumc\r\noMdhiXBTVwrQ0IPS7Bh1X30L+y4s2L0AoVy+LJN/5GfV/mzIOM0Lu6Is4FtI\r\n0JnvaaFipbBO8DnpHZUZ7YOqZn01bulTqFZujpJNYUKPS21W040Xm3ObTRXG\r\nxo73qMDtCD1STbKdcDTkL37tPJys+ok7cmI=\r\n=K+cm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGP/s9Kfbqn8pDqMV6mzipepRMPwEaHMDj7UzuwJlbtsAiB8bnBQvfDpVBxY9GavBsxZ8dutB6TMA+Re4UHQ9aKojQ=="}]},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.12_1647552632588_0.0019534681615756"},"_hasShrinkwrap":false},"0.0.13":{"name":"ternoa-js","version":"0.0.13","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","main":"index.js","types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"exports":{".":"./index.js","./account":"./functions/account/index.js","./balance":"./functions/balance/index.js","./blockchain":"./functions/blockchain/index.js","./capsule":"./functions/capsule/index.js","./fee":"./functions/fee/index.js","./marketplace":"./functions/marketplace/index.js","./nft":"./functions/nft/index.js"},"_id":"ternoa-js@0.0.13","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-W9+zF/0KImoI/TOEscPCjq7EAiZvU7/oDga0661Oy+3EGfUZH9tgQTAQF398FmNWylkUY6Q3s6ssySX7d9FWpQ==","shasum":"c29259a2c8a65e3b16d26326d0be93933de21226","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.13.tgz","fileCount":3,"unpackedSize":4851,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiM6qmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr7fxAAkZtH+fEDTQQZ4ZJpvClluhciB6Klx8R1cMhUhEiiHIFmXTU2\r\nf/8oZ16d3hgUcdwdFYrp5+KvDg8S8/HLnLtMIkPa0qTLsIPdGmO+9r7HmvRK\r\n6pAGprcCRwL+Vf9YHqJFFKPinl1YXOFYC9C8kNvdgkBk+VfGEuVRm2RfHeA6\r\nKgAB1aLWEavgl0ANwwRhnNBqjOW2jPfEeryD1IEQzRkgvrWBVOZwZKera66Y\r\naxftafR5o8Y4IYa16AbooTu8DEPV/VVNyApcTcjZICeq4S2dDbGJnXmrQYv/\r\nJzYpgHl87SvjinMIcEHJbbNSblQ7xZGyc714X9fpVH3bj7efihMrlEXnBAAB\r\nOFFFUmnVyF9ajo115zdYM1wZFZuEwtZ0fSK4MErcU+yht9x8lAJkVvdVsDw+\r\nEGDsy3VdjFtBdLNKV3JR76pY3K1JYVeKqc4rhn1l2+hYlxQs/NxPdnB7Jh+/\r\nRU5k6/Zel9C6Pgs8dKNXdZF+ivb7iKUr3fe3H3jSEuud6LI/vNmX5pTjSHoN\r\nQ6XMM05bTvN3oETkhCWNKfWgJz61d8e/LL6g1jWNUSFbKFgzehqCiG8DhVm6\r\ngOlIbTr5S+kaE8mxSKEI6vxX0XZKF3VMzbtrVyMnErRBpka0HQxpCnpS79UU\r\n8trxXc5dHnmtxpRXJEJjTGhGAGpgwMLoXR8=\r\n=oDpv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDHS3NUkcWiVBuFwsI3L9xgZb7f46pZUMwcWkBB0kdhvgIgCeRKen2kg/DoT2tDmdYLpYWYgZDlnfeXHY47ECE+0VM="}]},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.13_1647553190600_0.3051483558701462"},"_hasShrinkwrap":false},"0.0.14":{"name":"ternoa-js","version":"0.0.14","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","main":"index.js","types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"ISC","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"exports":{".":"./index.js","./account":"./functions/account/index.js","./balance":"./functions/balance/index.js","./blockchain":"./functions/blockchain/index.js","./capsule":"./functions/capsule/index.js","./fee":"./functions/fee/index.js","./marketplace":"./functions/marketplace/index.js","./nft":"./functions/nft/index.js"},"_id":"ternoa-js@0.0.14","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-Q9cqvR+ScDs5+ngJwtDyBAWtty1Swll2p+W3Sd6Mb0NF0sGknJVBhvuhAR2U3hn/QpSrSXzQvETBBFd0y4Pw6A==","shasum":"ef0a4b515bd4224eb5953795b29b86891c1cd1af","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.14.tgz","fileCount":26,"unpackedSize":47442,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiM6x2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrbYQ/9H1gTLVZykgOw0T5/8rp5MfsyAnIeKcpKIHYnpI4sxuvu/VmT\r\n4BxfYzqPBwjU5yRr5WKsCmInBFClBMQY8B4VMoaAc2cNg8BaKloa0oGT511o\r\nVdC4t5kZRSc6iTTV2Dp1Y0UVU33/qI9QBK4jRXG3jk2WKeQ/YMAkQmWz/Fsi\r\nrbsVyPLpyww2D1Iboyt8vzm+IKQsS3Z/sloK+O/QrfWb3FjznrvImHL4p2Q4\r\nqwtvdCAWEHSKCtdkE9cHOMNIqtdW/0ngZDSnp/aCeCLSXze/4zwEwsI0KjAl\r\nqkmXqiPPCoKZRS5leJ8d5BXHf1ElXVVXD7pWo0XZhmBLftKJvM3OoyPabSgG\r\nZgqcJbzIWITlTDkiyLwhWGWSwmv0SMplkT+uUifM+b3djEbcDzEq/kARYuTp\r\noqqriHHMGO04Ic63ZIhUwrB3zusTUP+CUBe4AMzTPVUVjKWpdtDrJnfRM2ts\r\nLz2KUiP2aAVoPpjJZGNlNh7NqrzktGjqZSy8dnCYNvSX/Y+1+tGyq/tSJizF\r\nuqmhsFjQ8ZKjYVWacFb/ihiOWnlr0JASEGUkpWeSxc8pwoIfAHaPklMOvMKN\r\nf5Y91ls+uzcyurvY0ur6AP2B/Y/CiamFCzrxAhIs1W8KSWAxh6BFnMJF+dYx\r\nluC8RXCKzubbsGgPMOcdmgMdd5J4Zt0aCMc=\r\n=6ab7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDHsNWzv/pcxuNteyeOdVImWVR9ZGDHeyJKUm6v/7D5DAIgK+kYxJ9IT/W8eLiFDzZ+zItSFvINS5+gx0cZzbYAP4o="}]},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.14_1647553654410_0.6360291581679915"},"_hasShrinkwrap":false},"0.0.15":{"name":"ternoa-js","version":"0.0.15","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","main":"index.js","type":"module","types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"exports":{".":"./index.js","./account":"./functions/account/index.js","./balance":"./functions/balance/index.js","./blockchain":"./functions/blockchain/index.js","./capsule":"./functions/capsule/index.js","./fee":"./functions/fee/index.js","./marketplace":"./functions/marketplace/index.js","./nft":"./functions/nft/index.js","./utils":"./utils/blockchain.js","./constants":"./constants.js"},"_id":"ternoa-js@0.0.15","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-Ad2GV70e6wqkdegXafaFyynJgBBul9kauBzuU2029qtV7r6x973phi2IvGoyY6mg3E8PgtjFUMclfeZkQkrwuw==","shasum":"75937caea6d195c4ed6eec9641ceff127c75aa4b","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.15.tgz","fileCount":27,"unpackedSize":56378,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiNDsDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoBrg//T13UWjxiv4VATOssOFQqagvFVNQT41JYGtusinTq9TIg0cJ5\r\nSAS4/cdfu09DeX11dR5Frsp9FOFny9gZkh4QNMnQnKUhPcpeAuWi4eXFvRPu\r\n1GC9TByFIyQ6cKYG+8PsLknrTtEM5PTCVG0HdZEAKtCSOVM5FV4FuXeeBp3t\r\nXQ7IaIsh2XXuAs5jdFPQ+aZVgS8nUj2MzHslB6jPHEi3pzwAzVrjD6BM0wg3\r\nh0vWSmwqVZZp0Jdy6gbBrAcjqGz0e2rvf601AlB9AQ7KwSqpCqBg1XtgbgGB\r\n/SUqGddjr5B7ODq8w74k5HVrQywb4XFWNpJ+aRmWAysaHw7p6Ex1CdaJKGf/\r\nTNT5QPy5iBMnG1FLDwP2tMSiaVsJVBdW433mM61IcZWA6AQYRnF2KyyjKxpy\r\nv67og6I0DpF8kwp0igAs2/vnaapsj6HnTzRGn65pNpp8y/1oty9RrX56zUvL\r\n1+v6jTXMItlH/MBblZs5RoExuKNrb7c7WdBgYa7ATBeQNtlNPQWCqzMZ1ZdD\r\nAxGW5St/A0WbJF+I0EHTNbW6W4JePff6mD+O0R4Bbmqh2SKZRJsdIgENZ1zH\r\n1J/0yu14Yx580mrF62YcNAKBJrW62Cw8v5LLetu55o8Rb4nZbw2CsqZwiehJ\r\nnEciN0QkOdAgCyZEf36Ogiw7NG7IfmhJo6k=\r\n=H+zD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFh/c+O9g1kwdUEFxGdjlu9v/tZyJKBEwHygCJ1TOc2uAiEA9Zmf7/YZ1wfh6ypj/lEOrHl3S1Io0kOJHIeoHe3CXYQ="}]},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.15_1647590147801_0.20950548718649764"},"_hasShrinkwrap":false},"0.0.16":{"name":"ternoa-js","version":"0.0.16","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","main":"index.js","type":"module","types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./account":{"types":"./functions/account/index.d.ts","default":"./functions/account/index.js"},"./balance":{"types":"./functions/balance/index.d.ts","default":"./functions/balance/index.js"},"./blockchain":{"types":"./functions/blockchain/index.d.ts","default":"./functions/blockchain/index.js"},"./capsule":{"types":"./functions/capsule/index.d.ts","default":"./functions/capsule/index.js"},"./fee":{"types":"./functions/fee/index.d.ts","default":"./functions/fee/index.js"},"./marketplace":{"types":"./functions/marketplace/index.d.ts","default":"./functions/marketplace/index.js"},"./nft":{"types":"./functions/nft/index.d.ts","default":"./functions/nft/index.js"},"./utils":{"types":"./utils/blockchain.d.ts","default":"./utils/blockchain.js"},"./constants":{"types":"./constants.d.ts","default":"./constants.js"}},"_id":"ternoa-js@0.0.16","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-tutecNRERvhk7/5jMI+I2fQYyrFdnS9LjpnjOMIQgzSwMGQ8QIiigrYymWaaRCruU86Nck+uflUJmv/qN4MgkQ==","shasum":"248e243dca23c35afb522c5d5f3348b4b5ab9f7e","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.16.tgz","fileCount":27,"unpackedSize":57078,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiNETTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrjFA/+KhcDWpfUakD5OY2aIM+2xUWfwaRbiU/ZoOyDdxr3VYtYrpIB\r\nCXzM6rUZF9Wr3hBR+MVAqQYz5MAIrvPyGp1V6SLI/lNDPI8odKtDjGWB+Xvb\r\nEAXtSThMSMNXfk2twJOkuFJyIX5r25u/ljbB5KL5wSYkJEe3Cv1AzeEYbsMu\r\n3B82FKvweQNHmtQrXwLLv7zIVT/tA/Z5Aokn+ah+s4U336rdnJvD1u6f0yAs\r\nOeom+wKRMOH6erDt/XNwnQgvNMrKCPbanSt4Lj64vg5iMRfK2z3Jw0verx45\r\n9BY3XpZ7ricRhzcfzykJpmrHINQQ1AfjO04710sVEYyBIpQm/eUP1SwCaHCa\r\nJjkZlPI7QTtRtJXcbiRcsHVpCE0aMTGy4fDPY+IfxVnhfhsneKkqDX0utmuX\r\ngpyYeimpV2hHhqDJfqMHKBDMT96uh3zrVxdBAInXvzH19hu+d/19tLSjlJx9\r\nvkRb/QTKRcn3yjEhiv0xho1WjYRLiY3KX7Q5z5LBwxauld+Ft8QCl+KbK89a\r\nCX5TueB4A5oLHYpkCkYe2Xig77l4cWyMGVJEaVAnzUVy2UljBpN2QwtJjHMz\r\nkMMQAYiXFUTIZFiFEOjUXoo2JeBwnoQ3ZaYJZpcYwNMGcZ/pPxg8Gy/QkEpM\r\nasC6lACFyudlAiOospZD2hNF088qJpJNtMY=\r\n=Iy9g\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEmMjX47YPXt6bmVZu0sCsuZGle+otBnn76VPTYPmtFgIgSc0j7lWLvaO6XBx0INBWNhDhcYcUnYDxvxNIRPhmaZU="}]},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.16_1647592659243_0.23162231686825607"},"_hasShrinkwrap":false},"0.0.17":{"name":"ternoa-js","version":"0.0.17","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"type":"module","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"module":"index.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./account":{"types":"./functions/account/index.d.ts","default":"./functions/account/index.js"},"./balance":{"types":"./functions/balance/index.d.ts","default":"./functions/balance/index.js"},"./blockchain":{"types":"./functions/blockchain/index.d.ts","default":"./functions/blockchain/index.js"},"./capsule":{"types":"./functions/capsule/index.d.ts","default":"./functions/capsule/index.js"},"./fee":{"types":"./functions/fee/index.d.ts","default":"./functions/fee/index.js"},"./marketplace":{"types":"./functions/marketplace/index.d.ts","default":"./functions/marketplace/index.js"},"./nft":{"types":"./functions/nft/index.d.ts","default":"./functions/nft/index.js"},"./utils":{"types":"./utils/blockchain.d.ts","default":"./utils/blockchain.js"},"./constants":{"types":"./constants.d.ts","default":"./constants.js"}},"_id":"ternoa-js@0.0.17","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-PO2VJvp3KPBZ/LB4MEY/NxU+M8expvcFkUyN42WIMH4pDDEFelSuxNlrmze+EpM7ZWZEsDJYIU7hnVt2HhNIvg==","shasum":"0820e3efd8f6aded11ec239f960c368d4e624bd5","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.17.tgz","fileCount":27,"unpackedSize":57024,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCSnvKK7j1+kx2PUdLBReH2LJu2lO97626KWrdpeKL2WQIhAIEnZKcgTwzBzETUmZTiimga0ebMWUoFFd6nhP/O5u4t"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUBFdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmropw/+N/nLqhpjwMlQXb6cSleYOeIt7Bnt4/YQ7A7dmzA+go0lUFIB\r\npQGfO0YE5Llzg2QdU7JdQ7Ea0XoNrGWvpwy5/Q63x5UtmO+I6ublAK3yUUQ3\r\nDqxMNns8t/Krt9HEqTn9YKMJ2JxlR40AIBtmv5HDolBkPgpK/ejkbn7aegbo\r\nByZWDegQtjP2mBacSgoR5KXkhK4XEXnycB+o1NT4Gd5JvMozqEWPCPgkVFjM\r\n7LKx0pwFMfYb7ezhPZJ+N0CZvQo17o7c5jPVCmr0xO7CPlEcF3Z3RV8v/Kys\r\n8ij2KRgcKa5/lYMejDbK0fjJkGEpxxNU8GmYzE5zgxz41+m0xL+bafJrg4CT\r\n35mt7qg6Xh2jIabLtD5IbIqjoiFROcKcTGCv9MAWpOar1fkB1JZl+cibXOfp\r\nCrhbhblz5tEowAC71uJ3NTFGiFhTc0EUiG2eYBKqZbEo7ZfbrnR8Y2A/uNve\r\nXz7JPrwX5yb4nrFpFdgln6czkmJ5S8DnNMn9WHoiR/Pad8ExLmPrU1vwiBgT\r\nBF6Sq175KKaummwCiCozs6E1H3v/OHgNnkJWLs41lw19RtYd58k83tAA14c0\r\nnu8iSYAuasiAbPciDGgH/zWdTsEnxVbtVVVKkKMCYePMMEhXPyvMcwxL2/Mw\r\ngANcGw1I7m7xEgZMjZec4PBaGItLHkN/Jrk=\r\n=N7Es\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.17_1649414493504_0.08167540700872866"},"_hasShrinkwrap":false},"0.0.18":{"name":"ternoa-js","version":"0.0.18","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"type":"module","main":"index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"module":"index.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./account":{"types":"./functions/account/index.d.ts","default":"./functions/account/index.js"},"./balance":{"types":"./functions/balance/index.d.ts","default":"./functions/balance/index.js"},"./blockchain":{"types":"./functions/blockchain/index.d.ts","default":"./functions/blockchain/index.js"},"./capsule":{"types":"./functions/capsule/index.d.ts","default":"./functions/capsule/index.js"},"./fee":{"types":"./functions/fee/index.d.ts","default":"./functions/fee/index.js"},"./marketplace":{"types":"./functions/marketplace/index.d.ts","default":"./functions/marketplace/index.js"},"./nft":{"types":"./functions/nft/index.d.ts","default":"./functions/nft/index.js"},"./utils":{"types":"./utils/blockchain.d.ts","default":"./utils/blockchain.js"},"./constants":{"types":"./constants.d.ts","default":"./constants.js"}},"_id":"ternoa-js@0.0.18","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-UEkE/9V5TDVsjkqnSIRoPcGrxvKkfDfDD0KdVT4ABs0w73WI4xcTC+a/KkZus4/kuHcTdgC0+/1kwlj1zI/QBw==","shasum":"d3c5980c5ee99e5d05be79cd9a4307ff7f2f37e1","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.18.tgz","fileCount":27,"unpackedSize":56903,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvyiBzcKSGWgkF/AJ1pRihlcMTz4cpDvwXlw44kvxmCgIgXt0Zj+7ecnAw0Io7ym2+RM8YGIh8XfvQyvBYlDtE8XQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUDg8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpISg//XO+UH2WJSCP1ZB5pI5cj5R0jsEo2YoqYrP8hMxFEQRzKCdGN\r\npj9tu9PJyDRrQNiBPWjGH7JcCUw5nOWh0h2L+fMytqnHhx4+gEEiQYHOwQdN\r\nIDppY5JxlTQlHXrKQQ3JdkR6QbRs056jvk45uf5TzwsWBkY+LX/Db+9yKSNj\r\nQzroOX2TKSL4+2FPmpc1iV2TspBHFCw0/GaqCdefXhkVuZDQdIEb8f+Qdtfj\r\nE44c8smiYby/oOtgbueRK0UsYvcDF6czIIL9dZoe6mA3fF2FXi48kD5TNEA0\r\ndd1J94Cv3qy94hqIldRd+UOl3IBLZk5at7b4tuPp4VzKO/byE7RwG+Hg9nJZ\r\nGrwcOzslIIRCRCiipE9C+hGWygaYuW0C6oTeL3WxVdZGQbPCMkgNc087enxe\r\nnLYkQkPuO9MhJbqqThfzGSW9is03Ex9r+ZPlGYe/x7vI1/EMsO+XyRx636El\r\ncuC8oF0/0JT0aypazb7s13c3Blie21VTcHZRAepxgcN1bkSS8j9GOs6+qtKj\r\n/goApecTttPLCfyVaqD0pbijr5O6rdsXAn74qeTKwNzP3wf2KdZMzGCkcAB1\r\ns9FBc2Ga9zJTj5fEFtMuL8e1phyMuzNln8TFlrzOZkHzeEm1ye6+6f6aFuyf\r\nv9gKtgtxDiG0Cq+lUsWg+UQ7dN6LnllgV6s=\r\n=UIzU\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.18_1649424444185_0.2759208680377683"},"_hasShrinkwrap":false},"0.0.19":{"name":"ternoa-js","version":"0.0.19","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"type":"commonjs","main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"types":"./index.d.ts","exports":{".":"./index.js","./account":"./functions/account/index.js","./balance":"./functions/balance/index.js","./blockchain":"./functions/blockchain/index.js","./capsule":"./functions/capsule/index.js","./fee":"./functions/fee/index.js","./marketplace":"./functions/marketplace/index.js","./nft":"./functions/nft/index.js","./utils":"./utils/blockchain.js","./constants":"./constants.js"},"_id":"ternoa-js@0.0.19","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-UvwbBfO/G6Lck42gKsIeuIw3PM80SMO+dVl0oxep91Kmd2WmN+LY/sqmr6GieWKgdZFbZmtaL6vfctyOOel2gA==","shasum":"03c644900e136ee69be7912a5142125ae3d6549d","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.19.tgz","fileCount":27,"unpackedSize":56185,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCOrwQfB9fsZDVQ3JLG/KqRrsy7wTYPA6EJtt1dWgl7ewIgOMwyQQO0LnWS9+cHCXLbCMW+1X+aBpGeLHHrQaBRWxQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUDwJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmprOQ//USTCOWuucG4UKRMWcFl6eJsR4OjCnx+JlMypSeT8zwdRxwXw\r\neAnhvhVP81fkYmHpxCrJi/JgqgB4x3ws64XNLv5I8bohAlMnjrjOxXjpRp5x\r\npEhXsa5KNR+rOo4B8Ld32n7OZnZMUHVRRvUCiSG1W27dgdnLTilesSz8tCF4\r\n9HGW1hijHiGPdotaSSXS0LJaT/MyGbDHUhqFQUyhPZNfzhRbXA/ek6HEkhFo\r\nJ2kRUUr5JEFDnYBFFMXQbn6ZpRyaWcj5CV9EDei9994GQWcZKqp4/g4IgDtL\r\nK2q4JcGD8mdzp4ybtwIQCsojPMYdz+ZaBU+EP/vG1ovbOEVs7EPha+UE+vDn\r\nFBBuX284ZWDbhlTn6km8CrWncNELXmN2BU0hso4eg+/72crQkuU15NpA8xzq\r\nQJAu6N8qe1eKrUhkWjY4qr9/dTCS3CNgAEGyZtNfIajuVsvUwEKkY/ZSZ/G0\r\nUYeDMpVg1j2oAvuqzW8D6LFBDyFynA0jx2pyIOBHoeoF6o5tmK2ZvT/InDW8\r\nyEoA+7PhMn6pQOTKPsf25hLMkoWwrQNvGEzju6RCsThRiztByocdyOXnEvNR\r\nqE4rIgq3QVSBykONMQAc+Kw+YYZ7C8C4RklsWYYCQ4eV3UnCiggBf/wJtZiE\r\nUx4jg5LVlZsLWjoUAYa6i/oncuJZw1ixSaQ=\r\n=YM4y\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.19_1649425417231_0.7145583364512724"},"_hasShrinkwrap":false},"0.0.20":{"name":"ternoa-js","version":"0.0.20","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"type":"commonjs","main":"./src/index.js","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"rimraf build && tsc && npm run build:frank-build","build:frank-build":"node ./src/scripts/frank-build.mjs","lint":"eslint ./src --ext .js,.ts","format":"prettier --write \"src/**/*.ts\"","test":"jest --config jestconfig.json --detectOpenHandles --forceExit","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@babel/preset-env":"^7.16.11","@babel/preset-typescript":"^7.16.7","@types/jest":"^27.4.1","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","babel-jest":"^27.5.1","eslint":"^8.10.0","eslint-config-prettier":"^8.5.0","eslint-plugin-jest":"^26.1.1","husky":"^7.0.4","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.5.1","ts-jest":"^27.1.3","ts-node":"^10.7.0","typescript":"^4.6.2"},"dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"gitHead":"d0a1210acc2a6b5f90ea9006bf04ae8cd6c5e58a","_id":"ternoa-js@0.0.20","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-ZXGU6Haf3TQm1u4p8pEzjKdknwvnUa/J3ZYkCHajMLvJgEgc5hZShRBYzo506O2x7dNgTTjJvbyQXzNvoz0IZQ==","shasum":"831f2c57d75d43ec6dc82406dc55d5d7bb2e7191","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.20.tgz","fileCount":24,"unpackedSize":68775,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDL0iy80HwTI0LFVMGVXDUOpD7Dhn0KJxz/zrHR758YPQIgJCEMwZA7rRcRxEb4jp2kq1j6drNbQ2qfOc1Inr/hQxg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVBe5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqBExAApAIaN0qhErdWfN+GmEQePivxPBF+nJ9paEpCjM/LjpBkpNLM\r\nbDmGQokMDgVbSvvAEVRQMN5pvmReGqduAoGUfhiagWRXHKv30Ba54XMMwRJx\r\nsvQF7cIk2ffEVkYepO5flNZgyNqOhdfTjSSP51OOOk+eOADEgub8REamFZYt\r\nF1r3EZixOWsPc4/Y9wb+DBXZvbe6ZTfB23gEHekBUmadFUPHPerC6zZoCHRJ\r\nsga0rVtFscsOHLyQofkGeBhGCfBunIwJrDkeVxd7tUmTye89hpwQ8A05R4pi\r\ndZpDODv5DYwxgHA6YBTrfD49F033eEvzbAHGf5Kn5DvA71JxxJ2zgzlHz6F5\r\n1sn9XVMj90asU6o088boXy4of4YN4GAZjUmrOmg6RDQPAFZqJFKxkOJxLvtc\r\ndBOaMnfGu+GGDGDoLRwogzKCUF3MN3YtolPiDMgRJMQGVwDuba21pus0gM2L\r\nTyFkv9Rb+yz1Bd61/QJWZuPyzqYJradevN0W0D9TVPTdamsB3mXFDQwH2OvX\r\n8olDK4I3R/koO0hrXX+A0KC8gdiqEpWttYyu1zzgg/wNVefT6cF/Jqi0pTKD\r\nrl0nNhsk+SrJy1OVvSqULea88GvHrlUyO7AH2iS+C1hW3OKoPenSY5rnZndT\r\nu6lE16wydUVDu2okfjnPLxLkMAamg4u/xP4=\r\n=WxvO\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.20_1649678265680_0.5020880154153837"},"_hasShrinkwrap":false},"0.0.21":{"name":"ternoa-js","version":"0.0.21","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"type":"module","main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./account":{"types":"./account/index.d.ts","default":"./account/index.js"},"./balance":{"types":"./balance/index.d.ts","default":"./balance/index.js"},"./blockchain":{"types":"./blockchain/index.d.ts","default":"./blockchain/index.js"},"./capsule":{"types":"./capsule/index.d.ts","default":"./capsule/index.js"},"./fee":{"types":"./fee/index.d.ts","default":"./fee/index.js"},"./marketplace":{"types":"./marketplace/index.d.ts","default":"./marketplace/index.js"},"./nft":{"types":"./nft/index.d.ts","default":"./nft/index.js"},"./constants":{"types":"./constants.d.ts","default":"./constants.js"},"./package.json":"./package.json"},"gitHead":"5e92d885392162a763587c37efc684025f156654","_id":"ternoa-js@0.0.21","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-hyAPWoldYRr8VIOLKUhXqHuahgRHrJm73rxX+JBd+2b6BqAkYhzFn+ShXaZPx/dtl0pv3sBCoAFx7ux/1yvjCA==","shasum":"6e9bdafb7514cc438127fe42627b853ede5c99e4","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.21.tgz","fileCount":21,"unpackedSize":55443,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNhrQedaJwb385fnR6Acg6FqZPF8wHciOyMa3mQYJb2wIhAJrI/dMinVS5DFO/80DbSe+N0k1lzOLjiB+NEJz4A03Q"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVC6nACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqaEg/7BoxT6qhsUgn2oMm7vtU69DY1PdxVAHn984adC03C4humSYTK\r\nn6cuk2A4paLZ4+6bm5VqoaTSr2KbDAxEFkfwY0Vgxn7XOMxRMoxkrsCU0UAm\r\n3xUOYAuotYhuL+Pgm4VCCkIl5iizOEszR3zQl768L/lTVtGC6KZRkdFdgdhQ\r\nOqyiqr9LIHut6ODtI+QJmsistdWliKEUxPeLHi76J8wPsQPxwxbrxAaF+DU/\r\nx9bs2oZCV3KfTpPy9ada052L8eBolq1eqK8I2bll4P1EsCOWy1xflWYobrzD\r\n+P+FaY5D0dESpSnxeA318Ru0EvdhS5qib1URTvUFsGhJNhaYd5ESdedQYlsB\r\npKQq4b211dVZmO4fHxDsfHjnJa2INoFkx3JGq5AOmcNWYU6cn0uxRghGAQ2d\r\nFcbb3KfekmumIoujDkpyTcq2ZA8Hv3RgSmgQ06ApZbU/s+jSPWBcDp6I/5qn\r\n5lJA1VvgxIlvMDlw28QSV6ktisX1+4CcZMGsDZNeKlgawcItBuMvl2h8SOTn\r\noEf+mRsfmrN2GcQHkknggegK+BaAWp7z6fGfOKVPpJjRDwyragc/3mFyIq5M\r\nyEVtmlBx12Nwi4J7qeodQL+zwkzyJ8F5O/nBtXUneyGKyC8KON9146bUXj2y\r\nrVC9qyqvylqM2sA9G6I035QzAJrI23Lmh3s=\r\n=w7mM\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.21_1649684135262_0.750729380092505"},"_hasShrinkwrap":false},"0.0.22":{"name":"ternoa-js","version":"0.0.22","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"type":"module","main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"types":"./index.d.ts","gitHead":"11c392c01f14418d3881d09c93b456cd97d95a4e","_id":"ternoa-js@0.0.22","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-tLHGkPNjm0TvzN0gXXQ4S9yqgn0r3BvOc7G4v7+ScC/jmkXOyOs/29u7eetqvg19qt+6ygIfDVWEX32PNflhSQ==","shasum":"2ec785719a65d3168d00cc41fc64b516f80ad971","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.22.tgz","fileCount":21,"unpackedSize":54490,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHlSJilLn15kysGrouMHUy+dvZm53XPmX2qrqK0188j4AiBhnFdQ4BFV64Iv/a5LbMi9Ql4fBNcdr6b8ZFZONiOoMg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVDK9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoBKw//aeoOVDG+mhUZi8SFck/Fi+OzN9bpA7xQPhMaQtrlndtlhDR6\r\nmyQVHJFBK8VxGHEvlc8q99k0+/n33mZj0NtR52+13qbLVreysIaemgQCZolB\r\nezODfQDRktjtJHrDhWXP9j5O9N88T5SG7S72qTha/7tAXhcUThmLLIiYtZAP\r\nDahNO6eQTT3Y63K8YT84k7ll2V8Og0kkYmSgJEVfpYahsFVJjPWi7MQSULAL\r\nDc11G6cmcaWJlJF08IZhaPX+Ck5uvfcOQDmcQdXJ4LFr9p/6S5tTb+wDM+oE\r\nkctVmozdkujmbzHK9uBL5tyP7DgzZiEzxGlirgNrhMuU0mYLDMcHnlcWo5jG\r\nIziutkdo2xYiTuJnsifPugfaoEJYqaF7HIQKj8jtMskSKEsoNrbzJWf39UBp\r\n+TmtikF6QGfBYiKpMqa5xOhSosRTfu4bGeqpkAHfbUipDZCWBnYbmQD/O4ih\r\nnqecAv13K2o2gz30ddttMa7iWioRJq6fO6vWTJ513G1ZHelQcYbl6hsdaYE0\r\ncyunwMWV6CEf7105NuThqa5NdjG1onqRn2VOzsxpD78wkM+9hdPc/LquxIlJ\r\n91UeYwl3FSlglttEhGBGPdQjRQz2kgqng9pz0BRhUkn6L/NxQUViTiYf7+0R\r\nzEOpGPwQMiAqltxJD7Kc+RjsqLnSVL6X7LQ=\r\n=Thwh\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.22_1649685181123_0.3272971107213265"},"_hasShrinkwrap":false},"0.0.23":{"name":"ternoa-js","version":"0.0.23","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"types":"./index.d.ts","gitHead":"079651bc9b3988cd2e32df75e4312ac2c0f1c32b","_id":"ternoa-js@0.0.23","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-ZKr4jIPTw/em/ewq6W3OiMeomOCtqduL0pEJXOOItpz3ZIbxJCSl514LKc4BjACSnUVfJHEUAZSzie3rwJGhEQ==","shasum":"4bb014c7149c385bab1590120dfa5b352e566f8e","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.23.tgz","fileCount":21,"unpackedSize":54470,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCGXiuEdRv+ZxF+cqdj1WoEFesuRrfe6mqImInlcIZt8gIhAPbO0xRq4/zRi3RCUSQakrm2x0+sDK0le5KZMaDwh925"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVDQOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrrKw/8Dqdb5WPwNiCGkVabOtriOhMxk2el2GA2AQe+HTi09VCi3jGQ\r\nY5DMkkLwU6V8L4jDGp6iZzh+GFWd1f7Mlo0S5wE5IkwkBTPoLRftj5sVgTTr\r\nlllX7e+X9e2vSzITF5UDa9Nhd8vsHkGbyeKe/dBkoZEOdErfArtceQzTAgzH\r\nkFv4bgmajRc36HLVG3z+iKNGKF/RV+ajtf2/1JgeGRXlNJWVpO71MwXFeue8\r\nVGjznB98hq4pkHawVvHU5s8ihbfO+c5+eSz+d+0fN5LN1Tvf64b/J4Vw+W2T\r\nzdVVyTuwuJiE769hQ7KjB7jMc40ta1ilZKIDXCjQJtp1DSx1kBITtrrcHcJW\r\nyV87ENMNGqsbioYbK7dCuKTSNL9/sUzRL3f5uCUscVAHqdXw0884Z17X9vd6\r\nbDPDBjpCzlYWAZFvwC9ra00OWqwo0hMZVyxQzATXcP++/crQjDc5UU80M55V\r\n8A5VDZGpWkpKN6Tx98pzjtbULSz8ApNiC2WvuDbonxZRqF+Vo+81APqm0zMa\r\nYCdBY+UaAbNgXBR8gwUivVeHV1fiKGfRVpLhG/nxBVeAMBtnxyvICGc2Peq0\r\nvPyZsJ4qJiXIA5uMO7GuyavdHu0JQPWVfH0XPQjm0TI+2qlamO2xoJ7JidMd\r\nUH5MQ6JH88hsstB8GM3RV4YrfhmfXHQnWRs=\r\n=7SVC\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.23_1649685518208_0.5396706528277648"},"_hasShrinkwrap":false},"0.0.24":{"name":"ternoa-js","version":"0.0.24","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"types":"./index.d.ts","gitHead":"34ad967af0cb32453d3fdf5fe9d7e36e6b890c96","_id":"ternoa-js@0.0.24","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-f1y2ay/BEmko/f/NQHNim3GZoupeoxxMwnyFJCkKV8ZbXIl/zwGUR7zql9djOopmHmPQt5Q03dtdSQPFAL4R3g==","shasum":"77971f88e417c5b800acef407a90131845a88af2","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.24.tgz","fileCount":21,"unpackedSize":54312,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID/stBRp0hR03cWCB1EeiQTW2KZ3Za2uVl2WKRe5AyVoAiAW5rfxVkgIFGAdutMPRw7o2tfVl0WDphXPEodzicnlrg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVSXeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpq0hAAiD02fHrzIUsyFw8bpErKuunJ2jqKYDh8cJqr+YjLpRoJm88g\r\nKZJeB7XnHMlr3fBCafl2Y5RFRT3drKs7CSrxVmBblZR0pg0jHv7s7da1SEsi\r\nWNgWoymZmfLV2lfMN4/Og2vWl3alqAELAWKWEhotKiu5osotr0VLrwUJ9Tt0\r\n+2l5Rd8EKY7OP/KvkbgCJ4faMcqP49FtbO1lATbC0Y7Ayt77UDvEbCdzCc41\r\n4f+TpdflVmmrQPUBpSuTQwHbg7J2tKO/gHOVC+wC4ARyvTh1qvG10GrehmlE\r\n9CVDojiyzDikMSAZJtaPFaYezZE/4DqFYxLCwzHkFtr6081dFstYPm71NZNp\r\nOfRYVJ1EiqJvEMmb7uCXddD78tLEATJTBI1yRnVQIthAYBCCH+mWsR+bt3nW\r\nj7EjnA9t4TK79a6wo8X+lOE7Vc55adatP0mTAXpqodTJNaf2ZwZqVEBdbji/\r\nlWLZSb3odunc0bwPvcRV6kobL3k7WxdZ7McUmpAPupTupmDLPt/8fvVs0wjs\r\npyt2MiUa1yuWKttNfRC/EaHpmCHxKdS4sXjNUoKe2O5s267hHo0WIHLAIEtc\r\n0ChBtVAlOBBBsRVdu1GwlYsTj7mBMxI3urPUhoQhGgCfELgQ7/FL1TaeZPCF\r\nmjFyZnr2RHTycBOuZ1YzrlGXSXhB7CRfhYU=\r\n=1Pu2\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.24_1649747422464_0.9534509983094943"},"_hasShrinkwrap":false},"0.0.25":{"name":"ternoa-js","version":"0.0.25","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"types":"./index.d.ts","gitHead":"59853cc53fffd6fb23308685d45e63376328c438","_id":"ternoa-js@0.0.25","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-17muafWuOpsCT7OR117Pe0IT/6qKQsIUWikhUJSfYAhS6x+hGylWuUD/t2vWSixrWPrNnl4CdfZN17RmDq/Ehw==","shasum":"eda7408a9707ad959702f01711a6e42c32385a0b","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.25.tgz","fileCount":21,"unpackedSize":42670,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF7lR1xVW/JsFw+sfoPBN/p6qbuCS+uQextsSlePWjnzAiEAsUHhNgmsWPxFeujc63/xXUeCcBH97rqUt6wt2ev9rdU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVULCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq8fg//awhS+F11RejgYYHlKxLgbAl1teE+deb5M1Jz9ruUoRYnNUt5\r\n7G6y/ZuDUXTOsrgfngZ3k4vtjZtEEHcsddihJLf5kEAuk6kmgxi5lC3UE3/h\r\nTQNg9Q2xKk6918C79vgQS8AGjOfgC3OV9Ub0lC888vTATgO7IdN+2JSV/o29\r\ngADErfNAGlFr9GDTWfP0VZxpFRW9B1nzXOMEGhtM2rU70hhyub+n8UU01avZ\r\nGcSB6Pfob+bR+BW86D8fOKYb52HB3oaP1L9RdK2VjNjmMSp0QGIU4FHtHZFf\r\n7JzFNwpJI2qV5jAfMTEnFSLoXJr4GRmdD3ycnl6hk0EHxYhTP8rYb6aYBoTC\r\n+CWjoVTq7kUx5lQfK7sUUHzLhAgGoTYqTlfnPON6mUYLfW5k9xyJeRc2OP5f\r\noYSt/+5LVq+gyO0V+Z2DK5HNo+DdWGzJl2UjWr8NfFVtJguSjlAxV7vHUqeU\r\nIDQNefIyUXi9zkA/atWpbRKUxivzJ8QK+dTpQHXvoqYe5lGwzbMwz7b54+Sa\r\n4LIzX6XTfAdMMJfMPgGy75dEnz0cPrF5slXAue/0b73d93rYCkAle4Wx+kG2\r\nnQ1/zZSo33THQZDeP9FURGmu7ezQGElBxeOZcQ20Bon4OjXYBb6wl4kfJJOi\r\nRngyJiQD5KY19rMYWXUgkcNWBvZJw2IqUxU=\r\n=Ctoa\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.25_1649754817991_0.38183729298645686"},"_hasShrinkwrap":false},"0.0.26":{"name":"ternoa-js","version":"0.0.26","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"types":"./index.d.ts","gitHead":"60f18e05a2672e59b711a17394a64471b96ec5c4","_id":"ternoa-js@0.0.26","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-YxYr2B8BIAWmfCeJh7PDp7F4Bum81vuJHMTmfncdvAURdypRygc6dh1ne+dztAEMHrefpX0D8HWeTRS7R6ZRVw==","shasum":"a57f9e91a99860cf83d8aed903808ffb1ca5d635","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.26.tgz","fileCount":21,"unpackedSize":42670,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDewxlWSc2Fj0j6ZyPYKZXELuCBQ8b4f/39F0nNPbjyVgIhAP2o1JELPdkrNrodMbSyrj5mpHQSGVurmBZAVvc5RWRF"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVUcEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr5ThAAjYjeMQ8gsZ8E3eyPgBH/35vU+TOp8af+W+Usw3opAZ+oOPYA\r\nLVcAbU/5h3fWRilTb+ejzkvFrhIa55v4oM0YSVLkqBL2B6L8qcI2b//iQisX\r\nRRjkQ+um0eTVGZlPZOTtsej5bBHq4Vmbti+cpP+sv5MHookpsUUO537pWFJ6\r\nx9aEU14jxRvYPtVVnX8TuNJH4nKeQqWXR/GTcjYobc5nsNyYfqxMzp/Xmmvm\r\nQ40ph7KptKGe5nWk66tIUSR72f3Y5n/27bRdoxY7N2aS6hQKi7Un56mf0dAX\r\ndgVGAaGZEpbYTCYT+HE6hj6oV6xeXNTYtKBK8GIBUFxZdK0Jd0SWGYf9Fy9w\r\nlIpYxwE4S3XPfoCIuLXtsZB3SsUcWICXPzJB0fib3UjgRnTE4DPE4U325hjo\r\nMeBC1SoWCkxVh1AVqRGESU8S83n2KFG8qOmjQvBrNoIv+xNLs3cq6B5SmPou\r\nzNC/VAjYK8LJYYUSRXuQ+wZGnvWZu2fM2mY8DhlztLZSIbjxFRwXft7QAqOm\r\nc8skeTsS9H7MeAzgxSFMj9RLrVNWrAVhXFvcWu0wc4SSXWx96DZP8hMte93n\r\n/j+62A82sXFXwx3whV8zRWuP1/wzUCjjBeCZU1CPave5CgkT3e1EqeC6xSZ2\r\nkcmEvM2jFSvxRuhY9SiW1t9Y3jhR8g6izr8=\r\n=/Qyx\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.26_1649755907817_0.7626428712989479"},"_hasShrinkwrap":false},"0.0.27":{"name":"ternoa-js","version":"0.0.27","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"type":"module","module":"./index.js","types":"./index.d.ts","gitHead":"25f9fa56da5d1499d1060dd1e5be3be599848c6d","_id":"ternoa-js@0.0.27","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-QTW84iIjLGEb1cCNF5EmxRPngclqkIu+oXuKUQT2KCTjjgUmkeAdMCsnRlMXx/QQUM8HGL+8cbO/+fRa8UknRw==","shasum":"a80c6d5de1d8fa84bd54badf81b800cb7f12409e","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.27.tgz","fileCount":21,"unpackedSize":42716,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBIjBrf1JvLTb9wFWbEjhUq/rX4hzkPq7NrYucY0/IMfAiAvJGs0vw358Kr1h7tGIXx618ixQAiu/JZes+WcbfPppQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVUipACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoX0Q/+KPyzMhY1/+O1caA51SqF9f/8HGbzdk+0t8E8qgh6DQqnJThr\r\nT0qmw0tX3W75P9QQT5yBXLI70dOmOh/z2j4G8W4BT6yLViezEwLnfHfTaQ0P\r\n50zkRCkcfU4v4UgFUW8OJG81tlNxAN8X9HgqIw2NKvFFaY19XhhppdI7wneE\r\n+NJxcqv0GOBZX6hvXuEN+9M2hrKJIHA085jYoo92GY+84ePEY3irZKnD0H8f\r\nKuG95j0/xlbsg8R/5u0Fo2TvoBtIQ7eIomJxQYDrZUpi732v2eyi9/iyR6z7\r\nf/YFVM/6s7WKac9j1m/jIBMsMX+JKWg6uSQqcONO3jNCqA43KdnO/bCu9Ioc\r\nBRm9GYlhRfuwwJfbKMoC1OcEPiEWy5R9+/VT/sysJT7qO6OBUbZk/uAeNV16\r\n/TvboN23sWnxGWxJwJbLns+BXBjFJu2NeTYUptBUZOGRmYffh1WPB6cUONoh\r\nMVJ9Prd90ugaJdUfAaXtECeosREQe/qVEwfoZTAtK/kpoaK+8I2urnJj/gXq\r\n2aWUve/or+B/BEpZuy8adX+qo9BThtvuPsWo8J124FtA7q/uukBbsptQazTn\r\nM4+1yCCSGdjfML+P/hQavnk3g8y38CsJRVUBT7az7AxD+5SU8E8b2P0P5m5S\r\nh1aau6pJ9cuNYVINBJLZxbvEL+JLMoECsCU=\r\n=90C3\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.27_1649756328881_0.8723781913400941"},"_hasShrinkwrap":false},"0.0.28":{"name":"ternoa-js","version":"0.0.28","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./cjs/index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"type":"module","module":"./esm/index.js","types":"./index.d.ts","gitHead":"3c2f278db2a75218a66129ece97c250791e225a2","_id":"ternoa-js@0.0.28","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-ONADSd8luNJl6mtTRECYc3BbpM8lbCSErvjD7Wqjqd8wAVQQs6IfCmvTt+c5Mbj6iTdtBCmVxPZeqQhv1839CQ==","shasum":"17bfe115acf3fef9c4f81b3f5f34359f19d283de","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.28.tgz","fileCount":39,"unpackedSize":84774,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDr0sBkQL672+8fi8eMi4DD0NjekEUvKA9T3d6eNSZblQIgFnWtMNBtvwIyvm10iKsy/qcyCp9Mx6UBZ+CUygl5v0g="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVVB3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrVSQ/8CeKM1izfafChHHPd9aFdOlxapQO4N4UfXcyBc6p9hIA9W5dL\r\na5aM+cf96l/ktSX9mhqtgW1zxsEiVvWmvYS2qWx8XOKTAP9vs5LWlCvmpVjP\r\nrQKkDjjFCsTH9BOaRT3MZGyWcsL+Y6p/tFZlELm5fjMxSvXpFIUrmB29k59u\r\nU3x76SgJJ8mJk6RBhjU8XIUZ978usTFC/r5S7FW5e2WsnRJf78p7xH0ZpbPH\r\n31LeSsxUFjNixR26wgSj66ldImQ1PvNhWDINxEtVqGxRb0neH+R7WlRsfVe5\r\n+/opDHkiFuHqD4p3aGJs5aJM6ElacSx9//BtcaJYKNTK0/tzYbwpB1Dpk6mg\r\nSmfnYpYvLpbwFXud3IV4viaMpx73jrdODvZBm9yr4SNQ7qytYPVqTq2E5zam\r\nVcHu1M9jfZbce0CKtsO9lzi4zgJYxGSf02GB4IkP2f7Pqd1OFyNuIHTWeOqF\r\nZW9oRTboMEYaSZ9i6HcaZbppTxASuHClHFXPuiZpGiNpxrlV3rQvgVC+9hm3\r\n/ONg8LBJanKEvl+uOh/n/mx8U5VLn+PgEaM5OoFjwzDE4PDcrZu3QI38isV2\r\ntC3d7174IbjlmWHyuEtdkuQQv1mcRQsRKRaoFdjoP8txaKmnKBJeyqc8ekXU\r\ny/KQqIqhv90IFdGDEb4+Yr4tQVggrtIZvRo=\r\n=fRjZ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.28_1649758327767_0.43997614403640006"},"_hasShrinkwrap":false},"0.0.29":{"name":"ternoa-js","version":"0.0.29","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./cjs/index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"type":"module","module":"./esm/index.js","types":"./index.d.ts","gitHead":"3c2f278db2a75218a66129ece97c250791e225a2","_id":"ternoa-js@0.0.29","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-wlGdIkOHJd/3lQL3TVQ+ooHJEHbtT1kCKMcTZ6PzblyD3otb/jUsxUJoeGjZ3ScSFk+jKhlx6gmqNjQIBuu9iQ==","shasum":"811beed5e8f4580c4b1dd98b06ac5fcac8436811","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.29.tgz","fileCount":29,"unpackedSize":72026,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBNUj6F9bBAuKaIDVID68YxobZARNvNM2JAA/1ePoShiAiAIcUS4uzWcqtibe7n7ceyD6GZ3fTr9DuJfIEu8dAseig=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVVIJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqPgA/+MmqkN2wSODF/3yhqxXvjhdRxS0fexo+vqz0feLLiC3vQttEl\r\nihX6jwBoY4if/12D1Srta9bf7/fPawKk4YpCDHRGsrkXnaTQ552+pdkTcQJk\r\nN3rkz8bt6Km8v8vSykPWSh8zxC4L+XzdBAk7RI9Llf/+vJRKmvF4vvmT/TxT\r\nX0k0MAdWWvS+28zdCebTAWC4wFXa0XsDnZHOJVe8GyF0FlRLmSR8L3NsIBFl\r\nsp91wHSxUcGM6rb4lM9NMkwHHl9hKNKX4iQMBFEhiOaWHE+oa8ijKP8Jzra0\r\n19K7YE/kRsOikHB2RoJ9Vz/IfgaXtOszZHYairNeG8eFoHML5BprbIfouizd\r\nHaehovylQ9f1Hja8+Pvj4+eRmlq/Qq1wdd9vp26LGC34ynaffqFHxMJnHF7y\r\nhraqzq5l+ZQdD1Vi1sBbWw5YtkMJzrg3RNnE7IAolSvi+kUopH4dYcD74XRP\r\noEF7kr+0XeEE3+1DvbbqgT1SyoG4pktnFOH6DCr3EZ9KhTha1jUK/xqzmfvB\r\nDQ2bR9MT+jr+tcXf3xnQh7gzHLiz0k39DpcrTzpiAWN+mPz4UeEwwbuxSlJu\r\nJFPISRs4F5UvvtD2pJzuHlpAhpeGlUVIqo9fbMct54KE8WeE8SSxREnCqsrY\r\nUAToeUdFGNQ9cgAxCc+xonF3qrcILbEJRLc=\r\n=1uuv\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.29_1649758728952_0.6248850316262771"},"_hasShrinkwrap":false},"0.0.30":{"name":"ternoa-js","version":"0.0.30","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.cjs","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"module":"./index.js","types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./index.js","require":"./index.cjs"},"./account":{"types":"./account/index.d.ts","default":"./account/index.js","require":"./account/index.cjs"},"./balance":{"types":"./balance/index.d.ts","default":"./balance/index.js","require":"./balance/index.cjs"},"./blockchain":{"types":"./blockchain/index.d.ts","default":"./blockchain/index.js","require":"./blockchain/index.cjs"},"./capsule":{"types":"./capsule/index.d.ts","default":"./capsule/index.js","require":"./capsule/index.cjs"},"./fee":{"types":"./fee/index.d.ts","default":"./fee/index.js","require":"./fee/index.cjs"},"./marketplace":{"types":"./marketplace/index.d.ts","default":"./marketplace/index.js","require":"./marketplace/index.cjs"},"./nft":{"types":"./nft/index.d.ts","default":"./nft/index.js","require":"./nft/index.cjs"},"./constants":{"types":"./constants.d.ts","default":"./constants.js","require":"./constants.cjs"}},"gitHead":"fc4d1fa487252ad5b13cee564181337bd98334e4","_id":"ternoa-js@0.0.30","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-cdbgY5w7wC84nMBglR006Vaf6bDRg0rPfnJZtiDR7/OL/S0Fuo2neVD7Gkuk+eAWPeY1cxL63sWUH2DkTS6spA==","shasum":"3d189821a8e63378bac81527c0fad7ca92ac72ba","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.30.tgz","fileCount":39,"unpackedSize":86007,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCx9aB8vbDHGNPsHEHZXOXxsTydT7whET7/xZpvJSlGcgIgVR7IhF3OR5pY4tCsKpS10nmt62zFxqzy6Iaw+33Ff3w="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVVhaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoJ0w//YomzjPSxJncEcpXZqj831GR8oOV6wmX3pkuuagNXNDA8qW07\r\nlBoWn9s3NAMr/NwDMp1RaUsOmnU6rgpz+jnCsjmh4+foZxCm9oHCY9xDqp3G\r\nHP8BddSImvU7837umVIXTn2xlMvYZ0YjKNLev7wTvE5DSuqGy34UcQaG5vsy\r\ncyUX6+cYnZwRpPXw1FpTC29BdEMliNyi9KdK8RQ4NeZ8U7dRxzstFB9VWo3T\r\ntgTOE6r/sXgB801L1DPHuPS0pqgWFtYA7F8FM98KOaarCL8jiEbA7iF1wCxE\r\n1U0SeAPtyRH8ZQ5Z/14JmWFCGio6KEkOJlq23B9R6Prnqp0NyvsAb1lbxExJ\r\nuHVcEhGZYfrhrv7sZuvMQ5FU0lglyau3mfstYGeX34oiYGK4DQimAfehjyvO\r\nj+cF7Ps23kezupHLVSqOU5oVjo/km0OwnnBCji8OHo+75SOFDaayK91W8OzL\r\n9vsKMPwxrYzQrwPYZKlAZA5FgBBTpvvvt2UJp/6eRlcVWYMNjnfOqeDH8V46\r\nvL+OkB3Do4X/YFUTRXwILHTfR3u2yWve/FH7GVz5QC3Fza9eqxkhqt43I4ec\r\nFl0oHnKBRpP7GEQ6pHEaOtekXL5jYFntN9vCBD/fB4kOGo3V/9yki1hUPXNd\r\noZ4id6Ya6HrxesjnFZ486snUxdU8mZLOOf8=\r\n=qhm5\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.30_1649760346075_0.007926108224489026"},"_hasShrinkwrap":false},"0.0.31":{"name":"ternoa-js","version":"0.0.31","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.cjs","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"module":"./index.js","types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./index.js","require":"./index.cjs"},"./account":{"types":"./account/index.d.ts","default":"./account/index.js","require":"./account/index.cjs"},"./balance":{"types":"./balance/index.d.ts","default":"./balance/index.js","require":"./balance/index.cjs"},"./blockchain":{"types":"./blockchain/index.d.ts","default":"./blockchain/index.js","require":"./blockchain/index.cjs"},"./capsule":{"types":"./capsule/index.d.ts","default":"./capsule/index.js","require":"./capsule/index.cjs"},"./fee":{"types":"./fee/index.d.ts","default":"./fee/index.js","require":"./fee/index.cjs"},"./marketplace":{"types":"./marketplace/index.d.ts","default":"./marketplace/index.js","require":"./marketplace/index.cjs"},"./nft":{"types":"./nft/index.d.ts","default":"./nft/index.js","require":"./nft/index.cjs"},"./constants":{"types":"./constants.d.ts","default":"./constants.js","require":"./constants.cjs"}},"gitHead":"83c4abe076199c45f3c732a374c2c618f94b8306","_id":"ternoa-js@0.0.31","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-eq/LwudPhMTjJ4EYzOYRttAfpuizrAfLgZfrnabq8c6moJZ3CMsJ3pwLtS+5zjMIWAJ9A3TKXjN0hEwVqb+1vg==","shasum":"b57941ac3044e61f91c7b0da82cf9079c8ce78bb","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.31.tgz","fileCount":30,"unpackedSize":74490,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG699EhQSwmbefmsCZCqAFo9dgCZ2Wj19AuROl/akKtpAiBPy5XjunA15xxc6ijDRthc0bhjP0fogAsrU6ggJt6Yig=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVXe0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp5IhAAmy7a6TOxXS6r21sqfkuWuioS6BMp2NLPVR6jYOau8XWBaduG\r\nod7LjxqFX9ds9zReJP/w3eogUWv3xNaQ3w0R9upE3cRGe3EoW5uy2iEJYk5L\r\n1brZrbYVe/CBpqKOcSaRAiYROJ1yqxjNDod1uJoLHFh31s+AXAqqAPEAXBi9\r\nnne5yvPNU2N0L4TZJWV02Kvl/Bqwf+X945itkEkqGoQ+dq065c99PggNmQ5N\r\n1XKR104tczA4rGSo9jwh5WdqfdxkYsTCe68FwHGphioWOAMXuduKbu2RLbnx\r\nM7IKGbylfZllYYKJzeGLcpQ+PYrxE8raTkaKp00lv27sX9VnfUHZTiq8P1nf\r\nPzXdOVhKidE41FIOgmne2N56fYzMSegnsIKs/5CehZRm2aCXXicgj/GmF+98\r\nak9Zb7zLapfSiK6t80IM5DT9jbUta/TZTH/s+URaUcEn9/uKRrWGSZYzn4tq\r\nIkTAWN6EUWD8sIjf+E1OHH6k4CIcKF4Jt6pSG225yht3IK0le+UDXAYYkpDA\r\nYE9RncrLfnmeL3+8ytalkcnIsdcLPIhOhmX1fq/tBsToJQDLq+2zKnw1Fkoh\r\nOMNPHwAtJGv5X/zPElXBXGWOVtVw7siJ2dB9ubeW76FATLifnpgG8T2DeIxb\r\n3UoPVVxZumMwZl6ypypEynvHiJVR8DjFTHo=\r\n=Wu1F\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.31_1649768372814_0.05467570809522915"},"_hasShrinkwrap":false},"0.0.32":{"name":"ternoa-js","version":"0.0.32","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.cjs","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"module":"./index.js","types":"./index.d.ts","type":"module","exports":{".":{"types":"./index.d.ts","default":"./index.js","require":"./index.cjs"},"./account":{"types":"./account/index.d.ts","default":"./account/index.js","require":"./account/index.cjs"},"./balance":{"types":"./balance/index.d.ts","default":"./balance/index.js","require":"./balance/index.cjs"},"./blockchain":{"types":"./blockchain/index.d.ts","default":"./blockchain/index.js","require":"./blockchain/index.cjs"},"./capsule":{"types":"./capsule/index.d.ts","default":"./capsule/index.js","require":"./capsule/index.cjs"},"./fee":{"types":"./fee/index.d.ts","default":"./fee/index.js","require":"./fee/index.cjs"},"./marketplace":{"types":"./marketplace/index.d.ts","default":"./marketplace/index.js","require":"./marketplace/index.cjs"},"./nft":{"types":"./nft/index.d.ts","default":"./nft/index.js","require":"./nft/index.cjs"},"./constants":{"types":"./constants.d.ts","default":"./constants.js","require":"./constants.cjs"}},"gitHead":"5d1f906695f16989020536a6eb6db13941d0964a","_id":"ternoa-js@0.0.32","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-7W4shQ+hC0XX0UUOYBnm1rFzo0m58lNDdyIQKt1FTKw+4Et+CggPSL7OcLPNJCYHvg6kZNtRfUz2s59ZcDnB4g==","shasum":"eee1a56f82b6cb063f64a6dc789bd16c2a0cff30","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.32.tgz","fileCount":30,"unpackedSize":74510,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDJSHaVdJc6gg+933WYRLJx4bedbnGmG5PTJHLE0maVQAiAIGqAMRyHXvGZgKyKfY031EC7FjqloEBkn4XQUgPoKjQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVXm4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrZ+A/9Ev5EsfBu9N4ympd8z9AexfJPpUML85hQ8kMtZz+usZZTPfvg\r\nOFpUJwizcmoPQjLgiReWD0zQQI/a7TDhHCm77CMsI8TUIyoiPoga30st7YPI\r\n/aQdXI8FK3Cy0X8CWTgiuq2yi3B7TBrn9dIm03YXHeCsezrXwFUDGzVFx47a\r\ncMZw0XzgNyBOddhx9fhEuJvmKY39sbllqqAaFZd+qGvGP5g010/N2Sl+Tjdm\r\n5lr5hQkFEWD3AVV4nwbs5ODJOwFLsAYf+OcjfwOpJJbc+KHg+3a2vN8ZQVoq\r\n8MvTUxYon7YPgHaxjEVQUEZUNt0TAHyUn+2sDKUnLK4wQ3eBb7E2uyDUP3j4\r\nsPjPOj0hqe1VyUl3tUWJrEokAUTGrSksQWAvYJingbyNRlL/RKM/nJYLhqHJ\r\nd6jFC3IsypzkOnguJolKYBIW0kUAL6ySkNdQnra8WeGVEJMXe5OJP8nCT7Qm\r\n6u+RQqDEcv2T7jGFPRmzAsgmIYu4SI4BdaA3/WS1XZiYDbWkRLSXdLvsGx7G\r\nJYqVxHwBG2Gj51wy+Rk0YunKmB8oSApsthJRhjI8hw1Lfnq4vuPpFSGfunpq\r\nCR2vZduQMfB0ve6LVY/PZ6Znp4UUg5SZM1dxQ8zqyAndNr5/bFqeTiKTTghY\r\n0rIGlqZE6NHomPz1aAmL5CsXj3t5C2GhVhY=\r\n=g4sh\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.32_1649768888570_0.5865116900440641"},"_hasShrinkwrap":false},"0.0.33":{"name":"ternoa-js","version":"0.0.33","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"index.cjs","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"type":"module","module":"index.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","require":"./index.cjs","default":"./index.js"},"./account":{"types":"./account/index.d.ts","require":"./account/index.cjs","default":"./account/index.js"},"./balance":{"types":"./balance/index.d.ts","require":"./balance/index.cjs","default":"./balance/index.js"},"./blockchain":{"types":"./blockchain/index.d.ts","require":"./blockchain/index.cjs","default":"./blockchain/index.js"},"./capsule":{"types":"./capsule/index.d.ts","require":"./capsule/index.cjs","default":"./capsule/index.js"},"./fee":{"types":"./fee/index.d.ts","require":"./fee/index.cjs","default":"./fee/index.js"},"./marketplace":{"types":"./marketplace/index.d.ts","require":"./marketplace/index.cjs","default":"./marketplace/index.js"},"./nft":{"types":"./nft/index.d.ts","require":"./nft/index.cjs","default":"./nft/index.js"},"./constants":{"types":"./constants.d.ts","require":"./constants.cjs","default":"./constants.js"}},"gitHead":"ee01668f2036d75b4de2be58b62d183a3fc2795a","_id":"ternoa-js@0.0.33","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-pa/apwbN+hQWGQjZ4dcEIarEzMRhMy75j+tIT04g7SH9jmzTiC4bClEqwTsbGzEjFeLUa4eLY2YxDC+WvNGMrA==","shasum":"51e880dd35e2c045e8b88e3d4e2f949a17b4f988","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.33.tgz","fileCount":30,"unpackedSize":74504,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDlthVWwCTV1Xt81O6IMDcif6OjL0K1lTkpjfdhqkJLHAiBhnQm8dZh7zvo1iPF1QLLxgafdksa+THQgSUIbzi02YA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVX6VACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmozjw//WhChPAmVjlrhdleYYfu9zaR42AQOg5O8naw35b/brkjutgN5\r\njQ62bnk7xzdJ9z6ZMyYX9ilU4GMRpbHH1SAJzlku2Rpkozrgg7hHukWD1m8R\r\nHStY1HVSOJ9FedKPugiyd+cH+MfTf0sDH6lFNxeUM5uevIpcLZmp5UQi6YxJ\r\nC03ohiUQ5ihiZhAiR22/xqmLiuJXhzoLN189kts6gwN9SgJi+Op2xhpew/g+\r\nPKZik5ex/z0atWZYWTlQ6ahJv0Jz91v/t8siSqzoXKd1FMV3mjYScRRX9zm4\r\n0j21dDgwSMnaz33zinBVsaDDAkA78GTtgrmnUFsCDewV/F6qT1aX5EyotMpe\r\nGyvfQqdzhyXdaXBWg6dw2ufscxvFRwisoa6xDS0YbxnJEv5Yed285oii4+Zn\r\negxP2E48K4u+bgNGBxuaIuwtZ3OcBRKBsdgSFmdslJFgJ/JyLFlGMx/uOrvm\r\nwPMob8seyyb54lwzsOT5tDAAfzvZRZStNy51aM+8xk9McEqGOr2dIjLTj0XQ\r\n+ykmCDo72wFOeF/4ezZeBAAHXbaKhrbefJm2MHCnvCMEG3w2bdUIi5EXYZm8\r\nRGivtw5P3n9DZVAJ5DwwY4bMMTUSfppj0K5+wEIDPlHtl81wN3teyP+iyusU\r\npODSgFmJj7hyerULpPgAZm3jgs6eUTlkaWA=\r\n=h1Lp\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.33_1649770133100_0.1916616911841682"},"_hasShrinkwrap":false},"0.0.34":{"name":"ternoa-js","version":"0.0.34","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"index.cjs","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","axios":"^0.26.0","bn.js":"^5.2.0","dotenv":"^16.0.0","graphql":"^16.3.0","graphql-request":"^4.0.0"},"module":"index.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","require":"./index.cjs","default":"./index.js"},"./account":{"types":"./account/index.d.ts","require":"./account/index.cjs","default":"./account/index.js"},"./balance":{"types":"./balance/index.d.ts","require":"./balance/index.cjs","default":"./balance/index.js"},"./blockchain":{"types":"./blockchain/index.d.ts","require":"./blockchain/index.cjs","default":"./blockchain/index.js"},"./capsule":{"types":"./capsule/index.d.ts","require":"./capsule/index.cjs","default":"./capsule/index.js"},"./fee":{"types":"./fee/index.d.ts","require":"./fee/index.cjs","default":"./fee/index.js"},"./marketplace":{"types":"./marketplace/index.d.ts","require":"./marketplace/index.cjs","default":"./marketplace/index.js"},"./nft":{"types":"./nft/index.d.ts","require":"./nft/index.cjs","default":"./nft/index.js"},"./constants":{"types":"./constants.d.ts","require":"./constants.cjs","default":"./constants.js"}},"gitHead":"e20bd321561367aaa10d8aae812f69c773be52c2","_id":"ternoa-js@0.0.34","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-KCUK6L25xE1LycAhZSFhEIgcNElEzK6FGQ0RenOuLRvsPnzCc4Rc4pgTkRtOVxw2oadvHzd+5pB2bzna0dTPPA==","shasum":"0831e7e531bfecbab49cd20bf0e8681c38757a42","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.34.tgz","fileCount":30,"unpackedSize":74484,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDcHFWnXUK10SlkWutGitoBHPXZNxT/iRRL/8KJs9JpHAIhAOvZMEI5fYQMLu8gKJm4I34xYqJHJoXonvNiqP69oY6u"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVYCdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoulQ//ZgVl6XDvaGDvRyqQ4NRzOvdvebGM16MQAkxTcjkTB93ZOpBu\r\nfcZVN87iMp+gf4P+7oepJbIfJL5SUaPUdzvfeizICFaWZcPjoTaqSH8GM+k2\r\nAXTrhhEu/++L5iwn00fyFmHU/CNQgIIEG8URmhstA6CUc3Ttg3soDkjisxca\r\nOgX3xpGUtFMYDfhZ1HRNpukZezOObQw0LyQnuZk6XDMvyPtRFXA64CSmGLKc\r\nHQtRhxVDwCfB7ayw55bvs7fqWEiV4baZVQKbQS/xaS+A4uAsgshsrSW+Ydvj\r\n1xsx4LPtJS6BM22ZmmHdoRjEAubRT/iSECYaRG8wmYee2XL9O/vjcl4q1JHY\r\nPIZUcH/bZ+nc0Y56DubchXNgLLMhjJHvXH0WebCmTYoviw73piVa+1DfLR7k\r\ncvCjxip02gY2cC3NzfOHZaCfjfPgiMWqOmwa/UQSahqI8qc39vpUiB9qNm7k\r\nvMUiKBLlVHnTwwAVhJnoykBMiHpTs4FHPNCfjsKGcgSRM7B/hIMKPWRpzh91\r\nZhwvCCIjeqN7qon2+1sOvaEBjeuQsCaIuxxW9fByGfqUbpQsdCwhpdQjp9kh\r\nDFkz3MQiBbkAtOmTJy9WY9ojX3tDzlx8AnDH25oSQhFYZ+QVSf9G8UGMks8y\r\nFZMF0pdtyITl6rfECKWdW6wrP8pvpcWA0wg=\r\n=3V5W\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.34_1649770653148_0.2734015231111242"},"_hasShrinkwrap":false},"0.0.35":{"name":"ternoa-js","version":"0.0.35","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"index.cjs","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^7.11.1","bn.js":"^5.2.0","dotenv":"^16.0.0"},"module":"index.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","require":"./index.cjs","default":"./index.js"},"./account":{"types":"./account/index.d.ts","require":"./account/index.cjs","default":"./account/index.js"},"./balance":{"types":"./balance/index.d.ts","require":"./balance/index.cjs","default":"./balance/index.js"},"./blockchain":{"types":"./blockchain/index.d.ts","require":"./blockchain/index.cjs","default":"./blockchain/index.js"},"./capsule":{"types":"./capsule/index.d.ts","require":"./capsule/index.cjs","default":"./capsule/index.js"},"./fee":{"types":"./fee/index.d.ts","require":"./fee/index.cjs","default":"./fee/index.js"},"./marketplace":{"types":"./marketplace/index.d.ts","require":"./marketplace/index.cjs","default":"./marketplace/index.js"},"./nft":{"types":"./nft/index.d.ts","require":"./nft/index.cjs","default":"./nft/index.js"},"./constants":{"types":"./constants.d.ts","require":"./constants.cjs","default":"./constants.js"}},"gitHead":"d6d6bc7aaec7aaf6e84b1756f95456c8d331ab72","_id":"ternoa-js@0.0.35","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-QGJLmTvpAI0kCBMY+tUe8hZEcGeZCcJFOY+VbPcm13HQJlIis8U5wFwMjb45Aw/5Qlwcyt6oupCGFLGg4rEMIg==","shasum":"b814ef38bbaedb57e53af9bdea27907d2bcf3e60","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.35.tgz","fileCount":27,"unpackedSize":72213,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA70gaoXy8RPoPRfEK0xasJbN+D6eUeDD+FbV7Q8mz3+AiEA8CYKe0cNEtttdcfnE0qYwYHgOz3PQ/4ystFVMNe36vM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiVYKDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmppeQ/+PhyA+MKbKgb8O84Hz6p7l0HXmumvxxUbSSGceclH1GpUQfD9\r\nNd82fBlq6BQjNnxwFBGGTaL7gvjltZUVelfZV7NrQ92CdE5m9H8K0TviPngu\r\nd+Pbrf2GvezyDl5y0aj6IEK6HdJoRWz+CnOlqIFazIAxh7nWKQFp8+BExVgs\r\nRQt7a21KhSVbG5ktpJtArT3PJ7JqU6QrI28IREDiqQBspSvund/YloFfjpX8\r\nphPHcXJdYLgi2M68HUklMjAZYRt4sB6I2n8jG/MtPzC5CCcAQII4jVae9NM+\r\nShOIMmzGhiHAsNc1kNueaCt8otUd2ySFRiTdp8fWXCjnWdd3FgwWQdiZE0oc\r\nHdfkTnN5ApckjoSNOefAiIeTvuNDKOjfebOwiekqNuOpeoZJRZdRonTchgtU\r\nIIj7MAvZhRTPIE3edFkonyizVZYb1FF5U+DP/F/gVlQHGYrjbXVvk4xZ6L0o\r\nwQX5nymEXT4uTetu8StlDPCEtEWDJJeM8nxdNNlZ3I24dR2bj8YcfutS/M1p\r\nCINRzLROJylyCm4tVBkkqmc/6z+s7SIq0Nh7Rxn+s21EP3+wDBFNBTiJEa7k\r\n0YkR748DEFKN8qt6hJShjFeYY1CYVIUSct14Chw/y0d3ySjRGNwKvKsT8Jaz\r\nn3w/uaznQp1IQ6P6lKQOSM1PUzOgrff8DpQ=\r\n=z/XX\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.35_1649771139759_0.49332747922491027"},"_hasShrinkwrap":false},"0.0.36":{"name":"ternoa-js","version":"0.0.36","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"index.cjs","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@jest/test-sequencer":"^28.1.0","@polkadot/api":"^8.3.1","bn.js":"^5.2.0","dotenv":"^16.0.0"},"module":"index.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","require":"./index.cjs","default":"./index.js"},"./account":{"types":"./account/index.d.ts","require":"./account/index.cjs","default":"./account/index.js"},"./balance":{"types":"./balance/index.d.ts","require":"./balance/index.cjs","default":"./balance/index.js"},"./blockchain":{"types":"./blockchain/index.d.ts","require":"./blockchain/index.cjs","default":"./blockchain/index.js"},"./capsule":{"types":"./capsule/index.d.ts","require":"./capsule/index.cjs","default":"./capsule/index.js"},"./fee":{"types":"./fee/index.d.ts","require":"./fee/index.cjs","default":"./fee/index.js"},"./marketplace":{"types":"./marketplace/index.d.ts","require":"./marketplace/index.cjs","default":"./marketplace/index.js"},"./nft":{"types":"./nft/index.d.ts","require":"./nft/index.cjs","default":"./nft/index.js"},"./constants":{"types":"./constants.d.ts","require":"./constants.cjs","default":"./constants.js"}},"_id":"ternoa-js@0.0.36","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"integrity":"sha512-ORXz8f5GBvZiM9WvqGNwfglBbnjp1F4kZ+dq63gzVOYL3+T2ztimZUN4xrTzF8lS7izAIFEqMY3C7st9vlSHJw==","shasum":"5de9c5df36898cd91790d16744303aab6f1807da","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.36.tgz","fileCount":30,"unpackedSize":86709,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICOKHdUA3OtQd3CDcOJsuMYrwCIP8FIQRbJ5ysFXXEGBAiBrOySIjd42Y7Yg+08zj6CbJzi0luDBpweTYJXU+UQB2w=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJidT+vACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr1DA//dCiCgMsfoJDl6KkI36VH04EFdkARxMNzPtLvhir+46d63PPE\r\nJ+8iBhkrdyuS9hENxvzo8hlIa5MtsN5VaXRc3OO7DIDSF8+K0YHl3lOhRL4Q\r\naoVTJUD6bhxFUQMbpRrCq3vMizRv6tTsHg6FzKkl21tK/F/95CxkpIfErm3p\r\n432/8bHRPGZdmQesYeY9JS+hPctSEtF/RWiTQ++PbDwW0uaU9i6prTXek6Ol\r\nLNawloUQ0khNl4MyenoNakc+sqEmPcT4OCwfDMzYzkK6zixCIKjfVhHVe6Dj\r\nLmALrImDAXU4LzAnarfIul1UxqJrFEKclvkSs8LL04XpjKYNqGDivKMWOrjO\r\ntFfIoAK/vZWH3Bz0zoXG/LBr5GwSVtSCOGvTUQW5Db0QcLJNDHz1eD2Enfbo\r\ngogPmOlFWzmKrEmROnSz1LBXF/d2ONyDS94bgAH6X0XbLU8lTmeG0ndObreS\r\n9o2q+7HsnJ34rjcbHEYczz/LCssmthIX7WJyh9H/mzNdkU3j4QEmzzUvV8CW\r\nuUOHWC+E+6cKeSoJa+x714q9HLYaDRPDB/e68t9KoM5PjqgGyJOoGykOXGH7\r\nr9n1kCQfYYnc4tg87nR3LVBELCSVL8Q8jwn0nlbqO7RHheKFJsOaBpQoAPSE\r\nvm6vGTl/mUHhHdkbjrbg8zrMNtu1agqO5Io=\r\n=AnLm\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.36_1651851182972_0.7277943466971402"},"_hasShrinkwrap":false},"0.0.38":{"name":"ternoa-js","version":"0.0.38","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./src/index.js","scripts":{"start":"ts-node src/index.ts","dev":"nodemon src/index.ts","build":"rimraf build && npm run build:esm && npm run build:cjs && npm run build:frank-build","build:esm":"tsc --target esnext --module esnext --moduleResolution node --outDir build","build:cjs":"tsc --target es6 --module commonjs --outDir build/cjs","build:frank-build":"node ./src/_misc/scripts/frank-build.mjs","docs":"typedoc ./src/index.ts","lint":"eslint ./src --ext .js,.ts","format":"prettier --write \"src/**/*.ts\"","test":"jest --config jestconfig.json --detectOpenHandles --forceExit --silent=false --runInBand","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","devDependencies":{"@babel/preset-env":"^7.17.10","@babel/preset-typescript":"^7.16.7","@jest/test-sequencer":"^28.1.0","@types/jest":"^27.5.1","@typescript-eslint/eslint-plugin":"^5.23.0","@typescript-eslint/parser":"^5.23.0","babel-jest":"^27.5.1","dotenv":"^16.0.1","eslint":"^8.15.0","eslint-config-prettier":"^8.5.0","eslint-plugin-jest":"^26.1.1","husky":"^8.0.1","jest":"^27.5.1","nodemon":"^2.0.15","prettier":"^2.6.2","ts-jest":"^27.1.3","ts-node":"^10.7.0","typedoc":"^0.22.15","typescript":"^4.6.2"},"dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"gitHead":"320aeb27db2b11dcf4e449e797e654ab97a33367","_id":"ternoa-js@0.0.38","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-akGTt8ybw2gOqSjAV0oQp+BuptuLd3WtEPyt0yZ7dDi3SGNBKxQsVC0wED6Sn47K9KAy/T5cJqDpGe/8ET4mlQ==","shasum":"4853e165393c580c2a68b07752e302043e021369","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-0.0.38.tgz","fileCount":43,"unpackedSize":346535,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFJMqhJQE8lmfIqHQSUGiWbhFcNbTyGJr4jRjJcsxfiMAiEAsSZcUOml9LMQfdTjQB2KHFP15waCjDIXqVL8JQCBAsA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJifoTSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo4nw//RyzbX1jZ9Ga7Z14AZ+lZIYmIpnYH1QsBoduEYE0dWvv5FPAI\r\niy7Ygz6Hegtqo9UIPjWdo5eYVGnXL0GbqIpWNDdOUDmQ9FDyTCCxPBxLAr+P\r\nmU5446rPa8lshasEf5S2tCrOsYtgeNsCmnM98gn6Dv21aKx4IXannRArk2D3\r\n0aIRryug53Ah4g8KNQ1xrNebJ30Y8Memui9vzWldn6v+mZd92dlIAeZR6/3H\r\n5w0bBWKSeu6qUQi6mIJzHW70rCqMAnBgkwFMOHkgwqXWjFLUkoLPoa3kcYHM\r\nastX8C0ThSRToQezBiR+Dg2uJG+YNQNkQPRpMqKn+b3mQ/gAoIQyOx4WBDq9\r\n7z3v3gflj9EPY9P8tlfqAfLaT8lvRJkeFz5uS4q137pIhPM8XVYescMcEWAG\r\n4ccbCqR741+oW0aOqRwHTyf1gqC5yzk1yaGIY89l/uEBwvl3XKbFN1qJyrjJ\r\ncSN4OOuJz7I3pgT7T9FIK97jVIdxjO31xo+mDNv3hVH968evfPgKtWnv4eHL\r\nLAr16iB6WCUt6KvUIA52d3zb4VKUO3BwkvzG6roK8/4BiQ7bcXGdOj4I4ED0\r\nNVImRL7NdTA7ZhWvKkxxkmpkRt2yLUo48gNAKyOE//LNbRYM1mRePnebFRUa\r\nBBQOMlOAuZkADtXfsj5AL/Wk1Y4cdwbclys=\r\n=bYAa\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_0.0.38_1652458706667_0.6731409598887608"},"_hasShrinkwrap":false},"1.0.0":{"name":"ternoa-js","version":"1.0.0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"index.cjs","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"module":"index.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","require":"./index.cjs","default":"./index.js"},"./account":{"types":"./account/index.d.ts","require":"./account/index.cjs","default":"./account/index.js"},"./balance":{"types":"./balance/index.d.ts","require":"./balance/index.cjs","default":"./balance/index.js"},"./blockchain":{"types":"./blockchain/index.d.ts","require":"./blockchain/index.cjs","default":"./blockchain/index.js"},"./capsule":{"types":"./capsule/index.d.ts","require":"./capsule/index.cjs","default":"./capsule/index.js"},"./fee":{"types":"./fee/index.d.ts","require":"./fee/index.cjs","default":"./fee/index.js"},"./marketplace":{"types":"./marketplace/index.d.ts","require":"./marketplace/index.cjs","default":"./marketplace/index.js"},"./nft":{"types":"./nft/index.d.ts","require":"./nft/index.cjs","default":"./nft/index.js"},"./constants":{"types":"./constants.d.ts","require":"./constants.cjs","default":"./constants.js"}},"gitHead":"0f69f942b98f462ce766c2ec9da4e8a6b94a0e66","_id":"ternoa-js@1.0.0","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-V8z59gxpnkJWtvyqXZMLPHyvkl957Mbr0z3si+TaQLvDAQ0/1IX0BjHzUoPR3tlM3JxK3fqnf2/tKrwNofY5SA==","shasum":"390c86ade1682999735127b8e2a0143e8a49921a","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.0.0.tgz","fileCount":33,"unpackedSize":91332,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC3fF6vURspghT0h+VJEB6AQbb0wLkGAiwlbQssnl59RAIgbsslP5XJvjZGJFa7T98/G105f6s4oBhVZTl63zGSc+0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJifob9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpt5Q/+IBRzEa61PxZrJ7RmS//ILdgCennXtXoaUathFz6OiECHFCTb\r\n5c1lM8fqvaMw5rpeGmhUiGdDL6LHiQik+sg55ZYB2dJ3vE5cWm94As5XQc2E\r\ns6hzc6n3iK1qWvPUiveNgzXyfh1hvkp+nB02EW7Y/DIdmE8G5xO5UcVxtszH\r\nHdrUSd1Ny5Mvtd3ZPRx7j+cOVNSBDJiVsCzUji+RVKvIV8DOGW5npzCi/JaA\r\n6Ng5bQyAiPC9IZ8RfKQFdRiC9HmsYHndrBYUBPDuJz/rmpZIGFbsGpvuQeg0\r\n0PYYdRAS2YQB25twaq23l/PAjtWal0120mdVeRb/B2Geg+f4WyvgD/ZrFFzO\r\nxtqRtEa/2179EfpX9FCGHjFMjla1f7NIhEpLcR3cwZq9ZnBD0jmFynm2ijyG\r\npKMIjmbMU6woy6WTYAXmdt1to7xieBKe0q5WUly+nSOTcz2J+7Qw+MUNU6rs\r\npEg37ARoE+0H2yJZRi3FKSeu4bA4cGXz2ElfH5Km5/4IL5sC+1hFteSnJacJ\r\nfG8UkhKCbS5Pjcrvku/EQ5lYfrjnqxG0QJqMgMZaLirz8I1oowhOIgx/Vw33\r\nCdOUL78uRzy9E7+6fieCBtstbVYRAVRALkAIqoVqeXZfOTqgerCBN93wdJiq\r\n0XQ4cYwVEvUM4v2H4kQjh3oAbkWAdY/Niko=\r\n=4oM5\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.0.0_1652459260897_0.9109823092940514"},"_hasShrinkwrap":false},"1.0.1":{"name":"ternoa-js","version":"1.0.1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"index.cjs","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"module":"index.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","require":"./index.cjs","default":"./index.js"},"./account":{"types":"./account/index.d.ts","require":"./account/index.cjs","default":"./account/index.js"},"./balance":{"types":"./balance/index.d.ts","require":"./balance/index.cjs","default":"./balance/index.js"},"./blockchain":{"types":"./blockchain/index.d.ts","require":"./blockchain/index.cjs","default":"./blockchain/index.js"},"./capsule":{"types":"./capsule/index.d.ts","require":"./capsule/index.cjs","default":"./capsule/index.js"},"./fee":{"types":"./fee/index.d.ts","require":"./fee/index.cjs","default":"./fee/index.js"},"./marketplace":{"types":"./marketplace/index.d.ts","require":"./marketplace/index.cjs","default":"./marketplace/index.js"},"./nft":{"types":"./nft/index.d.ts","require":"./nft/index.cjs","default":"./nft/index.js"},"./constants":{"types":"./constants.d.ts","require":"./constants.cjs","default":"./constants.js"}},"gitHead":"9a62b2024fa87d96a967e425b68129a3aab8586f","_id":"ternoa-js@1.0.1","_nodeVersion":"18.0.0","_npmVersion":"8.10.0","dist":{"integrity":"sha512-eP3w0Bgo35v73bDVc8xTdHa5CjYmnPHAhV6y1Ge6Q5lOmiMrdH2HRdnhZGJRWmOJt/Oq/+gWubZ8//V1N5+URA==","shasum":"0cc3b8502cced9ef72c84ffea1a5c8e3cea8c309","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.0.1.tgz","fileCount":33,"unpackedSize":91296,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBsSQ+f/VE84+JEM1jdPfxrjsTvAGafYC9GxiTjCeFZDAiA5jNb1DPZDKDqXEXfl/KJaoz6p0iGWi/UbuUtItnQ4SA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJihQbiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmobtw/+OafU+WOuvo8CpevVgrf6EINRzLAFiVAFDLkAwlL1ls5gutdf\r\ncolxM5CCA/k49HWwAcOSoQqBy+v4Acp1tKY+qhwzCItU5oYo2qBp19KxsIpH\r\n6Yn28UPSvCZ4+1NuLDufjBzTwIooaaNUHdvXBt5rpnxpHd+OPyodkCMzL71e\r\nKTN4Z5teTAmXZ5+k5E2gAmBUbfnjjhDOL2AR49QKfw5iRCFlAYOlDghj+g+S\r\njzokVw4kRPZS4eFuTld4GTFrgyevkSkk3QBgTpz/BBwBKgLF0IedRTcQjfFE\r\n4NhxRD1/4/MC03MS923y6In7+R0054CFxjWf33AOXQm9fcfKYdPmhifVW5tD\r\n7yDLhx6c8pkPBgKph26EwR1uG5ubdlnGWS2PMxbPHVtpW5+KhXIxtaM27P0j\r\nGzcan6rzGPP2AaD/AM4umTgaqH6WFDm6AiOXKU2LtFJYbbJiE/z1HF9PYecb\r\ncV/sqE1vE2CySboo+JdOtvIEc8RwT4N+5L+gHjrfJKBUvkcbYayIq0mbHV/t\r\nrNRXR5jCYeXJJGqV3pu/SIvzCInsAgQiUS8vosbhhEYhQdt1wYoxx1lxdl+T\r\nupKddjtxXbk04mc4O+D/s3MSpLF+euJFzQ/VyUf2Z8bQfqdlk2VDHKKxu7ok\r\nmWcgRGXzPwFLipFq/R1+L4daaIFc8k21hFw=\r\n=orwX\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.0.1_1652885218856_0.17127560934643626"},"_hasShrinkwrap":false},"1.0.2":{"name":"ternoa-js","version":"1.0.2","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./dist/cjs/index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"type":"module","module":"./dist/esm/index.js","types":"./dist/esm/index.d.ts","exports":{".":{"types":"./dist/esm/index.d.ts","require":"./dist/cjs/index.js","default":"./dist/esm/index.js"},"./account":{"types":"./dist/esm/account/index.d.ts","require":"./dist/cjs/account/index.js","default":"./dist/esm/account/index.js"},"./balance":{"types":"./dist/esm/balance/index.d.ts","require":"./dist/cjs/balance/index.js","default":"./dist/esm/balance/index.js"},"./blockchain":{"types":"./dist/esm/blockchain/index.d.ts","require":"./dist/cjs/blockchain/index.js","default":"./dist/esm/blockchain/index.js"},"./capsule":{"types":"./dist/esm/capsule/index.d.ts","require":"./dist/cjs/capsule/index.js","default":"./dist/esm/capsule/index.js"},"./fee":{"types":"./dist/esm/fee/index.d.ts","require":"./dist/cjs/fee/index.js","default":"./dist/esm/fee/index.js"},"./marketplace":{"types":"./dist/esm/marketplace/index.d.ts","require":"./dist/cjs/marketplace/index.js","default":"./dist/esm/marketplace/index.js"},"./nft":{"types":"./dist/esm/nft/index.d.ts","require":"./dist/cjs/nft/index.js","default":"./dist/esm/nft/index.js"},"./constants":{"types":"./dist/esm/constants.d.ts","require":"./dist/cjs/constants.js","default":"./dist/esm/constants.js"}},"typesVersions":{"*":{"account":["./dist/esm/account/index.d.ts"],"balance":["./dist/esm/balance/index.d.ts"],"blockchain":["./dist/esm/blockchain/index.d.ts"],"capsule":["./dist/esm/capsule/index.d.ts"],"fee":["./dist/esm/fee/index.d.ts"],"marketplace":["./dist/esm/marketplace/index.d.ts"],"nft":["./dist/esm/nft/index.d.ts"],"constants":["./dist/esm/constants/index.d.ts"]}},"gitHead":"80442bdcab6b08738b5739d8115e85031d4bce70","_id":"ternoa-js@1.0.2","_nodeVersion":"18.0.0","_npmVersion":"8.10.0","dist":{"integrity":"sha512-+sk8ZPROTNNe0QpSmXwWweebDOQtDRla+UUzkxZ2jvxRu6JI5Sn/AVfFIEvcPdpMNbqr0EAfzr9vWAcLhHprKA==","shasum":"5d1087d86ad683f77244eed45f8d05fd1cb8ca54","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.0.2.tgz","fileCount":44,"unpackedSize":108423,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG+Ms3RNKhDR+Gh/tXFBRN6IIwEQ0Pp/xjuaZeveJ3rWAiEAvuiouVE3SuTULvF7wTc3YZmXkJb85tTff4/gBwj+io0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJihWyLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq6/hAApIlwNWyzP5iduybKvkQDFr+7iMCG3i0onEHgNSL3pqL+EVX2\r\n2pewSnaxv1av411YimNu8RrTIlCwux2gK4w9gUeCR9bU6i+Cicm14B280pR2\r\nVGkbi4bKrynGDAK5yW8ShJSH7+NujPTtidjFEe2Klmuqj2wl7bC485XxtQp8\r\nv80zB2Kg0u/40rlaI8ziTZDzJeCaiQjQhCqFVIm5BY04nGp+ci9dGi/5RuJJ\r\nUdg52robbnhQ4JjUP/jXGcueQ+DLgONt0b/pIwOfAz7FYs63/VIQ9ZfoPfER\r\nzIM8rowD082C3sRXnam4oghdlL7X8E32xaZAFaH68Pj8LBNM86LHvso+xPd4\r\n+fI5i2J9kUMlDKb6dXQrvScXtjCH1CpYyk+bn23Wy6Rf2eBZaS/WY59EVDxH\r\ny/gJHp4gOFXcHAYUD3Nwwpj6DSuZUGmpS/7OcKrElT4krWhFJAFphoIiSrwj\r\nSoaV2S9/vEUIPHCqDLSOjobBN73Br9+UR65K90Qg2/7WdLvVyB4qUCV1xmGO\r\ngEcdsrQ7I8xABiRwWSAW4Y0lKVkyKL30zPdjm3XLCdUJ9KR1sqxVzKugWbvS\r\ncXyioKrX6xMDe80YNI98G2G7jqetQl3DthfihvmiptSsFElORalrGMgw4g9v\r\ntmV4RRt1OQoZJGIuMA1dXmdYJpZcQj/Y/Pw=\r\n=veX9\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.0.2_1652911243491_0.1342803345196637"},"_hasShrinkwrap":false},"1.0.3":{"name":"ternoa-js","version":"1.0.3","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"capsule":["./capsule/index.d.ts"],"fee":["./fee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"nft":["./nft/index.d.ts"],"constants":["./constants/index.d.ts"]}},"gitHead":"c08899d77562d80813b94cf379ac560f66ea4092","_id":"ternoa-js@1.0.3","_nodeVersion":"18.0.0","_npmVersion":"8.10.0","dist":{"integrity":"sha512-PstYk9ohQDQxhF5nfxcbiZV1XadkiSNvbjgFLvRvTmbDwGY+gQ7fzsskNcZMJ42jWb7BqW4pnbf6RKuS90xfnQ==","shasum":"0c80d997e3d27cfb7c605366530c49ca3765c3c1","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.0.3.tgz","fileCount":23,"unpackedSize":92129,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHlMzRE5ZlkXFkSXIDjqBROV72S4+0tmsCUqk5Kb6G9cAiALYevyW6DSKQu2rEWJwoSVXfRgZRQ7HB9VKoCjkX9SkA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJihk67ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpdARAAmD+VxUAsmiO3aCfqhN/QCK+e5LeoTGZXWpZ946Vp9D0F/OQI\r\nISObuZZoTw646rBKzGiKx5nuy1DlQao6prgCJkRZOpK+vnJmV7QeWFKZazCs\r\npCyE1uyIad9d6F2UkXJH0NenrMvgFqjArag3h5TSGZbUCy2RhZzQYT0VfCbS\r\nfUL3AMOwmdqjYhA+SMJMdBQMTwjsdwYTBtUN4xo1xbwa+Z6TAMoqGm1Kp1cn\r\nb0tPDogyAyHqtVmaqBwiA4dRE9u+xFrMfVmoY5rjng/fTSXI36oFqLEeN25C\r\nHqPLNHfBdAUWpMxYulPmWvXYtRyUSGGOHY0dgggET2kaKZwcksc8e4Y3oXv8\r\nIxRJA1q7hJfiOl10CNM7mzUMwcfKRNHLW12p79Nqt4Y06yR3Q9+680gwKo+6\r\naOGEhJvhQV/jczt3yB5FTYecVBaH59zfqylheWpaClDQcbcAOBCxueOvc5UN\r\nkA2FBpeJoeUpEfzNaAXZvIdkLazvERVXr34dEkHpVOkq+BeLm9rDRsJtxryQ\r\n68NqGxcSR8MO5F1C2BT9q51hRouojF9oomOajbMuhn0cj+a7OdNJv8gqGC7c\r\nZjAC05/I7k4nKtDza6P0wquDqBxaJEul8pA4+4ZmMw4MJalIggNlcv5Cl31I\r\ncMGQc9WVk0ccrMyu3rUgTxrZk2KKAuJPzRU=\r\n=w7kk\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.0.3_1652969147499_0.5516284572286339"},"_hasShrinkwrap":false},"1.0.4":{"name":"ternoa-js","version":"1.0.4","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"capsule":["./capsule/index.d.ts"],"fee":["./fee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"nft":["./nft/index.d.ts"],"constants":["./constants/index.d.ts"]}},"gitHead":"b274aeca3a4e37c8fc7b067cfe8df979d2d3b86e","_id":"ternoa-js@1.0.4","_nodeVersion":"18.0.0","_npmVersion":"8.10.0","dist":{"integrity":"sha512-iE1m+yvEwj+3Xa8JKLbfq9294guUlSvltmSGF9MyBgbmC+irHyYjaha+QbHIUbrR6DjBlBHVuWXOoFj4XiNpiQ==","shasum":"9a9ef40d02a46f0c91e4d4c210f6df1bf04547f5","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.0.4.tgz","fileCount":23,"unpackedSize":94009,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCwLgJQDjEaS1E6VXwIdBNs4vV5SsBa+ytiUsTAjiTTPQIhAKwWGqJvNyzF3i8+fYOQQhHIqiy3Ba0Y7eQvryob0u51"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJioinZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQDg/6AhvbU3H/EAGvH/9C5twX1JEw7zk0Hs4f882ke3ZmNO2M86iK\r\nEgaq9W9zkVncIsOIp3gqhU7cBQlDXVcFBH+W54uOjf8VxaCvLW0oRcwLGwjB\r\naMoyJ2Zv6KLGEnDGJ+KkeVSEwyMksAtWNdrrmAX0JPN2dvdd+f+O7SajCFFB\r\nC9bSSQJx+/ZuTv0rJjxmUg2u2tsuhvPuJHLE01D3WDvYpvdPpgYGPceZtSvo\r\nntfbN2iK2a22bHT5G3zgzkGHldSTx9/pecXXaXrcqV9Gzr/jw7KzuU9zAnim\r\nyAMjOgscx3qFzuMbzBBdK/IiC9eQYE7TE3KY4r7jeRHKWaMXxB/5hzEFTXhJ\r\nx/OeGIbNQJzWd/+rx6oymWnhOBg/ULZrnPohHpRXpDJckMam3VhE7LrxgU+4\r\nNX9esxw4lTgEQS9E9N7zPbVUdnA5VObxGfpRuZ39z2f3FTHhgVQOb3Ke9ohA\r\n5LtxeOe2xYk6Vm9sI6r2GAs2uXCKQvFYPuxQhQhPVUWDZfiJtaE9zR3mA+KH\r\n14+A2ahBTJ4sbuJEhlT6pefrBaHh8TuAGpaw4stOsnePrECf7Uu9OZF6oydy\r\nzukUsF8gZd85NNgGVNBjQ25zpZkZyOD2yt3IuUIxR1LZlZWLWk+D8+giCiIy\r\nkFHSEGKIf1T99KQRPJAjwCZQ6dJAeOidJp4=\r\n=oA3+\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.0.4_1654794713305_0.1524357358842563"},"_hasShrinkwrap":false},"1.1.0-alpha.0":{"name":"ternoa-js","version":"1.1.0-alpha.0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"capsule":["./capsule/index.d.ts"],"fee":["./fee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"nft":["./nft/index.d.ts"],"constants":["./constants/index.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![npm version](https://badge.fury.io/js/ternoa-js.svg)](https://badge.fury.io/js/ternoa-js)\n\nThe easiest and fastest way to build on top of Ternoa Chain.\n\n## Installation\n\n### [Node.js](https://nodejs.org/en/download/)\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\n## Quick Start\n\nFunctions are organized by theme. In the exemple below, the import of _generateSeed_ and _getKeyringFromSeed_ from the subpath **ternoa-js/account** allows us to generate a new account and display its address.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\nThe default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT = \"wss://alphanet.ternoa.com\"`.\nIt can be modified by passing a new endpoint as a parameter to the _initializeApi_ function in **ternoa-js/blockchain**.\n\n## Documentation\n\nThe official SDK documentation is available: [ternoa-js sdk documentation](http://ternoa-js.ternoa.dev). Additional resources are available on the [ternoa official documentation](https://docs.ternoa.network/).\n\n<!---\n### Cookbook examples\n-->\n\n## SDK Development\n\n### Building\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nThe static website will be located in the [docs/](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites relies on testing pairs located in the [testingPairs.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts) file. In order to prepare those pairs, the two scripts [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) respectively fulfilled and emptied them with CAPS. Environment variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be define to run the test suites.\n\nTo run the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses recommended ESLint and Typescript rules to ensure coding good practices.\n\nWe've setup linters and formatters to help catch errors and improve the development experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n[Husky](https://typicode.github.io/husky) proceeds some checks before pushing a new commit. It ensures that: the project is building, there are no linter/formatting issues and the test suites are not broken.\n\n> If you use Visual Studio Code editor we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n## License\n\nternoa-js uses an [Apache-2.0 License](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE).\n","readmeFilename":"README.md","gitHead":"eba4f44b593f8fc18027cfd779619050a7eb0f84","_id":"ternoa-js@1.1.0-alpha.0","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-fax6VGGG5on/JuHaMLPQNIsEl2tVEaUy0ZkRa+aWHerq12Sk3idy53ZwqA/xdpG1KH3Jc2Ew03/g4Znx3BJe1g==","shasum":"9d0ebe34270fb757c924f3582cb5ed278596e46d","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.1.0-alpha.0.tgz","fileCount":23,"unpackedSize":140239,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFQb1+sSUjFXiwjKL5jniPAIAp/4tpJNHSBe9PAW1NMQAiEAmQOvcinV2MCfX1fXrG0UgVZ1BZczThsHY3beRY7k38M="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJisebYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoBsxAApMx0vYaJxzq5ZycZf5Zc2HRbEmsTJF4kJWicCpOODr31NoOC\r\npTON6sPHnA9CN8YMAsxaPHnQl+k4gDeSWgiJTzGbxEbetyOJeW+kv9Wtl/n/\r\nTqariX0W/53k5Hu1f/HQNpibpOLeaOwp3dYVcVj2mNzphWf2/sNlAafhqTY4\r\nmGnIbC6WBCsEsaZ/AiNJmceQ54ab2GX26bTZJrUuy/51ywMerT/bHxZeHXFQ\r\nLDzLadfA7YNKTZwcIcuCwp1anbj0IK8OFomsxQ6repUdIp6eNcEuKXbY1V7j\r\nIaa6eVvwUYs96N/NynzdHqY+99AZMEgpfAoPN7EaHhmxxr9uBefCaEjaEPia\r\n2cMfPfTocI9q9UrdRtQwOrEMJgL51TDrq5UneaHSx8UbqRDamJvI8AhR+b8R\r\nl+8WO4+4E7RQ7nKbKXJpyahVr2mHp9i02m4nl18w+1fzzRu6DRXZ8Zjp2m04\r\nSrQfrDL9ahz8TrEfbmjdjGmQJC5h3QQzhYFlWxgxgxnC09dk4F7k3DuPTpAG\r\noKKQrelqzd1bVkwduOTu7ArLeSo7kWs1kgpSxIxYgG3NY2BgClSI5k2WsQ3Y\r\net8u9rMlkE1Cnbd98HLlw8IJZ8H7ds3Vw2IY05s2mFA7anctRYrehcSquEEo\r\nJPWcTvBachfXSLHfESIJdvpRufJDBHBTbf8=\r\n=9hh1\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.1.0-alpha.0_1655826135998_0.3352774033306649"},"_hasShrinkwrap":false},"1.1.0-alpha1":{"name":"ternoa-js","version":"1.1.0-alpha1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"capsule":["./capsule/index.d.ts"],"fee":["./fee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"nft":["./nft/index.d.ts"],"constants":["./constants/index.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![npm version](https://badge.fury.io/js/ternoa-js.svg)](https://badge.fury.io/js/ternoa-js)\n\nThe easiest and fastest way to build on top of Ternoa Chain.\n\n## Installation\n\n### [Node.js](https://nodejs.org/en/download/)\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\n## Quick Start\n\nFunctions are organized by theme. In the exemple below, the import of _generateSeed_ and _getKeyringFromSeed_ from the subpath **ternoa-js/account** allows us to generate a new account and display its address.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\nThe default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT = \"wss://alphanet.ternoa.com\"`.\nIt can be modified by passing a new endpoint as a parameter to the _initializeApi_ function in **ternoa-js/blockchain**.\n\n## Documentation\n\nThe official SDK documentation is available: [ternoa-js sdk documentation](http://ternoa-js.ternoa.dev). Additional resources are available on the [ternoa official documentation](https://docs.ternoa.network/).\n\n<!---\n### Cookbook examples\n-->\n\n## SDK Development\n\n### Building\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nThe static website will be located in the [docs/](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites relies on testing pairs located in the [testingPairs.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts) file. In order to prepare those pairs, the two scripts [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) respectively fulfilled and emptied them with CAPS. Environment variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be define to run the test suites.\n\nTo run the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses recommended ESLint and Typescript rules to ensure coding good practices.\n\nWe've setup linters and formatters to help catch errors and improve the development experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n[Husky](https://typicode.github.io/husky) proceeds some checks before pushing a new commit. It ensures that: the project is building, there are no linter/formatting issues and the test suites are not broken.\n\n> If you use Visual Studio Code editor we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n## License\n\nternoa-js uses an [Apache-2.0 License](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE).\n","readmeFilename":"README.md","gitHead":"c99f58c85cc771d71e0d5eea1e1de287cb8c80c8","_id":"ternoa-js@1.1.0-alpha1","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-HOm8juqmOK5p0lGuEx9CE6BBDq3FFJCtxtUnNpZ2QezHOMK06/R6+MT6AhwYWqMcunZEwsnCvKQSXTdzIFqLAA==","shasum":"ac5b8ce2ab6c9684b95519766803e84160619afb","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.1.0-alpha1.tgz","fileCount":23,"unpackedSize":136332,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICKGaV/iOhI6I/1QrbhtyoU22+INKy4fTiXskuWyFWJ4AiAYTqjBmJslP96xukWLektvUKHSRCQL/OInsUIuN7QnyA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJisyNCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoIMg/7B/dOZu6JH/MbKEMxyajXBUhUXDW2IB+IidCI8eZzUjl+Juwl\r\nun1XsVtMyiOA+ANYGmKuRUQgvTJpdv7k+NagCCb/SoUrITRwhQ0dhRytruVT\r\nKGArV2YQx40buB17Z4fvyNtY4J23lbbnhqF6EQzHmxQRqvnnxKxwedGLXnm7\r\nJ7crg1bifPCsQaqMHb4+s97f9+t/Y6Ztq4eYCgetWCMl85Des2dr/bZwGWFS\r\nbvuZA32fZzX5udTXh8QEkAD+U5/j5ksWUkzXRIYvnzLQEMye4KHETekv20jZ\r\nSLnhphZLvdlM5S88FSviAabOl2V01ElUiIoY2OuqrJZ2DsvTMGpTYQ08E+2u\r\nqcUBY6xYf4tOfkVAXJs+RyyWWqhn9VcCZx0n1nVJ3aLQ4zKMWih9iNx3VuRX\r\nSjrdX9jX4UldlrPEJ498pxxzgGmkgrmpxqaNO3Hxl4ctlN1UEPPKvZBQm5ol\r\nh/lw/263kfonLgFT9OQDFs2wHX7LtYZBHsdk7VuitOsQYk4oxcSXir+tO6Fh\r\nPmvxrPy25pmz2Ytp0dNNnKhvKdeuqjMOHn9a/Ioia42ilSemBe66AEDRQOmB\r\nY6y/gGFSmRuj+NAQSA8Ts6pCe8bZYEu8ETUCa8R8dd3ybvb74ayklg/w3cok\r\nx9FUN4MUR6LSKnfqM+PTZbECE6cuG0PKPMg=\r\n=xh7y\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.1.0-alpha1_1655907137978_0.9218848548208256"},"_hasShrinkwrap":false},"1.1.0-alpha2":{"name":"ternoa-js","version":"1.1.0-alpha2","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"capsule":["./capsule/index.d.ts"],"fee":["./fee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"nft":["./nft/index.d.ts"],"constants":["./constants/index.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\r\n\r\n[![npm version](https://badge.fury.io/js/ternoa-js.svg)](https://badge.fury.io/js/ternoa-js)\r\n\r\nThe easiest and fastest way to build on top of Ternoa Chain.\r\n\r\n## Installation\r\n\r\n### [Node.js](https://nodejs.org/en/download/)\r\n\r\n```bash\r\nnpm install ternoa-js\r\n```\r\n\r\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\r\n\r\n## Quick Start\r\n\r\nFunctions are organized by theme. In the exemple below, the import of _generateSeed_ and _getKeyringFromSeed_ from the subpath **ternoa-js/account** allows us to generate a new account and display its address.\r\n\r\n```javascript\r\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\r\n;(async () => {\r\n  const account = await generateSeed()\r\n  const keyring = await getKeyringFromSeed(account.seed)\r\n  const address = keyring.address\r\n  console.log(\"Your fresh public address is: \", address)\r\n})().catch((e) => {\r\n  console.log(e)\r\n})\r\n```\r\n\r\nThe default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT = \"wss://alphanet.ternoa.com\"`.\r\nIt can be modified by passing a new endpoint as a parameter to the _initializeApi_ function in **ternoa-js/blockchain**.\r\n\r\n## Documentation\r\n\r\nThe official SDK documentation is available: [ternoa-js sdk documentation](http://ternoa-js.ternoa.dev). Additional resources are available on the [ternoa official documentation](https://docs.ternoa.network/).\r\n\r\n<!---\r\n### Cookbook examples\r\n-->\r\n\r\n## SDK Development\r\n\r\n### Building\r\n\r\nTo build a new version of the library, run:\r\n\r\n```bash\r\nnpm run build\r\n```\r\n\r\n### Generating Documentation\r\n\r\nTo generate the documentation website, run:\r\n\r\n```bash\r\nnpm run docs\r\n```\r\n\r\nThe static website will be located in the [docs/](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\r\n\r\n### Testing\r\n\r\nThe test suites relies on testing pairs located in the [testingPairs.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts) file. In order to prepare those pairs, the two scripts [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) respectively fulfilled and emptied them with CAPS. Environment variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be define to run the test suites.\r\n\r\nTo run the test suites, run:\r\n\r\n```bash\r\nnpm run test\r\n```\r\n\r\n### Code Style\r\n\r\nThis project uses recommended ESLint and Typescript rules to ensure coding good practices.\r\n\r\nWe've setup linters and formatters to help catch errors and improve the development experience:\r\n\r\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\r\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\r\n\r\n[Husky](https://typicode.github.io/husky) proceeds some checks before pushing a new commit. It ensures that: the project is building, there are no linter/formatting issues and the test suites are not broken.\r\n\r\n> If you use Visual Studio Code editor we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\r\n\r\n## License\r\n\r\nternoa-js uses an [Apache-2.0 License](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE).\r\n","readmeFilename":"README.md","gitHead":"3cb7ca2639f5b1739351328f559206968ee03531","_id":"ternoa-js@1.1.0-alpha2","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-WIM8lQhc3RYWDUocbFHw9a0TpjbcHjm6n9RYoHUriLz/dgaTqS2l9G2LiqyS+iA+CgjUa8EFoDNsqxXrdiPOag==","shasum":"0971a34ac9c949d1a2100ea58958757cfadc5fa8","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.1.0-alpha2.tgz","fileCount":23,"unpackedSize":138927,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHfrdTiHlq8+Kum517+nBya5D/NuwrOeJpyDvc4MhiD+AiEAkBgOApMwSmHQXX85HI2Y0S2Jb1FsjqM83uo+sY8NPQU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiuwg/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoQARAAmaOyOkB1jmRyMgciiYAwfxvYh6Mfy0xEshPfvPS/Vh4T85Te\r\nhDJUsWtyL0mJeWo67AA0XaU9zoHfJ8/ehm6dvnDl8XOD7InN4BCaJQ5Xf8xY\r\n9w2wdJBo74gCtWgCHvDJ0RAFClentg7IV2icVEV7WQ08j+owwcsWOXgidRwt\r\n4rulKt7dz8uhGUavJI1aA6L1htu6wseHRAeleBGADCwzu+Dpy/akbxMg2ZaN\r\nCZ6Majgh5Kt3e7FAPMk8rctPaMz4N3uVfujmZ6DB+KCQx+HQBw5YHUfokOey\r\nXiWbPSojoBXnkUCDxYb//alfeZbyHhbA5BF6AtZfFtpe7flX1jlzAajm1Zbu\r\ndu9XDOqG7R9RaUEIpMzxb6zekJWGUnjljkt7OD23Q6L9g4gK+blcLdzM0H8s\r\nvZ5NdUZtr3XMcBh3OH/hRe3dKV0sUB/PeXyhpqmr/hW06JIUIZmF9idzQ1fW\r\nFHF2+uGRoIUkMjc0e7BCdV3gROxpN75KD/zidshrvj+8n8xaA3c23edSs2RR\r\nD8rgEFl9rmXxlWFjWqdP0+by6IE/HiyzD3FduIhpj9bFhQZ4Ye6xS0UWkwf9\r\nmQ9rOouKCxQshwI7hEMDCe2aYP2uWTSTr+pOyq/Dyqguc7XAEfatZNlp4AXq\r\nWD3g9AOx6DoRVebxfIaDfwW+qh9/dueybZQ=\r\n=vweU\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"leouarz","email":"leouarzv2@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.1.0-alpha2_1656424511314_0.15071210891505604"},"_hasShrinkwrap":false},"1.1.0-alpha3":{"name":"ternoa-js","version":"1.1.0-alpha3","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"capsule":["./capsule/index.d.ts"],"fee":["./fee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"nft":["./nft/index.d.ts"],"constants":["./constants/index.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![npm version](https://badge.fury.io/js/ternoa-js.svg)](https://badge.fury.io/js/ternoa-js)\n\nThe easiest and fastest way to build on top of Ternoa Chain.\n\n## Installation\n\n### [Node.js](https://nodejs.org/en/download/)\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\n## Quick Start\n\nFunctions are organized by theme. In the exemple below, the import of _generateSeed_ and _getKeyringFromSeed_ from the subpath **ternoa-js/account** allows us to generate a new account and display its address.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\nThe default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT = \"wss://alphanet.ternoa.com\"`.\nIt can be modified by passing a new endpoint as a parameter to the _initializeApi_ function in **ternoa-js/blockchain**.\n\n## Documentation\n\nThe official SDK documentation is available: [ternoa-js sdk documentation](http://ternoa-js.ternoa.dev). Additional resources are available on the [ternoa official documentation](https://docs.ternoa.network/).\n\n<!---\n### Cookbook examples\n-->\n\n## SDK Development\n\n### Building\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nThe static website will be located in the [docs/](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites relies on testing pairs located in the [testingPairs.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts) file. In order to prepare those pairs, the two scripts [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) respectively fulfilled and emptied them with CAPS. Environment variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be define to run the test suites.\n\nTo run the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses recommended ESLint and Typescript rules to ensure coding good practices.\n\nWe've setup linters and formatters to help catch errors and improve the development experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n[Husky](https://typicode.github.io/husky) proceeds some checks before pushing a new commit. It ensures that: the project is building, there are no linter/formatting issues and the test suites are not broken.\n\n> If you use Visual Studio Code editor we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n## License\n\nternoa-js uses an [Apache-2.0 License](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE).\n","readmeFilename":"README.md","gitHead":"0781feb080e46e072192aba4aeb810f0cb1344a7","_id":"ternoa-js@1.1.0-alpha3","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-gPpSGUmk8SHUVCsMPPq/px++oM2gvxliiBkQ6FTx1niCh7pyThIgbAtQZRT8ojoV5SYlnWH5x4dJU/2e0UFC8Q==","shasum":"915f8b2451bde5f7e568703085fe35bb253990a2","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.1.0-alpha3.tgz","fileCount":25,"unpackedSize":137471,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2VpguXB/9oowvIvlRv56PnYEMWlN/MXLUTnRX+4t5VQIhALRLlZQcmx9N5VnkxgJXm+16WdSLjiJJCtLthFSowu1f"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJivt+YACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoiGQ/+LpUpn0Mzru52jkXYWjxwexCYWT8FEitFsirwUxACzN6a+yaf\r\nUPhT6lEHSR4CMjTd9wNZyQd0xYoDlo2mXVYepu3AosACUeYGSMEJ4SnBTwoy\r\njK9tgyS/k8sgTAD7/2GLwbvVohv6rNiOt8+iCJAnzHZgHr5aSNaKZWkCr3M6\r\nTpom02D4o8SEk4j2VWUBy8w3EWInRpPEXZbZovjr0ljuAYB271QIvjrGX1/x\r\nVHWR5wcK7duCTNBcyXdqwxsMGk7KCsdOynfsmIdOZnLTDl/Jrdki8ibm2U/3\r\nUMuQ/ts7Jl8Nt13GtYhO/0VyAJDs+1s8U9/6FvLWCZlnUm7JNtYiuP/3dB+2\r\nvnjOSsVEaFaH0V9xdh+TLkKt4XeyxW8C/FCTNhIMZmC1ieSqGRZHq/ImBqtY\r\nvMA8oNFAHnIWVi76J1o5Ed6j7/Y7a0zpgogygNzMT9RSm56zYplEgNHJpqh0\r\nqbIoMsYijDlXo6W6y109dgIDmrhylQ85aH0XVDgGM4rFFA4vTblaVrgSqAue\r\nxPVbinudcOcc7qTc4K76DL2y5izAIcqSFh2SePWH0niAfDP61Bw/Gta1WHgI\r\nTRwWuUlMX8klh77zCJ+hqAHA6BmmcLJbJC0fuQUCN/jQJDaXDDHdLfLhRNCg\r\nagM2+Hya3eZus8tVFEijCQLwkrutWWeD7kw=\r\n=e31g\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.1.0-alpha3_1656676248787_0.6246615133256568"},"_hasShrinkwrap":false},"1.1.0-alpha4":{"name":"ternoa-js","version":"1.1.0-alpha4","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"capsule":["./capsule/index.d.ts"],"fee":["./fee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"nft":["./nft/index.d.ts"],"constants":["./constants/index.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![npm version](https://badge.fury.io/js/ternoa-js.svg)](https://badge.fury.io/js/ternoa-js)\n\nThe easiest and fastest way to build on top of Ternoa Chain.\n\n## Installation\n\n### [Node.js](https://nodejs.org/en/download/)\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\n## Quick Start\n\nFunctions are organized by theme. In the exemple below, the import of _generateSeed_ and _getKeyringFromSeed_ from the subpath **ternoa-js/account** allows us to generate a new account and display its address.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\nThe default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT = \"wss://alphanet.ternoa.com\"`.\nIt can be modified by passing a new endpoint as a parameter to the _initializeApi_ function in **ternoa-js/blockchain**.\n\n## Documentation\n\nThe official SDK documentation is available: [ternoa-js sdk documentation](http://ternoa-js.ternoa.dev). Additional resources are available on the [ternoa official documentation](https://docs.ternoa.network/).\n\n<!---\n### Cookbook examples\n-->\n\n## SDK Development\n\n### Building\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nThe static website will be located in the [docs/](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites relies on testing pairs located in the [testingPairs.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts) file. In order to prepare those pairs, the two scripts [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) respectively fulfilled and emptied them with CAPS. Environment variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be define to run the test suites.\n\nTo run the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses recommended ESLint and Typescript rules to ensure coding good practices.\n\nWe've setup linters and formatters to help catch errors and improve the development experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n[Husky](https://typicode.github.io/husky) proceeds some checks before pushing a new commit. It ensures that: the project is building, there are no linter/formatting issues and the test suites are not broken.\n\n> If you use Visual Studio Code editor we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n## License\n\nternoa-js uses an [Apache-2.0 License](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE).\n","readmeFilename":"README.md","gitHead":"e0f78bab9952b30525d0cc518ea4b6f538b9d9a3","_id":"ternoa-js@1.1.0-alpha4","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-YZjicJQ0v5wGy3ysyaaXRYiur10g52lMlXqrXpWZwtKooYKwUu8ZvsxIsHFVMeTie7kBVWfyX8PcsoaIqWgHyg==","shasum":"6fb80187d27132e12184ea94d950f04a41623a5d","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.1.0-alpha4.tgz","fileCount":25,"unpackedSize":137363,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDhmMAUONBke3LrdyCZgbJHTL+Kc9RmhIYsSZ+uM6A9yAiBmQDX9hi7RqWCuqMjqDDSTnsEQS7A4cA03T/HByzJ0fg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJixY+yACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqpUBAAkrom1st7z1cAcO/1Yh3a1330WvhSVTEJgODPhy1v4YmgU5w6\r\n54m84T6IWUXeHNne/MZEccqNUR6HdYrithzvEomHAur05+eWFiXWbX/S9Wbx\r\ntnA5tY/u6JGmEik+ZHPcL5NOARUOKBmFJwWIuSY9CLCTIx9cOvUCx2bxPdkE\r\n1rK3EfXtDDOt6sYXvEPGZaLBe7EMMmXryu3B8kef/NCorFbo8rkiZgdZzdQ6\r\nutkTp114saQgjoomraJE2pbAGo7BGJf8A70IbTuoHsTUGsmBVBV8ETaAb987\r\nkaYWbRYQQdbPUJ0gQLrLLjGNJv3Jj1bHT1uUZUW7kaTeEmlCo89wdIhw0woj\r\ndSn6nia51sxPoti5VcQc4ox4/CVBIdOr3U8b9LITMSjsHC3AA+Blgr1B0FcF\r\n+pRJtpxCSohmWty/3G4WbHQ4oIMfulej9e9hMWbez29z9phmmpBQ8TSsdYt4\r\nNcIg4vx8xbZKQJVAAFbDDP2rLzZDvax/DSL5yV4snLBtsn0fnxdza/fICVaP\r\nOyVnAUO+hatinJ5/IYO1azkw+vtPGHPCYPf+Mb75qfNUtunW4OvEAJR3rO9Y\r\nWZLB7FbZ/wnzcxAgnXSWd9xwVNGdpjhJ3ab8vWVVDqYvQkp0msnhA+o6VAD9\r\nZNRlMzBPwwWeHQ6/lhe201YLTsfArBt1Uzc=\r\n=oJfN\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.1.0-alpha4_1657114546512_0.41006082970901647"},"_hasShrinkwrap":false},"1.1.0-rc0":{"name":"ternoa-js","version":"1.1.0-rc0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"nft":["./nft/index.d.ts"],"constants":["./constants/index.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![npm version](https://badge.fury.io/js/ternoa-js.svg)](https://badge.fury.io/js/ternoa-js)\n\nThe easiest and fastest way to build on top of Ternoa Chain.\n\n## Installation\n\n### [Node.js](https://nodejs.org/en/download/)\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\n## Quick Start\n\nAn API instance must be initialize using the _initializeApi_ function in **ternoa-js/blockchain** before calling some SDK functions. The default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT = \"wss://alphanet.ternoa.com\"`. It can be modified by passing a new endpoint as a parameter to the _initializeApi_ function.\n\nFunctions are organized by theme. In the example below, the import of _generateSeed_ and _getKeyringFromSeed_ from the subpath **ternoa-js/account** allows us to generate a new account and display its address.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\nAmong all the features provided by the Ternoa SDK, this short snippet of code allows you to create an NFT, submit and sign it at a glance. This single line _createNft_ function, require a few parameters : some `offchainData` metadatas, a `royalty`, a `collectionId` if you want this NFT to belong to a collection, a boolean to define its `isSoulbound` status, the `keyring` to sign and submit the transaction, and a `waitUntil` callback parameter, to define at which point we want to get the results of the transaction execution.\n\n```javascript\nimport { createNft } from \"ternoa-js/nft\"\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize an API instance connected to the Alphanet chain\n    await initializeApi()\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\nThe official SDK documentation is available: [ternoa-js sdk documentation](http://ternoa-js.ternoa.dev). Additional resources are available on the [ternoa official documentation](https://docs.ternoa.network/).\n\nDiscover our End-to-End Test dApp here to learn and test the Ternoa SDK : [ternoa-js-test-dapp](https://e2e.ternoa.network/).\n\n### Cookbook example\n\nIf you are looking for a quick overview about the basic-usage of the Ternoa SDK, some explications or the best-practices, and how to create your first NFT, we recommand you to look at the exemple section [cookbook/basic-usage](https://github.com/capsule-corp-ternoa/ternoa-js/tree/1.1.0-basicNFTs-collections/examples/cookbook/basic-usage)\n\n## SDK Development\n\n### Building\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nThe static website will be located in the [docs/](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites relies on testing pairs located in the [testingPairs.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts) file. In order to prepare those pairs, the two scripts [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) respectively fulfilled and emptied them with CAPS. Environment variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be define to run the test suites.\n\nTo run the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses recommended ESLint and Typescript rules to ensure coding good practices.\n\nWe've setup linters and formatters to help catch errors and improve the development experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n[Husky](https://typicode.github.io/husky) proceeds some checks before pushing a new commit. It ensures that: the project is building, there are no linter/formatting issues and the test suites are not broken.\n\n> If you use Visual Studio Code editor we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n## License\n\nternoa-js uses an [Apache-2.0 License](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE).\n","readmeFilename":"README.md","gitHead":"d7d9c07e44952ad1e2d1ff49afdcaf0844278200","_id":"ternoa-js@1.1.0-rc0","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-sq8pFO7r+Ica2kQcRTECEVeBwjK0cwRqHXKWk1wcAYxPT82zwFGg9apsiMpU2/YNHxAK31Ejn8TIgKX11W6psg==","shasum":"19b457bba664f07c0135e0047e5a40ec3dc4aed9","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.1.0-rc0.tgz","fileCount":35,"unpackedSize":185862,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBqYJxmrGHBtzIOTvm37KtdppM65EHBTUGKd/blY2e4QAiBj6o1p4WJ22M/GZOjFbs2tUSjnFvWxu9CLAJVsCBbpCQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi0ZKIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpdehAAnayX8y+uBcmRSyb+o5eAcEKvtznMIkxQcHNM3DG/aQXvqene\r\n1AJJgJnNKpGHzwcWd1PikVPlnr2yKmodWaFtMBNYd2NMhJm8FMUiMnFsw+M1\r\nl/KMSdcqJcxPPw2nKQIGVHM+nh7PVu8loDMwnMT26iRTmKgyqOQrFQ1xTXxq\r\nzr8kK+egI4N9Bhf3Xafe7Hb+639qmAENt2USfBayau6T0/Z1Y3RxeBBrLlU/\r\n8ZdvGJVARfK86R++2yFr+fdAgQrs97YYi1Sh2Wpd8GsRkVVBoKjwLChkxsxc\r\nwjUVkMGIu67f2B/1SzOu21XklsH1aANUG2hwpkVXmu5q2nzNRRGqIuQH/0Fn\r\njcncgt/XaE1QaWMvp00Ld23KrWspsVONe+hy/3wuOaRxhzVp7bOIvttg3IIB\r\nEpYHmyPeRAiGwxijC6R4IvH3HSdFKaS7NKAbVUdUXpPXWwSIlbrsmoYr7ECW\r\nPiXezOqpmGRHfzn0Beuuc8c70ak341nOI4wNGt1dbEemEBEc1ayrEMiWH80b\r\nAtAlwBliJK4SKmeTVrfM6VDmtBwynSaJ1KrBgmzW/Nybvk7Iy/Y7DGZRjjG+\r\n5WDUkgo+o5NGHB7cCnsabvEDPkh58rRx2WrSMxtIcgYRe8TkgSZwuLJa+sVM\r\nACJxd/NKWoYdp3/vQ/WZGVNlY1a68kPjUvk=\r\n=FA1g\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.1.0-rc0_1657901703791_0.10401820110837035"},"_hasShrinkwrap":false},"1.1.0":{"name":"ternoa-js","version":"1.1.0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"nft":["./nft/index.d.ts"],"constants":["./constants/index.d.ts"]}},"gitHead":"1adfdc129da601d5e3010d21c07cd879df748bd0","_id":"ternoa-js@1.1.0","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-lDinAec+pFvDDK8gei2gF9LXgvpB/QuezR37lh1Om48U4c0fuEm3jeXti9FbWbeqZscjnQjgTPuj8p6icZBvgQ==","shasum":"b0c6ac2f9146d0d9128ab06652b6d7575f5437ee","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.1.0.tgz","fileCount":35,"unpackedSize":185858,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDiqeagwpVpRNXZGGMdNt1G2EDl3he1ZIkaLHQG9DEl7gIhANwbWQ2+qiclmzoeYVuqEOWxRg6pMm6TbyvlDeKaXOT5"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi4W0zACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqTBBAAjv9buAu7GvvTce4lATvQDdl0+91Mg21R32s5jJpsv2Moe9R2\r\nsuZqnD9yUar66TOpLBvwfJU7p6hugzvwvbgjEXnas2zTvyBlfeEi3yCcU1c7\r\nYoSPmOLtMEHZzAKCpulJ7FLibXDTg/eXr+O4HVDMvMCTqU+UK9JevDPPOAnu\r\nkws9yEVCUjwwtOXEFvrsiTUMszOb//+KRwfDETXXz8VgmZXfIaDaNJpOHqCS\r\ny31ADXHJFXceR4b8ZW71+/S+JHwYDdlsse3dIktxHyhreMYlfYjZbX0qtoT8\r\nS5v38/riIIRhO8Y9OJDnlM5UavoZERXjjVluH6ZAXS4cRd3G9yk+ZYER6e9Q\r\n4XDJ1owNypYHNX1GYqMURz4dpFpzeiqIWIV8qRTOzk2lkRMObroCFBfV4iqh\r\nQmnNu9jaWr+MYlS3rZ0pnOzKcUjzw4Hae0ovTFuDM2wGGLJH/wDJWoq12vg1\r\ng4lL1Ncy1nZle9wJkDbYZrsIe9OPhAijCp2GNcDJ9fGzOqE4njzGm900u0C1\r\n0qMCKVozHSIAigX9g32EO5M+QwDJTdNg/a8+7EZ3Xl4Kjn9u786IeQxE+QY6\r\nYTbszINLbuAvOIUmPrguV9EYWuE8Pw6SyCa9SP9GZGRnm3meijhBJcG2u9gh\r\nEbmJuj/OFO39/t5LzGNuiCCSXn11xf641yc=\r\n=xpjV\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.1.0_1658940723468_0.022112507220054534"},"_hasShrinkwrap":false},"1.2.0-rc0":{"name":"ternoa-js","version":"1.2.0-rc0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"nft":["./nft/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"constants":["./constants/index.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![npm version](https://badge.fury.io/js/ternoa-js.svg)](https://badge.fury.io/js/ternoa-js)\n\nThe easiest and fastest way to build on top of Ternoa Chain.\n\n## Installation\n\n### [Node.js](https://nodejs.org/en/download/)\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\n## Quick Start\n\nAn API instance must be initialize using the _initializeApi_ function in **ternoa-js/blockchain** before calling some SDK functions. The default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT = \"wss://alphanet.ternoa.com\"`. It can be modified by passing a new endpoint as a parameter to the _initializeApi_ function.\n\nFunctions are organized by theme. In the example below, the import of _generateSeed_ and _getKeyringFromSeed_ from the subpath **ternoa-js/account** allows us to generate a new account and display its address.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\nAmong all the features provided by the Ternoa SDK, this short snippet of code allows you to create an NFT, submit and sign it at a glance. This single line _createNft_ function, require a few parameters : some `offchainData` metadatas, a `royalty`, a `collectionId` if you want this NFT to belong to a collection, a boolean to define its `isSoulbound` status, the `keyring` to sign and submit the transaction, and a `waitUntil` callback parameter, to define at which point we want to get the results of the transaction execution.\n\n```javascript\nimport { createNft } from \"ternoa-js/nft\"\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize an API instance connected to the Alphanet chain\n    await initializeApi()\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\nThe official SDK documentation is available: [ternoa-js sdk documentation](http://ternoa-js.ternoa.dev). Additional resources are available on the [ternoa official documentation](https://docs.ternoa.network/).\n\nDiscover our End-to-End Test dApp here to learn and test the Ternoa SDK : [ternoa-js-test-dapp](https://e2e.ternoa.network/).\n\n### Cookbook example\n\nIf you are looking for a quick overview about the basic-usage of the Ternoa SDK, some explications or the best-practices, and how to create your first NFT, we recommand you to look at the exemple section [cookbook/basic-usage](https://github.com/capsule-corp-ternoa/ternoa-js/tree/1.1.0-basicNFTs-collections/examples/cookbook/basic-usage)\n\n## SDK Development\n\n### Building\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nThe static website will be located in the [docs/](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites relies on testing pairs located in the [testingPairs.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts) file. In order to prepare those pairs, the two scripts [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) respectively fulfilled and emptied them with CAPS. Environment variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be define to run the test suites.\n\nTo run the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses recommended ESLint and Typescript rules to ensure coding good practices.\n\nWe've setup linters and formatters to help catch errors and improve the development experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n[Husky](https://typicode.github.io/husky) proceeds some checks before pushing a new commit. It ensures that: the project is building, there are no linter/formatting issues and the test suites are not broken.\n\n> If you use Visual Studio Code editor we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n## License\n\nternoa-js uses an [Apache-2.0 License](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE).\n","readmeFilename":"README.md","gitHead":"3c03b6ecc9d1f77f86cdfc2789f59a7c70dbed57","_id":"ternoa-js@1.2.0-rc0","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-wFDQJU5Qfvs3CC5tT1TaxyNkJPkRz7fifCCpdtlIu0jltwNlHcgWGYg1KmfDofolzcaUpVtNN0NlrqAui6Z+cQ==","shasum":"4fdc0ddf125e5f5440463de1322e0c4082cfb27b","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.2.0-rc0.tgz","fileCount":51,"unpackedSize":262526,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEGzE/Zywu9sfHt/R8qZZo50Suj1wQ0BO5DPxfjwaYngIgL/gyrhblfAcmVRlfNTvls/GG/DfllHLPN6EL9oxYK8Y="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi4W2mACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpzKQ/+KM2WE6Og5zERPVpRs9cSMfJg480KcKQYH+Iz+mp1CfuQOFMJ\r\nMYGa+9m8IMBc0n9skAdxMyPt/C0hLqtyEpxpTnjtZ5fRMn5KxWPxGb8QF5Uq\r\nLieywFOSnoUXhRrljTMFv77LkBZFw8xtfBThvEBvaq+NDveBIC0mIf8LGJif\r\nvE85ESLgZ37ttcMebLTbErSOw2RWKT99opDtUNls8+lzMJL5cwoUdf5ispmM\r\nzD09kt84Pv8dhD2dVTDhQLOoFiYkeb8jh+qsi1fj82yUZIyt/jUZAASGbyUu\r\nfXEXzFqpu6KDjbana4+FORwH7Kx/XhJXv3EXySeKQmFA6PKFQhbGyicHgFMi\r\n4IpWwzxmKj+rqGGHspr7/rBTAixDlFHxFDsNQYblIp9RwbnNuWoSJS1MjeRc\r\nkFlZ5IS9x5o0Bze01NgVFU2YncQZBea0i9yz+yzxckcWHUzc6QGDj76/ZLis\r\nOQO4tGAL7K/lt/N2vRpQhqsb2e9C3GdlWgHg5vQNwa7FRtX/zDWNpi07XUaw\r\nPBa2gXox4DWOVHCTxRE7QI/GRq9cea3726VTRbDhnkhhp+OSHUabr3rxPJq0\r\nl7Yr4Oeh1/yGP36uoiMvnXDcLf5rh6rNIh59tIruSsR2z4hQbLI7vr7DSvlD\r\npnuwhEAFl+ljj6S2oeLEKtFKzF9miy3ePMM=\r\n=j0Is\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.2.0-rc0_1658940838761_0.5120644602297393"},"_hasShrinkwrap":false},"1.2.0":{"name":"ternoa-js","version":"1.2.0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","bn.js":"^5.2.0"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"nft":["./nft/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"constants":["./constants/index.d.ts"]}},"gitHead":"a3db9cb3d5d7cb1ea9d539f7a0b3767a6706f2cb","_id":"ternoa-js@1.2.0","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-IPsP5IMONC34LCbIwfteMRxffeiPZlBPw7eVUuvyIf7wmgxCIT4la0AD1xvHPxo1J25GKUg5KctUkUrBTdeIgQ==","shasum":"462957a8ead04e46d5ed3fecbf45525c79332d38","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.2.0.tgz","fileCount":51,"unpackedSize":266581,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDUazK7qLPJei355ydW6bivZr/fdtdbyN3dOImbejnXTQIhAOflq444nwcKYNdAZ/FHBmt+H9di0Gb5qztj+Sy+IA3P"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjB59nACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoWZA//WmpIxQc8s72XHlmtKD0A7SJbfNkSSLjmw9dmqKUnbRSXHHQb\r\n2kGI2kthys56nBg0LgOzwSpslnELt7cR60h2wwacmBi2+n4TXUQbuiStNa1/\r\nVS1uZKSBOfSHvRtgSiIxKRUAJuDEd2Xa7eSme45q+nbAhHM09wltQMfE6cwN\r\n5zTu8bQxfeTKOnZnT8O0Hi+NEYprtdhny+b4AubuLdiD/euX1WlOORjMWjFm\r\nelLp6PW9SPv+4T7WZxA7qIHAmbH7j21WhO4/FO5W1CuRrwkMRM6mtK1Nn9t3\r\nEwZsliSpEMsoxf6P8LjcSpS+THas/vZ4H9XX+m2zxUubdxFrYf+KDLuMqUzs\r\ngIvpDD0RF50QNWIwvPqPUcdygNl2CR6sHzba7JNEnCdVgzP5VsXTvWqAlsQb\r\nY494tL/KW+YVkwktRSunhfYZrWlqy6cIY2TXOtePcDjN2+3r1/7uq+Vi9R73\r\naUVr/Ub8ONV7vYs75Ta4UI1skkQQfuXKEz47lY1b0aOxmb4Gimv/tFh30lG5\r\nkKzrEs2mrmKkkd2u5hItmAS1zaeEO+fuQUdaEsgs+t53UfugnxPcfqwfcYyS\r\nBEXk8M7VtgUqoxksQ03egrKQ+CSi3QX8lBdxg+FA2AWmZIinBoAH0WmmSaq5\r\nNimLorhvkFV0pFIwf9wjCON0pC1K5J8nPNc=\r\n=4QXx\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.2.0_1661443943772_0.9142710696789191"},"_hasShrinkwrap":false},"1.3.0-alpha0":{"name":"ternoa-js","version":"1.3.0-alpha0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","axios":"^0.27.2","bn.js":"^5.2.0","mime-types":"^2.1.35"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"marketplace":["./marketplace/index.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![npm version](https://badge.fury.io/js/ternoa-js.svg)](https://badge.fury.io/js/ternoa-js)\n\nThe easiest and fastest way to build on top of Ternoa Chain.\n\nIf you want to learn how to use Ternoa SDK, the [ternoa-js-test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect entry door. You can start by contributing there to familiarise yourself with our architecture.\n\n## Installation\n\n### [Node.js](https://nodejs.org/en/download/)\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\n## Quick Start\n\nAn API instance must be initialize using the _initializeApi_ function in **ternoa-js/blockchain** before calling some SDK functions. The default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT = \"wss://alphanet.ternoa.com\"`. It can be modified by passing a new endpoint as a parameter to the _initializeApi_ function.\n\nFunctions are organized by theme. In the example below, the import of _generateSeed_ and _getKeyringFromSeed_ from the subpath **ternoa-js/account** allows us to generate a new account and display its address.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\nAmong all the features provided by the Ternoa SDK, this short snippet of code allows you to create an NFT, submit and sign it at a glance. This single line _createNft_ function, require a few parameters : some `offchainData` metadatas, a `royalty`, a `collectionId` if you want this NFT to belong to a collection, a boolean to define its `isSoulbound` status, the `keyring` to sign and submit the transaction, and a `waitUntil` callback parameter, to define at which point we want to get the results of the transaction execution.\n\n```javascript\nimport { createNft } from \"ternoa-js/nft\"\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize an API instance connected to the Alphanet chain\n    await initializeApi()\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\nThe official SDK documentation is available: [ternoa-js sdk documentation](http://ternoa-js.ternoa.dev). Additional resources are available on the [ternoa official documentation](https://docs.ternoa.network/).\n\nDiscover our End-to-End Test dApp here to learn and test the Ternoa SDK : [ternoa-js-test-dapp](https://e2e.ternoa.network/).\n\n### Cookbook example\n\nIf you are looking for a quick overview about the basic-usage of the Ternoa SDK, some explications or the best-practices, and how to create your first NFT, we recommand you to look at the exemple section [cookbook/basic-usage](https://github.com/capsule-corp-ternoa/ternoa-js/tree/1.1.0-basicNFTs-collections/examples/cookbook/basic-usage)\n\n## SDK Development\n\n### Building\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nThe static website will be located in the [docs/](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites relies on testing pairs located in the [testingPairs.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts) file. In order to prepare those pairs, the two scripts [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) respectively fulfilled and emptied them with CAPS. Environment variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be define to run the test suites.\n\nTo run the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses recommended ESLint and Typescript rules to ensure coding good practices.\n\nWe've setup linters and formatters to help catch errors and improve the development experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n[Husky](https://typicode.github.io/husky) proceeds some checks before pushing a new commit. It ensures that: the project is building, there are no linter/formatting issues and the test suites are not broken.\n\n> If you use Visual Studio Code editor we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n## Contribution\n\nternoa-js SDK is an open-source project, feel free to interact and move forward with us.\n\nIf you are interested in contributing to the Ternoa SDK read our [contributing guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use Ternoa SDK, the [ternoa-js-test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect entry door. You can start by contributing there to familiarise yourself with our architecture.\n\n## Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and the already available Dockerfile.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n## Run With Podman Tips\n\nIn the next examples some useful Podman commands will be shown. It's important to note that most flags have been omitted in order to make the examples more concise. Before running anything make sure that the image was built from the the \"Build And Run With Podman\" step.\n\nIf no command arguments are given by default it will try to build the starter-project project. To cancel this add `bash` at the end of the command. Example: `podman run tsdk bash`.\n\n### Remove Container After Exit\n\nA container that was run and it's job has been finished or the user has exited will not automatically be removed instead it will enter the Exit state.\nTo make sure that the container is deleted and removed after it's being used the flag `--rm` should be used.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n### Persistent Storage\n\nContainer uses a local copy of the repo in order to compile and run examples. This means that if code changes are made inside the container that they will not propagate and they will be lost. To change this the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa-js repo. With the mapping done any change in the mapped directory will be visible to the container.\n\nThis can be useful if you want to develop applications without installing all the dependencies for it. For the workflow check the [Create A Development Environment](#create-a-detached-instance-and-access-its-shell) segment.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n### Run The Container And Access Its Shell\n\nThe predefined operation/command of the container when run is to compile and run the starter-project. To execute a different operation additional commands can be passed at the end of the run command. Example: passing `bash` will run the bash shell session instead the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develope new applications with it.\nExample of a typical workflows:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- The host runs the container in a interactive mode with /workdir pointing to a workdir on host machine (can be your own project or ternoa-js).\n- The host writes code via a code editor and uses the terminal (which is connected to the container) to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nternoa-js uses an [Apache-2.0 License](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE).\n","readmeFilename":"README.md","gitHead":"152bc5fac784f47ea6f344f98299178451b8fefa","_id":"ternoa-js@1.3.0-alpha0","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-jDWW0wUHdvc+iLbAaU6ov4bu8hxK/gUUR90yV2d9dtZGXZ5Jhx/Y4KTaid3I7vh+YQuz3BggV9mEwcGc+qevjQ==","shasum":"a1b2d267a5cc60b4e81877ac399d555fc19b7ddb","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.3.0-alpha0.tgz","fileCount":79,"unpackedSize":433622,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRVuXu5G1IYy/p2SDFCoCQehKWk4KFfg8wmXB65XWMowIhALcCwI7hxcoxVlB50jk/yg9DBI6axO/dK7zFVHrZfam0"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjFyKmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo81A//bLAUdHevbMPf9b7KPRxfoCk5F7a65r61OmwPkEKfU+ioZCrb\r\nFMlBst4ChgdDekWIzAYYx7vQeA7DcN0kWVgojw+hwicDBrdaYTetP3dbqpRc\r\nRJ1PVQtwC7o875yFdfb0BbWCUZ/G8LCaMt+k4lWrvoKPdjKAmfRS0jJ0+wZV\r\n9+HlG0o3YVN+cTUY79qX3UC3Tj7JmvalnuP7pO1fRnl+EJZ+t27qAtJWEZHL\r\nqCjcnXh7ardY/gwx1SZUBWWtqRnU94NTFIlSSRGQsFv0Ca7AFPG8FWnzHX0n\r\noXicqH9+voJ4mGAwieptkJwBHTStExFrovGq/p3vFpB34KtWkywVRA/pJCeP\r\nFNT1WAPRGCRog7tQBNAjkXgcCqPtxVbyT06DaaI+gbs8YAJs5FsuYGcv3neJ\r\nN20zr2RnxY7aLie/9BKsEd9G6+hFwopO17liYM5AVLRHujonZ6MVPZRK+OwR\r\n8FJUywvhabgD1QdYthiRNOp8eMWRuxoWcNiIyRmmpu3sHuzwmCN+hUA8GHdd\r\n0T/NYGWJNALLOUUM06OlS3vFI3ipzz6QxgyKwDJ+N/h4IWAq66wc5KIw/DS3\r\nkOuKaEGiHyqgnUFyxK92Z0KRSrqamM0+RpDIgKsP6u9LlHH6ZQYxnR3rSwev\r\nKelxHhqs2mzksfsIewPkhN1xbEnbnQShPYk=\r\n=VtaO\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.3.0-alpha0_1662460582757_0.32201463612298564"},"_hasShrinkwrap":false},"1.3.0-alpha1":{"name":"ternoa-js","version":"1.3.0-alpha1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","axios":"^0.27.2","bn.js":"^5.2.0","form-data":"^4.0.0","mime-types":"^2.1.35"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![npm version](https://badge.fury.io/js/ternoa-js.svg)](https://badge.fury.io/js/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#🤔-introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## 🤔 Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based Dapps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents`, we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` varient that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` varient to create a unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go the easy way or choose the complex route (for added customization ) , we suggest you choose the right function: Events and features data will be provided directly on some function while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) assosiated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you can batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash as the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. It returns a pair of objects that are used to track the progress of the transaction execution. The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned objects is an array of events which gets populated automatically once the operation is finished.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop Dapps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"5152ca4e2e6af8286a8753a662ae1b50b834399e","_id":"ternoa-js@1.3.0-alpha1","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-KETLvxj83VeM+FqVRNtcx2+beWrPNrvHHfqMmd8gj0KNm75MAKkrG6izLGJbcZNCsJuEmK5EwAvS3in+CkRUxg==","shasum":"866295bd2287dbf2bcdbe2c8b96098d68bf4aa40","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.3.0-alpha1.tgz","fileCount":63,"unpackedSize":318080,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgtqLMaDFLtY96HazT+q5N/Zh6eCqjXjYQfu12RPIcPwIhAMhQ4rqGRD1OyUenkLNp6MCWesAdhJXQ3AdhhOuqaKxp"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjLYryACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoo1BAApTBZbS+ZLhtBXjWfzyf2SOeYV09CkgGu66z15WCDz/13TwT6\r\nHn/x9eZk9pnoewgs+Sop4JD1z6rT7hk0oMlxtPfNQIWFk1ME5mqQgb399vAh\r\nrgYYTZrs3uqgKEALGpuBgE6jL7oPJbQsc4VvLp7s7DNS2XHMQjM9VwRgWrBH\r\nJ2h1q2TvPlnK25JyV8EDaqlmEE+lPGQ0Hxe52/UBQ65kURArE6xlmb1NXz6U\r\nFV5S//doAJBfqd02fKW2djnTTJOvRa9zvBwMV62jn60iFCQ3GoGxnH5VBk/d\r\nIvmzPpfCed1lYXWxuof4LEhxKk+JSzhlCcgbJaRTFJqkJH+0pgPd7QUG3Xzo\r\nOaGg6OwBvfug3bE+R2sjbX2lCNjkpqlS3LeVeP7x71E8ACM/hrue5jjtPWXH\r\nbs4c64G1bCudn213SYJ0rn1MgYBVDUEXT8v4smHwzr7l3Ks05UOuyTspcBeZ\r\nWWaw+HiFqBp68Cv1cAugqT05fExh/Ev+zeQzI7SxZ56pUBbH/+H9SDu9mGjw\r\n/DVOJl9IIprXXvWFZXTPxXN6zkyPJ32QtfRwnSPUpG3scLQ8j+iV8YYHsRCj\r\nhj5PSzGRdsfala7dLm0o03CSZsc4CfdXJ7RLqtRzg7iuL0wRSInrgBcV7Nc/\r\n13NE64xKlyhjXA/zX5hwG2Lp1OZA+y27SDM=\r\n=FksK\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.3.0-alpha1_1663929074454_0.23706503893658248"},"_hasShrinkwrap":false},"1.3.0-rc0":{"name":"ternoa-js","version":"1.3.0-rc0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","axios":"^0.27.2","bn.js":"^5.2.0","form-data":"^4.0.0","mime-types":"^2.1.35"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![npm version](https://badge.fury.io/js/ternoa-js.svg)](https://badge.fury.io/js/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#🤔-introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## 🤔 Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based Dapps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents`, we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` varient that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` varient to create a unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go the easy way or choose the complex route (for added customization ) , we suggest you choose the right function: Events and features data will be provided directly on some function while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) assosiated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you can batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash as the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. It returns a pair of objects that are used to track the progress of the transaction execution. The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned objects is an array of events which gets populated automatically once the operation is finished.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop Dapps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"472d2c2361b63617799278c565c344e1027b9fa6","_id":"ternoa-js@1.3.0-rc0","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-rK8m9uzXbtiZ7Peds6IT68quE18zWc701XWnAyWNjC6QY2zHNFtg+FmZsHNKyLovUj7rhMcI++1K/WFKdwjILQ==","shasum":"9c54e5f7311eaa22bbb68b49acb04d37016afe53","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.3.0-rc0.tgz","fileCount":63,"unpackedSize":318077,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCcGOq5nhDitHPnurz13X3UPPHw+oXb0lWgSGAVS40+6gIhAPhwE9jhFLKxmhYsnJ38s5uMhTkalFmjKUgQ6yZXjc9v"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjLZBWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp2Cw//Y5vCA0a1WLXXtUvdl0HbwCD3aQSVckf4NQUBlPmbATuNtk2s\r\nXwvy/+4+pQOW1+KB6373+yw9EU2HAZYK/WBt2QTb0ejdbaoUvv5UD0JFgqWJ\r\n1iALJMcpOzixX4URQq1V1uA3T2//102j/77his0n82sCctTOwHXXWibjRKKV\r\n14jOYoyEm8Hs4eRnhGlIQH3NjoVydi/JkPOehCHHMG6rdySQtx9/QeHe8KTp\r\ni3e4AHtWft6JQhrn9BPkMYhbHplqrbE5d4hvJsqdVSb6OvbGOPtlZWEPgkyG\r\nppapgCvkBwoW1weOhsMGQapbtS+pgqywiSrfRH0tZxCh/9k2ufC5FboHKJkf\r\nUNEHaZhHcwjA+JSK63F0WQITPDi9ee5dHwFh7NuRFxinRgv+2GcltmNgOqnt\r\n3PWII+49i+P7wNC0QUHOmzWVEWAdm40NsW5pUmURTkktCZsiNNOX1mbrH4A7\r\nviQmvBROn/UjI28uD7R3YlfmSRU00k5IqeoEQ5ih6SqA+4qmgWsHLAxOS4CM\r\nKgJBRmAV+6InffpKtL0ejweVVo4hSHjBvlYXf7YERbXabzMLi19YDPuvF3XS\r\nafQIrKnpdNyDp+XOqz0DKylDTA9qang3yk1/3reINxKXKdtD1lEg0WfHDICT\r\nWn+j9Swqdy9WF2zwzfXpFGHxFI3vYjN9v5o=\r\n=5U4w\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.3.0-rc0_1663930454171_0.99931141802914"},"_hasShrinkwrap":false},"1.3.0":{"name":"ternoa-js","version":"1.3.0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^8.3.2","axios":"^0.27.2","bn.js":"^5.2.0","form-data":"^4.0.0","mime-types":"^2.1.35"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"gitHead":"09862f7e74bd01099b515567036f677501a6fb08","_id":"ternoa-js@1.3.0","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-9ccIjhos+BtOKN3qxSAUGsS3uE9eDcu8LLKkl//qpFrBLluZP3JxLRVnWphdp7wtNvfQTHd+bANu22hMPfu6cw==","shasum":"c136341a7d8e90d8e2545a039692bf3e10088343","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.3.0.tgz","fileCount":63,"unpackedSize":317929,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGH+rQ/mMrjTNq0uzRfYYFGffHt93fuzE3E2nRUdwVdGAiEA0A8SgMrLRkD1+9gWTuRosA6NA6ZUGLVSZ5ijtpuwc68="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjV/82ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqsPg/+O9DhxY+uA/62r24F1jt9nA24ERPLU8f+5u1t8S2L18Gpk+8K\r\n3AsrvTNjtflVFkRAF44oniakSTjysqerv0H26B2FkSnQCQHV8dr6TX2W8yPx\r\nZBhYGu0mxzZ2zKrqXbsV+QY20gzV6Dm7/i1YZ8VHX4YFJlm4DWRVrufZJ3GM\r\nwMdY+6HFYM1zlCRxLcU+0VCkJcuX9hKJ497/pOrSEMBc2cNRZRDHJOdkPLyg\r\nMGzEsWEpaD47Z5t5WqrGpr3+SgQPnq0r80X6RBRKfuc6XBjFMvumF/Vmc9wd\r\nujxmpw0MWf3eE97djoFxgA7tzIalFLQXZCW63xOrHQnuS1nijdNTakOeakc4\r\nXHLU7QDKDldnLoCRN7sy1jISu7e0/X3IoibHtZUiVjqgR9YoGEdFNLNNrOIQ\r\ncFs/xOYffpiMK02qLIxeQMb64ZUr3Z1KRFPYqTfcnDeKH8k2PmZLEmZk7x3Q\r\nWvrSgmd0+MMKI9IWb3tldIBLZcvMlJbciTK2OyEVaLRjTxieZB+Fz7jKYLP5\r\nKsqpKMdxrmyjGqFqPMrnoTjjVOscP1m//TEBWGe4S+fgGSf36UAVHaxTJHRa\r\n7WrxUrIQKX+bZSI5HdaspbhusY2TZwQy1LRKlVA7j9zCLCfra3k6qpK+r/kk\r\nn0IQmeClIcqA3v/bRyaL3VNx/CDZC+/lM58=\r\n=QvPf\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.3.0_1666711350192_0.7883488309696656"},"_hasShrinkwrap":false},"1.3.1-rc0":{"name":"ternoa-js","version":"1.3.1-rc0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.6.1","axios":"1.1.x","bn.js":"5.2.x","form-data":"4.0.x","mime-types":"2.1.x"},"resolutions":{"@polkadot/api":"9.6.1","@polkadot/api-augment":"9.6.1","@polkadot/api-base":"9.6.1","@polkadot/api-contract":"9.6.1","@polkadot/api-derive":"9.6.1","@polkadot/hw-ledger":"10.1.11","@polkadot/keyring":"10.1.11","@polkadot/networks":"10.1.11","@polkadot/phishing":"0.18.10","@polkadot/rpc-augment":"9.6.1","@polkadot/rpc-core":"9.6.1","@polkadot/rpc-provider":"9.6.1","@polkadot/types":"9.6.1","@polkadot/types-augment":"9.6.1","@polkadot/types-codec":"9.6.1","@polkadot/types-create":"9.6.1","@polkadot/types-known":"9.6.1","@polkadot/types-support":"9.6.1","@polkadot/util":"10.1.11","@polkadot/util-crypto":"10.1.11","@polkadot/wasm-crypto":"6.3.1","babel-core":"7.0.0-bridge.0","styled-components":"5.3.1","typescript":"4.8.4"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"f8eeb089da3d57ecb368024c6eff29303c630e63","_id":"ternoa-js@1.3.1-rc0","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-3TPSoGFoLMnAXskMOxB3NvmDzNDLchsKwqevJU+F466g9y9jMuea2mKh9XvNJ6JuhWL4WuDRKKZeL7+y3Dv+cg==","shasum":"0fb2c860f80c2e388d89b8916d2b71cf0b3c1435","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.3.1-rc0.tgz","fileCount":63,"unpackedSize":337910,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDgZxwQDRRRGYzp6sX41rf3zGujf6a1VWVCxnlmA170MgIhAI4HK3dz36J4vLsu++27lwibno5qwyrMuVRaxIghogmH"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjWADMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpTyA//Us81A+CskEzsXnQFh153LgotAD+wb9CEQMqxyVoaOhOWw6Cf\r\n8s/KqTaIDrtoAQiZW9ZreNEe8DXFDN2bH4MkJ8ii7HgnouQinOmpWv1rqz1M\r\nc4/EmhRImzlq5dBC3M4uZZqDoSl44VNMRL6fdo8+Ye6Ui0UgXK3XjsnvB1Au\r\nXRBOhWbANtGdoba2LbX80gTAeXXxwQImHUHZ3U3Uxw/UJytoc6vPSaQK+/B1\r\nobb1D+kPBQs85Imnzk0YTvQZZGkR2wG206z+WQuPjANrYEt6FPkR2wqPYmNB\r\nH1aRbO4bCPdPEIT/bLqe5+9d1/qdw+6JomRkZ5TWFTrxxAHLpKqdMfAVbh+5\r\n+btriFzqBk0v6aebpqytGxm24Q+yK01kJVOjRkEOVViuapZsvIlqjNjLGRDX\r\nSylO/H+C2ubc7Omkr7ltbL6hm9xHbokwLAJvXKbZARtXPNM2zM6FCg0FHJmU\r\n6tq+eeOQtUi32kC+u4uKX4eY4Udia3oomsJL9Yilct/oVoacFPt/reHmUgR5\r\nvMl5BKpNW7yxFa2Heph7aMJVHabUD2WgkPeYAlc+kcLp0tkx/1hJaYJ6KXMj\r\n7fZn+BZbQPhOS6Yajy/mc3xqWJYlTiCslXSCnz2X5uxMHvK3PYhaJm06NIHv\r\n6MTkgaoYXV5/OZwyo9uG8f611s22IP3tXCk=\r\n=Vqem\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.3.1-rc0_1666711755959_0.10333799840260127"},"_hasShrinkwrap":false},"1.4.0-alpha0":{"name":"ternoa-js","version":"1.4.0-alpha0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.6.1","axios":"1.1.x","bn.js":"5.2.x","form-data":"4.0.x","mime-types":"2.1.x"},"resolutions":{"@polkadot/api":"9.6.1","@polkadot/api-augment":"9.6.1","@polkadot/api-base":"9.6.1","@polkadot/api-contract":"9.6.1","@polkadot/api-derive":"9.6.1","@polkadot/hw-ledger":"10.1.11","@polkadot/keyring":"10.1.11","@polkadot/networks":"10.1.11","@polkadot/phishing":"0.18.10","@polkadot/rpc-augment":"9.6.1","@polkadot/rpc-core":"9.6.1","@polkadot/rpc-provider":"9.6.1","@polkadot/types":"9.6.1","@polkadot/types-augment":"9.6.1","@polkadot/types-codec":"9.6.1","@polkadot/types-create":"9.6.1","@polkadot/types-known":"9.6.1","@polkadot/types-support":"9.6.1","@polkadot/util":"10.1.11","@polkadot/util-crypto":"10.1.11","@polkadot/wasm-crypto":"6.3.1","babel-core":"7.0.0-bridge.0","styled-components":"5.3.1","typescript":"4.8.4"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"0cb03fdb7729b2f194be2e323c2b70a2bff86d37","_id":"ternoa-js@1.4.0-alpha0","_nodeVersion":"18.11.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-RsSDbsrTSfilwGVLMxRejBJ280CpZ3uDxerXGg6Wu6Dn9t5VIRtI7qfVzMMAm82VHoNJlBBeiNUyRdwda9+ZRA==","shasum":"b9b9346fc49bb7ed2b03436c04554d1738095382","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.4.0-alpha0.tgz","fileCount":87,"unpackedSize":485004,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCHGkq+6NzIVf8MZAbacsOdLxXwHFsSmh/MF89bz5FdOgIhALKF32gr8WIF0pvvAr75tcikEBhLwIRj+23FDY/7tOrR"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjZOh0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr+thAAotls7O1UKXh7liYZRa4vYNhukTAtTm6VRsNWE/R+exTBEoEs\r\ng8xUuYOGoJMQjXNw3UJgLuTST678NJGYtgn5hyg62YGlCaBGQLlAqWv53kb9\r\nZM0hEPrB8ZJcxvCutRnT1aGjsBBn579ZyamfGI29DG2TPH2n5Z3kXch1crKO\r\nqwokpfeeEq6opalKzIVdBUMYzuhUC7QZEDbPh9EVGS9ON7ac3dDluCNGwmAY\r\nDVKunf+dwNoiER+Y8oKM7wINIHgc7lYkJtYf14bnwrZgkdVA8Poz1IWTTT7R\r\nDcfXh/oOUByycwmcHgWuSX1BZ805Ioo2ZcAPn9V0mi4GRmxBgJckX5Ly/J1U\r\ncJlNEOJ34c3PQ3/czRRxmqOCYFRz0r0X99+wPTIpYTLtX7yv1J3LQcWQu2WK\r\nFbsPvilxtSCGtmDcDBexPYV7UJ32CLX1Ge/r7sTaFbzNEHAWhgaR8mx/eHs5\r\nP36GrG2/VzxidsVHjwq3wN+c3jpxKnkDNGp/d3ItPnkfSUoO1yjpEU+FNaGW\r\niN7JjYIq9rx41ZRIfRK8D1dgiSh4+smnOCkAwiF2CuHVpRyHa9iUY1hNH3NH\r\nBsHTT8Ck1n4VD9PpNfr/y+mDcV/o/+DuzjkUjwrSdYxouV4PfLOhQ9HT2vQT\r\ndMTu6OTGChK2OkvUk+ywWW9MdEzsfDNAK2A=\r\n=X7JQ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.4.0-alpha0_1667557492432_0.7082263264908146"},"_hasShrinkwrap":false},"1.4.0-alpha1":{"name":"ternoa-js","version":"1.4.0-alpha1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.6.1","axios":"1.1.x","bn.js":"5.2.x","form-data":"4.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"dbf2c591f56880f0c2c42eab6c35dee583f47a1b","_id":"ternoa-js@1.4.0-alpha1","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-vwY7/2PiQB+cjnZFR04gXC18XEhQisPqEaSkrjvERwN5yooHwV+pmeUw/tzt7pTIk6qCYsns6of2OEPcL1xPPQ==","shasum":"38bc0b4cf2ee3bb30703ec3a98f9c96439b49ae4","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.4.0-alpha1.tgz","fileCount":89,"unpackedSize":482779,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDCj98EM8jp06o30ZTt1RYSh3A+U8/wGX5TRylrL8noFAIgLW+ZFirg20TfCILSxEM81Yi65rAwjgbf/moiflwg0do="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjcoAuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqClRAAo4jh4vUEXK8cUuyGrLhp6L1tWrUNnxy7pANENRdWFJHbrlka\r\nN+spWtySg9OTfuc8Gr2YAkX7H4NXM1n88aE/J3SNrtKPC/d8dr/Q83HZlovK\r\ns++rpRujlTu4BNoapjNi4tYFTpSoi0GhRtuNFTM9BF+8xUIWmVYqAJ53/LbF\r\nFKLsImaqxb2BamOCFkej7dvFfTVtf52nAECFtFztYB4Ay+sBcDF7wwCi069O\r\nbeujIQFsYe48YJFSqe/qxgqc+CR65n+eo57emZw4a6bdwbm1OcK2VroTobh/\r\nI04BW5VMOFkh7PBYDDPA5q43aYSCVUFPAJFFRsai85wlRNGeQQ21OhUa0gBz\r\nCSoM3uMZpkXHezT3Z+e+98ZDuryRWIHLdWZoSUpXkeSQKse7w7tU+PYgPDly\r\no+maaNTF8tlmVts+bbeoYscYFJ5uwDQ3Jw4f+XDynyXmCeuAx/wr0mrQeyth\r\nHiZUL/LUsGR9GSlJywTuiihx8T+In7QfdWiTdnmltyGR3gEjt1XZxR7cbW01\r\n9YE70q8YBNeWFz0QyoouReXu24X1abIVWflkCfOxQhwyvIaeomYrb+padPTV\r\n76R+NzfB3wFINCtNz4sU6S/j6rrMtyIHxgJ9KopK9KvXVpOlY9INOeJsmFMR\r\nnCmVT110nUCDZy0aZ7XgoYRFQxHZqG1DUbM=\r\n=tiLE\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.4.0-alpha1_1668448302211_0.12644627404829456"},"_hasShrinkwrap":false},"1.4.0-alpha2":{"name":"ternoa-js","version":"1.4.0-alpha2","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.6.1","axios":"1.1.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"1f693dd97a47f407e4d518c69ea97ee61be65500","_id":"ternoa-js@1.4.0-alpha2","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-EXF/6lp/Xm2kXm/fMXQub1kwXPTyuM5sGBNPvw/sUeMOygd5BTcDGMpD63/QRXXzMDKuvRLrnwlH5TKfv9kwZw==","shasum":"d110f0158f7afa4a56ed725117e0b6c4d7cf6b08","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.4.0-alpha2.tgz","fileCount":89,"unpackedSize":485824,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICL0yK3dN+TLchl2wk3Qpl4R6RTdN6EbCAtH7EnJ51xUAiAyu1SRnJEd4wSXdgTQAMtCgpUwOjJVyNisZodxL54yPg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjdTKhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp36BAAg2pxLq4ocvOM7XmNag2s8WJc/kbML0NxIuvt9ZP+8x0koEmt\r\nhTr9XvuDnTEPam818uHojqx5H5qLksSu9KjkCY1mKDdCAI0HdE8puGGMC+hp\r\nZrv8d5uU14tgvu4Dxn30KHeS3Hef8GbfCBQ3e+AbAAI50GpnHFIjyMS42SFl\r\nN0BnLwO4g1tWICyogdQ9OBouw0iVGT3Kd+I1snpT2vwxP8m3oyzVpqYzRaPv\r\nKAktNEm68OfUvsNFprdt+cHExA/ji0CcC32Vv5n1Wk4XZQ4BCMCEokIBr5jc\r\n9Lv9rSa6RnNlUa5WbRc6B6iBUyCC4eNsrLjC3nbsggvZMnbX0cqQMszWwULn\r\nwBNeRKQlz31FCeV1Q/xZ1TvtShpV+FHPa4YAtNv3WBGQdKz+Af6UVBQI+WWX\r\n2YuLN932rP+kcI3PqrqBfmETdDHrbxrnd9F8LfkGIbJBv+5kEnsdItcvDWdF\r\n8wzEKY5j9chwdBjQ9Ab+qs9vbSvuYjrxACfy6OT9Ck2go77eAWUe8vc74pFq\r\ndSqGDzalNKJ6RuhOQTsud6tmBEm8Xdvy2tPCv0xx+e+8XZXpZvoYGDXj2TRY\r\nyph5y9DUlj8w6PFDSdm5iSIO2Uan23FydHxgKX85hDrbILzJqGJQpw0GpZAo\r\nz016NZ09fq0rFvjKoPrUp0MOBM64aYKOx2M=\r\n=tuE1\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.4.0-alpha2_1668625057381_0.9744169700011083"},"_hasShrinkwrap":false},"1.4.0-alpha3":{"name":"ternoa-js","version":"1.4.0-alpha3","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.6.1","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"855d12154205aff5151e8ab8bfa0ab420a08e92e","_id":"ternoa-js@1.4.0-alpha3","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-FuG5AWL8iSoyHIDUMI1/6qjM+N3uTjCKSC4lZqVAcsEIEjr1h2oAdd0/DZ0BA104rx0KApa7v2VbUqK8qIaWxw==","shasum":"b8e3648db5ac7ef538c009f7d30d441dfc432b32","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.4.0-alpha3.tgz","fileCount":89,"unpackedSize":486644,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF3sX0yZLgS598wlKyoTelCOYOIZ2nBQAdQ+2aTBu2dnAiA6Pzt+uqqBJMHEG/I/r3D+8t8zebHShFn4Eakyz28Kbg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjdmJVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrKhBAAj70dEfS6pe/q9uKHzfyZulEt/WhImbnRQaQ9XXtTn0AJhlv3\r\nyOiw8it/bsLRRDBqeROAnSL5IftVXJ3YRrCGJk8wrapf/fUG7L10x7U/6F9F\r\nTe/Vz00Kimn4jQWIeRhReMmPZBzTS0ePUufg1DTSvvzlwAdfLvZIbn1iZZV7\r\nYADzBRnpT60mfEHVY8GWF5FkJwDhvpFT5sCPY8yG9TiDyxruPhAybeCP0FU0\r\ndW9racae9si0C+alEfF+mmBg7AZ3d3qcAO2axdVtPZVcW8nAx1h9v1PXgtdQ\r\neKJmjajhdB9Jv4+tfehWoi8BHMoRQtbwEyyjTtofMmjFB9jYNLBTVhJ0iKHx\r\nTDLO1C0lPpTjjr1cj+PBrUoe17rVnL62ldQab3VJWCM/1bHKi4qNiGfO+cBD\r\n8ecKiaLsP0FMQLVWO1q+2u9RRNOm738jC5NrT/sveqHcCVsZlES+MEcUYIeS\r\nFsLLsHWAdAcV8vwyqAtZ2qD8kK0NbL8ALFms0X8eKZLW3Pc5sjcKRM0KSCZj\r\nbmEvnKOP7Jjfcewjhwg0BUmj/0crA1uZ7lvjONPoqaHtx4v0/npmlCcfTmmS\r\ne2xDI22bL2GQffT8xnvFpynoaROlCaOGQQxoq82CZieOU6VZqMcFEZDeivSS\r\nuZTu84OucYchL6O5Ue2bPDCzTEzn/AmElEo=\r\n=RHjT\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.4.0-alpha3_1668702804992_0.016549681463793764"},"_hasShrinkwrap":false},"1.3.1":{"name":"ternoa-js","version":"1.3.1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.6.1","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"gitHead":"98cdde0cd1718187cae0462effb666baf7be36f7","_id":"ternoa-js@1.3.1","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-nA5dDB97WWRSKyMl1NISIGqCnkSWFpG4IUq2nkcOAveECWN5VN4xWl5rvDb5I7iMHoh3f39R33z1n8/GwiIjIw==","shasum":"b4fda7fec1ef1e36de212528e1a2d2fa56e83a4a","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.3.1.tgz","fileCount":65,"unpackedSize":343693,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD44/QdbIrWNqmK0CXekfGj84pOa4z2vMilvonlh9HllQIhAJ+K6UTeOPk+OQGG/PdvXuYSfnORGd0XuJ0BRz3X84AE"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjf1iRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqVRhAAj0Mo/6UkvshDKMrcPpNF/P5pHGuysPOI2RBQDv7MUkh2PR7+\r\n1sThD3a8i/jlcfAagCEE0v3Ck4h9icNUAE4H7c30KjIQpMNn4PttiVQ6Y5q2\r\nxRVWt8a8nBjSdsF9dmM7oefCJd/h9th6H64tCAFwoqvOJAcwWSJaYoOiUlhM\r\ni5ngcZhZHc1m3S+yR/VrOU7Q1lOo9GWIR67YBTYEpxHYYZA3Q50BXeaCt8+j\r\n4VOphYndGpF1e1293KEOAi+vpO83YhPBrpFzrPLp0q9MpFsPoeczX7+a8syC\r\nRPQc3NQuBY9Bub5gIsJHpLfGv8i63teQV+l07mKrkPwvxXRvXk8ObSkx4dyX\r\nJiApKat4Q1Rg4olfyoI69TNDalQQTiZDfWFUAdvR/9+hBUy2ni08+dT01Wi/\r\n2k8TAgUeTJrlaJ+H6xD4g+FHhNH+wPU8SteV8vpDxSsEt+0paPqQhtgHNxke\r\nT19eDoR9iktupJQYK2NHqXnxFb6PP/brWpLc7eNki4ItL8f/ljap5keEnggo\r\ne4jNcwTwFyLW/QW0lwoxMn+BrJthzdgCYVJIn7LZQ4rcpgCsFo1FYcei25mV\r\n8a9mNNfuihZqeJJD6Kfa+nPZOpyTGLMNLxeICk7/KEBqAZ18u9qmrZIqnc8f\r\niDb/2DDtq+dU/UIQlwOciSQ14Var5VGoI/k=\r\n=oozA\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.3.1_1669290129107_0.1351397998474444"},"_hasShrinkwrap":false},"1.4.0-rc0":{"name":"ternoa-js","version":"1.4.0-rc0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.6.1","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"29370120de27d4cfe440fdf442dd767e7ee31c51","_id":"ternoa-js@1.4.0-rc0","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-U9SIT/hKajfVJQC8Lizb9z4kYToXU6Yioy3gnj7KO8sOfl2RHCkLbpNo4XSQ5TGsfrh+p9TxtLctR/jNDc0zYw==","shasum":"34dc274908881d412257fac9afcb99f4a57d8ccd","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.4.0-rc0.tgz","fileCount":89,"unpackedSize":489704,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEGVNV8oD/OUf4JliIVEaF9U/CUsVVQyX+zgVqbBO3eRAiA/KsJORy8yLt/qImyblGIG9XTeakoWtnje706R2KqSYw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjf1q7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqUuQ/+KPm/1czR2QkcKhhB1AGuDT3fz6QyH/dpaZM5MOl6Su6RGG26\r\nwQ1qX5yJyU7vzh6GEYpOD0XZVO0pPCSwm/1gmWpkfLSf3sBuAHq0i+MDli0W\r\n3gLjLPkPnrA6fOHpj38WTlfMq3EpfZ+zSD3DGfQlItUT3hYkQVmChF4RO7uc\r\nGNSda7+QtPIAcG3hrlUJ2XFZgSBMajOho3az5Ap56AP3Dw4B9AM5zeUk9sjg\r\nmVnNty98PR+0MI/dX5UkIGF93eNO7WLU9yNBm1tp8OOqdfEU8VGeKRDiHfy3\r\nWecWuPzHaElZnN3rRfpsujoA7QxyrmWosKc0LZIFK3S0yLtjB3D/LwsUZ/g9\r\nV8mIi2hHO+LlQKvM7SGpSl+5W79eBP7cABorpW+xVWPw6QYbYt/Tk7qStkmT\r\nK79xfsod7VJbid3sWfQEA0aLclbxT1QC/UFpXidgm0SNUfw/VyfHI5jMOHj4\r\nkz00KB0VcnEIEIccM0EqjvQbuoj0eYFKBWM6R23BTzyhEpVYEwAP4kO8r38Z\r\nKOxbAtN+eg3VLD6TV+Z7kJMbcYbIhvCBkysy4NAZ1HBtixVIIdY4S0YubX/K\r\nqY6kRquf9V1O2RYdWgyfb4LrwnjimlsLC/fcQtpSE/+/J6bveQmiOqQ72kvD\r\nPO29JTj817/88y1K3+v+rUkJ+TMM/aSjQdk=\r\n=Oggq\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.4.0-rc0_1669290683696_0.9640692270157687"},"_hasShrinkwrap":false},"1.4.0":{"name":"ternoa-js","version":"1.4.0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.6.1","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"gitHead":"b200b08d0ddc694c9685247fde8b70bbb07cee32","_id":"ternoa-js@1.4.0","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-hoLQqsPnlHVvbjtuwDazhCe249ASiFMeJLXTktLCAw2zETIP1xToznH5S/irXEyYhqra4oBuS714lwh9DH1NLw==","shasum":"4ec44d60e34911f44ad68854f389652585f519cb","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.4.0.tgz","fileCount":89,"unpackedSize":489702,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH5EKuz37v9m1gLWMy6tW2NozctLyR+tqPZRIjG/PO8OAiEAifiyQLpzjQVvrydXLmc2m5TM0e7EznDn9zvsWICllK4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjk19kACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqfA/8CoSu+Vp4GkfQqBBCwmf7vswtrg4ua1Tbhd1/aDQoM+f5/kWj\r\nWUFOusJE+jafjEjolVE+IosCr6lv9m2vbKo5bQgvahojYhHpV2h8t+4AjF1i\r\nsBjyNqD1fVk9B1WCRS3I8dw52r1ScVDulv82Ysxv4L4SrQ/C+dxCupbAlKgK\r\nSlo7AYGRjFvdewwnOp3fR2RMzG9fS/xrj/dLBYb5ilPFFnoMNKfnHdiZUl7g\r\n8u8bgF++zQ/jOQsWkgT8tYVVYhD6ZxVXTFBV8mjvTUrA9Pk4vV+ZriaRV/Fh\r\n6y4gAxeLDqDzqL2jqbrfS7MqS2uN9/d+GxkhAjNlSd1+8nw4j/ITqRaj6d0/\r\ng2wJLglaULQ90bAR/YEpHOne7GsEmgFl8drLZt2gZI6VWSVlxvvmOu14Z7rO\r\nMBmAXtcFcFwkSvzNvGdszwQmn99Nmd1rA/U/XTsf2zWljd1jhcXlKmE5CNad\r\nf3IxXVWOhqisetNbsjxUe/tirPV8D+e5mW0RiRUYP7zHsUGESnzfSBDcnCS1\r\ndgRGjI4WaXpOujIGz6ZL51npBipgGDLwGLkY5Kvls3uEbCOclXV7CBXJThoj\r\nP8vmuOgYDK7L2m5zTBKV1sbJ9+Iblfhl4QY1jLcTOum79S4WF0DaZkx4DTmu\r\nW2Js4JeXK1aaCPGht/Xqona7W/wWiydT9bs=\r\n=b+1T\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.4.0_1670602595723_0.1967901740299587"},"_hasShrinkwrap":false},"1.4.1":{"name":"ternoa-js","version":"1.4.1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.6.1","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"gitHead":"d7ce79f01b37bc3808a4209cf353b59e88ea9b76","_id":"ternoa-js@1.4.1","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-gM980fAAHcUDC0QrZ1VvYNQhasFIBgKVQki5nMNqpPLuKc0rXIdepHXw96CbRxT60jLrtaFhhxfKoyCfcqDYlA==","shasum":"1bccfafc9aabf5cc6e089dedc8c8c5bf5f2f6fdb","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.4.1.tgz","fileCount":89,"unpackedSize":491113,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFBRN17ZN/SqiQUPSpcPiZfph6nf+nLdsHEng6LE0FUJAiA3xPBZyg94tEyzSZeFoAF8DD2hyHE9CEtlOwabhqS0IQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpEcqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpWYg/+NOHebFWiX+CT5MjcCGEjfdQ7ICOfQrBsAtOjUaOk1J2XwEE5\r\nwkZxw/FNzeDuK1i1m4mBuxat00Kpzca3X600FQvizFhj5V1+EPukFNcwWYSg\r\nmW7Qg+71AItnJLyyxwJ6QHkoXz8A1mnVnZSZLruoBgp8L1qXQvnPKv42e+Vc\r\ncZr6fNTcJBqzFaTAOrvZIpgtpVuBIb7aiMoFOHmkQIm2jjwQEDtTETrHZlgj\r\n8X0VCWaUHvx8pf2T1F1ug0gqg1J1ilN0wYHT/vLClxfGPBOpCILJXhCzXAft\r\n85Kvw6DNDWmWHSShvDbm96Mxx/r9Ql1e1czdjFaZaxpuKojVWJo1Jo+Kmrhf\r\nT5hhyKSPIBM8hL8q0qohWxVdCnugUSI48WM1p4G3tm4FM8PJDkquIKfOIhDU\r\niFts0+fpAdlAKwYwDh3+LxdVc5MZ4oBrbK5ef2ZWQGydLTGfR9qI3yH5+UAi\r\nLmI8ydmKzTUkUU/wvWL9FUOZlw88p2QP4hhKFcUP5bNdnGRk2WL0M4So1wGU\r\nJpVBrIChx15Y+g0Zh/EGCjAIWpPEO4L2eZa6bHsr8g9RjuBIhlQgoZPQd1hB\r\nLEpKQFpkbzwlqXiVoO1CoWZzl8TtSuczoLSO4WbkJ+jN+eCtRMClcMslS6EY\r\nU72gheUiKGOsJSPeoc95RlwPyJ1/SzeF3Yg=\r\n=KUSe\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.4.1_1671710506469_0.7882944839464705"},"_hasShrinkwrap":false},"1.4.1-alpha0":{"name":"ternoa-js","version":"1.4.1-alpha0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.6.1","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x"},"module":"./index.js","types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"52bdf6f234cbf8f8a6568d4cd727604f56889e09","_id":"ternoa-js@1.4.1-alpha0","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-1rgCCNjlWiDREWD6N2fcnf5g62yHJwlRI2+rCk/CJqoe+ScGUXB2bLZn8Ub+g15f5IMPrdzwYpSG90smP5zRAg==","shasum":"465ada753c5f3744026acd763992cacf22ad6dfe","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.4.1-alpha0.tgz","fileCount":89,"unpackedSize":458023,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC2/Gud3bWCl7pIvR28eA0mMVAwEP+ovWxJp4yvJNrT2AiEA9ETuN0+QV4TTlc/74kxXliSBSaQROvDLzKIxHZSJcEg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvovACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqeEBAAkPDpoHlnyrUN5dh5eJpiaom/mkpsE7T8yMTJSQzEmqk0oi2h\r\nWU1RHQAsmG4gzQseNLKPeh+0HEnDGEpZx2S5mWAQ31auoP2givnW5aoEWqI2\r\njw4dSoFb1clyc8epGAv/jr7GFZF5msQNVjmBZmhfm7E9wdcjmFajhxPuXAvz\r\n1PE+oaHJ14MhTi9qiqOU+l6mU/dGVvDNrCnd3Dnp2Lv2exWUtk7mJQrJbuaX\r\n+eHD0BX0C6ggSTh6o2b8s/OTm5fwZIuoDenbyARmb201f4RhvXuq0/KBGRiJ\r\ntua9Oo45EOs7XJhHbOgkZ5BMVu+0dJr/l8Wo0eiSix8WvZdLj818bsP2JFJ1\r\nTU18g33N63sPTl38KmUU7vPAwa82w1LzAq6S3EXyGWSF+8wKLFG2IklUA677\r\ngEf0aRq3hOBnlAVp9qEOxIRhzJsFrAzw6Ug/1jzJ8WTHNtbLxvYAYDtt99ZL\r\ncCj0YUzaT8xpEqvmJnOwZ1q0m8UDfkf/Eodwr5vVRRDfQx5IWfRqKY1S1iKw\r\nPAu8LlrkG2Iew1vlyqmzFfZ6+Rqa05dB7IgmhvqK5KVkUpLDjvrUCRWQTCA4\r\nXl5N0XveEJ6VRQP+4MCXaZ0/jx+IaU3PEypccKvSa30bzqT6NwPY6n4UsbbY\r\npP6TdKRNSgozJhiVbcObMSakuh7OQ12fA4c=\r\n=6CRH\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.4.1-alpha0_1672935983509_0.31755066881225447"},"_hasShrinkwrap":false},"1.4.2-alpha0":{"name":"ternoa-js","version":"1.4.2-alpha0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.11.1","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x"},"module":"./index.js","types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"adc89ca5cfde83f787aaac8e78f2bc00c5aaf647","_id":"ternoa-js@1.4.2-alpha0","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-Y5FXjkNIWi/zj/DpKxWW2nKCfVLtXsq3UPCsVY883VBomiqnqb6YqmZCSvvpCuvYyU1lGmhJ11lR+Gz8XzZZxA==","shasum":"d8464d470acd5faf32261a879faa170723977125","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.4.2-alpha0.tgz","fileCount":89,"unpackedSize":458312,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHNieGVC/fpqLia9IJdNcoRDwLeZJk04bn5ykndkv9eCAiBr32PhgXllKXzy9MpQo4Q+1f5rZcxaxsuO/apqGuCW3Q=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAQGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpjbhAAh2EruYF6nbQgqu1F+POWfv6J75SHgIveKr0TE3WYl6v/8z2H\r\nA7GSDwH60y29aW1zXyFsCHljzeSfhYGmirq/z2AtXfOiXQrqeoCrTHK0+kBS\r\nETfL4UEvEBipjFVRKpM8M20d1fll3xVRYIYHQKxdTu/ms0cHA3qagqtOF+EE\r\ntqjB+LBKv1nsECwOYbtceDPGjnL0K8cu7ocnH/kdICrcQ4ZU7Umwkodm9vSG\r\nVcboGFEQiV27EVTOgOXk7q+BBYYYI56ciczNNddQvUTE4Nl9xnXVL1sSb+rU\r\nVJD8stKoC5mOh1mL6J0rx6mtJth9g8JMR8uHWLbOiVZnJ9kE9qQ9RMXzublX\r\nVHXdsAgsKeJofLAqp7bTkNptb3zYVubaAaHR2f9CVyQAmB/dCtEtprLwbxLU\r\n2ItVpgIzYqmJ/vxB9GVWdnKfxXS9i+4SkAtig/VeqjH53rj9Ppl2xno1hBev\r\nlgIQ6l4wAnwOuqkEc5V4rfylcramC5XeFp0HPwrbMkZseNuaXrPQKlUyT8WO\r\nhlIArinu2qnvZ2s87dVsTGTu1sFHRnUekuw91op4rdR9t9+FOeeXIVbofuXR\r\netboaqrg/R5VZ7GH7LmKbn+NOy/aSxwEOwfRZmZimygmbKVqC+RAUdP8HBGN\r\nsx+YrkOgsYrT4da69PislNEOI9dxwRC45S4=\r\n=fajx\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.4.2-alpha0_1673266182628_0.21485070950757557"},"_hasShrinkwrap":false},"1.4.2-alpha1":{"name":"ternoa-js","version":"1.4.2-alpha1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.11.1","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"930b398fb311ba509adc8737828fb14a2fdf8b88","_id":"ternoa-js@1.4.2-alpha1","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-urmPh0xdSdMe85qJ09G6pcg8M7jtG6N0fv/mSyyuQvMTii07ud61B/TKyED4gT2VEoB9WAOdYRMn9RyJP4gRpQ==","shasum":"9df783597bf751f3f6ffe64e44dbd31251de3458","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.4.2-alpha1.tgz","fileCount":89,"unpackedSize":491409,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDYvikjKkZ9ZfptuNFopYowKxuBGImSWNM7jZwX4lVgBwIhAP/BRBJ4ma3F6Xtjk12inYR2QEmx9zYtwfBfmXDRr9Lo"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAeiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpLKhAAigRe8b9BvKyMgwQ2mPVeGDE1Kluyv+dZmVXWsFw6j5sSTVpV\r\ngdIGTYRv22ShcuZ6WIpOPw4sG0vELQm/aV3davCqt4FBOPlGEetdEJLvWO4A\r\nPUH2N4JPF4v8XYz/Uav9HCXX+akE+wduSDiGuxMgNP8YzaGY7PUhNw+aydR4\r\nslVAyhjFKEeKlD9G+o0s4P53jfGMRXjMTsMgOLD41RnsHd1zF53hVVmbfNuZ\r\n+gW9PNDLAsCiVssDwCtd2mAvdhjyPooiR2WiC7oVye6pR9KuyEeImyc0wifm\r\nTl4NoMBQMIWk0v1umyu4gyFInvFAF8qWzSjQBVN0iu/JwAL4V0cs6cXkeWZA\r\nsqXVfC7JbKzQX32MCpd1DTKlHLpPjfpKu4n+4hNM97Thu5QzJ1xOODywwX9j\r\nLZDt56SY923NtdhaaU24V1Lbl1onY85FaW/OHQ2qPto8z2JDvMdtwoOqThWS\r\nXiXdAgKCA3yUyzUoANK3usxLwZlsCL4cl4z/X0W+Fo0sdevxgZLX8JeoQtwn\r\npKautfcVslJFtKZfbW6Kjl1hdXC+3egwl0/b38l5m5hA0JFqxjKCN4zSziz6\r\n/AKq0GL+AxVlSh3PFm+5FOdws2+N+vOHbKZ1ctrJzMAkc+QBPEjTOligv9ry\r\nP0U0I4lc32UpAlR8f+hanZui9OLSRUMazZU=\r\n=vahs\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.4.2-alpha1_1673267106189_0.08484545694253609"},"_hasShrinkwrap":false},"1.5.0-alpha0":{"name":"ternoa-js","version":"1.5.0-alpha0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.13.5","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x","openpgp":"5.5.0","shamirs-secret-sharing":"^1.0.1"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"5488d99c59cc3f91729fc3c223a47340ebace5b1","_id":"ternoa-js@1.5.0-alpha0","_nodeVersion":"16.19.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-Ts+07J7jntqWbsvpscIG6OSSYTv6XHsbzqnQVznKSOEArvBEikpJHSbxBW1hVxjamZ9qvjYEIMl+Qbz10yJA+w==","shasum":"cfeeb81563c97b4b7daed7fcf7301d8063dc71e3","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0-alpha0.tgz","fileCount":113,"unpackedSize":636758,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBEljgROl4yGaLl9+p8mHzdP+E2oGdSHxd6Oj63TnLgqAiBIWMV6MYDjlq8dv3MPMJSQKGpXuRGlWQX1yGCMIrPpgQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4LCXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoJkA/6A+X57U7LlZojaHTHg6cgZV08fILZoc/qW27b2L5oDcvkQkxK\r\nhd+G122DQFeIjm2tUhzs60gPPTueyowAzfjA+ishDRxXy8nrx5fb0mShX7ij\r\nkUC8aLIFN0pqe4CLbUTt7+pNijtdW5sYMkgnM7DWk7ZVk050lOTw6SRfmiBL\r\nWp1mkI9hIIEveYTRSPDYsqSgZjwkYuKTOPNJwtjZN/k+vuOGm4K/VcsygRJX\r\nHxiIMC3ElOmyEXtKW5GkVVnuHvD0fX8aYclx07QjoB5oQfmxILesEeNlfafl\r\ngA7cman1AiQ0FRwXoBZ51Qnvdkxo6Na0dvRa+Z/NbvALu9AKoK7Q8tLr/JBQ\r\nQfFUsIQY2ZSZhB6/pthN/OvUsjB1dB9EI096vhAth6lMhPhYU6wZEDv7qOhe\r\nxd8IU4R8W7pWLVKQjntv7tb2631smBVRipjUQU1ZCv+mLQv3ekX9lWM/Pcdd\r\nZLcpDW26ZT9gdkBWc8wm6PK+7QgXUa2CyCNtNPs5xw5RyLhUMQg0/3d59Shm\r\nPsSWMwbcqPqb7zyTrtnn47yH3e0G3cXn1y2M3CLnlHk6keuoo/4vdfgf9GoG\r\nn3QaeInVID+D8y6UgVLpS9vwHP7kWLDA9msQ442ZVIAlLY0d6GdT8LLe4jo7\r\nPbazafYlg0Q7q8BNqWy8r6AWiQbRpc84DCI=\r\n=03BP\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0-alpha0_1675669655009_0.23563253649395888"},"_hasShrinkwrap":false},"1.5.0-alpha1":{"name":"ternoa-js","version":"1.5.0-alpha1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.13.5","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x","openpgp":"5.5.0","shamirs-secret-sharing":"^1.0.1"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"f92b32d020d3ec2eb24ae963d3dbb933ceb04b01","_id":"ternoa-js@1.5.0-alpha1","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-vLOo5X8YHnb0iXkDX1t/4RLyfxj/oPtUlDuzGLBbRg9pZa5g9rPrgMKtGXJVr63pM1jrF/ulG3LuBod4TDgmtg==","shasum":"aad6a119dd28c95e91cf20061041fc19ec13dd8c","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0-alpha1.tgz","fileCount":117,"unpackedSize":674232,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGW8+A60OY9gZOmVnXMDrbBAg6Gij5kmHWfVTQ8oJxbKAiBo6eMvyBVnONzjmj/hHEhDoTWiboinmGaOIqEwXLztpA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5lLpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoJEw//U9jRhZrqF4A9DUDadKQQevEU3jGBoaLcbAK4WTFPRQ0smelE\r\nH3Sr2Btqa2NBFwGVmE34CgjcggC9c/bsJTsRe7XI4JRnb3EhOq9kdBN8he6T\r\nbYgHVQ60l82ESlQBvWICkp7heZwsutmlYaoziBW7rRNOMEhQ4z2GqyH4NRc5\r\nivjj4l2fLjr4L3BUxKhWy+ekNW2d8nxmvCgH/sYZA2Cm2lkxl8X9/5gsph4o\r\nPopvivdcg8lKC8Y7qmqzEv553LV8VOHyf6DJVO/zsrBqxmT8ITirnn/e0ElZ\r\n07YA5J8+vW/5d1hsdmh4AcLx8wPyzgm9IeDiSt0pGA9jpMvR1/NLcRUPuwB1\r\nqT8hsEIiYnn81PH0Od2srNk01xf/LQjM8S8mSXJtxKaY159DGPtiJ6kCYlBl\r\nFRFb5jN65sPWbnFvJDVi+ExYix2c3a0if/vm2bhpIbg0MeCW5i7rGwspRH8u\r\no0upPBSYJh9SdQ8LMYKB8qT46QLo+cn1LNFe+9w/S/V3cDmP+Bp47AICBSPu\r\nhLH1ZaLTmJbO34MOTwqYDPcFfDUWufr4tRFC94oAJyiMb6nIw2HCfEoaCjQ+\r\noRrP4WcrYnpHS/jyC4nmkzV0EAA8GPpxDD67eHV6qBSr0cmYOJIrr4d0sF7t\r\nU/YfSqc8lSLqI6bZDrQ5S671P7nNxqQKfJo=\r\n=sHPJ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0-alpha1_1676038889141_0.8260884235634636"},"_hasShrinkwrap":false},"1.5.0-alpha2":{"name":"ternoa-js","version":"1.5.0-alpha2","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.13.5","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x","openpgp":"5.5.0","shamirs-secret-sharing":"^1.0.1"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"15046c6ebcbe5f050057587d37383c181f01f673","_id":"ternoa-js@1.5.0-alpha2","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-28S3CEmtTtryM04LNfEtq7Sl9kidGLuKpI+38g5aOW+ErYtc6CarYTQwm3P4McfMVNI3bz+CjUoom2CyMYvPrg==","shasum":"c06ea7ce3d06904074b5034e42d679455e7de27b","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0-alpha2.tgz","fileCount":117,"unpackedSize":675896,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCj6jFnQKkDYkFND8+ji8cxGEworFhxSdxP8OyukFgqSwIgZ8O9N27gOdEb1E6naa/FxhBLNYF9utz0WkScSuKAdQk="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj7z59ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrQ5g/+MGfmnWFhQkTsS/YJUPkuQimU0Wr6N50MSdLdbz3UIpGxg0Bj\r\nhNN03DfXku86epl1VGdnreYHKg3SLAzXIXftwhL4fgTmYhoBQcBbOJxvMW7G\r\n86JOXgZzoU3OW8pM180PjPyY4Qlw3Wm6Z44bVLwjoOItoSWsH7YAo3kYzh83\r\nnXI2nJfGMmik8BmjQvdd42V0ATJLWPBqWRXmTB7DJMPcVGWzWmzga42QPNMP\r\nljdGWDTeHpji+RqkWFQ49pAgtQ8FmRrz0rAAXF7HNygHEeaipjSI2t7MDlhT\r\np61GSAIxMXhH0sViEhsr2Cw8aoXWX1fpsk/Cyn2rjGkIa0cFK+UqcGvEr8X4\r\n+Y10sy4TuS8/EBIpe0BIf5sZyr6m1bHRjH9SihKjeayoINkZbt33omt2DNmV\r\ncHLJtk30wpSglcV7gzlRxHJDJ2OvHWpPltJW9WCE0j6qYZQaMtQwEdAy5aJD\r\nSt8OrH1cTFFh0732ZFDrR5Gv1RiJRbjUOdy/iRCO/+tQdQC8cjW1MF1nbNwI\r\nATj8EnbgjWgobrRpj4GhhB6/CKgZTuu5fpUAZ8kfFFJA+KsrWHcAVKzyxd6s\r\nCOpvL1HFxmCCOd8sieCOrAm8sx5cfaoHkjBB5Ewow5qXvsON1LpRsfWFB6vP\r\nxh9F6JtcqNGNF7KBP6VBKo8HZhZRQhByHjs=\r\n=HuWR\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0-alpha2_1676623485232_0.4114919733839322"},"_hasShrinkwrap":false},"1.5.0-alpha3":{"name":"ternoa-js","version":"1.5.0-alpha3","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.13.5","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","stream":"0.0.x","openpgp":"5.5.0","shamirs-secret-sharing":"^1.0.1"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"85f7ea11b8b33143b12e2d6a7f8ecbf35d19ba73","_id":"ternoa-js@1.5.0-alpha3","_nodeVersion":"16.19.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-c7MaMjPhHABQ+6lAJQuHOrDC/77dxFNHeJavEFmPh20jorvAAU+vXU10cKQbhTQ4pbXx3dN+e6qy3n78JuXt0A==","shasum":"fde2e18e57f391240c24011e0c9aa112aa0bfd3d","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0-alpha3.tgz","fileCount":117,"unpackedSize":677611,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFnp8xyOErxxKePNW4IqolU3Tqm5hhNDEZxbDbf1MsjNAiEA80tuBfquMnSIteUqLHCnDwRrlViMx0pjKo5roWZl+QA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj9MRwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpYcA//RJfPKQIRRMMqfvPQANEele+HbKR6dXq0XJfqT1VUTOGxM4ih\r\npYHwArowhQMrmhAuTKMkaNoX0YqYaHLQhKSTGp1dhnEIx7AFlH7ijNPssrwh\r\ndrfMgh+abtV2rSHA+bIQiKFUBYOG8CYMIw5DQhd7ukDebzKGwSnFe+hkBt94\r\nQe7/WWGLbH/gSUba4D3FofzBFw7mgN+1C6hqRQxjWVhrdWqtWbPJmDICLvfo\r\no0ND+kBmEUZViq8BOWtTgpIh1WakAAKZJ03Nm3/BJkl6Sl9xZPBeUaUD/HYQ\r\nFJdP5xlN1vMBgTdevOu/uhWIgQjgWUcvouHFHAiW4jK7rZBS6mbByLzTmTtk\r\nLpoHfo2vrGqIdR4zXCzb3EZvL5aNbltkUeissLDGluy1b29YiGmM34UXx9AN\r\nv+VHrCs2AzUtRxiFKoMFM3C13+9FIqF8yv6aDIUeL2fGKszzyguKiqL8daTl\r\nKDr8ccsY8HxZC/lfpCYWKiMSaH/sbzZb12HmNM7NB1HO8sPRlUo0vLlOS3CF\r\nGh8UWFFYFp7mmSAaBYF/124OmpB3LND2DoaldihfMZJLJlslWXwZ0lfKGBsk\r\nn26ucBCOHv3LIaYMWC+Dbj4s9mijbUHZVR2DEG7mSkD7ecGvhFqnxre7clf+\r\neQdHsqtCPbatDwPNHbPoajjxcUV+F9vsLhY=\r\n=FhhV\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0-alpha3_1676985455984_0.32707647282771224"},"_hasShrinkwrap":false},"1.5.0-alpha4":{"name":"ternoa-js","version":"1.5.0-alpha4","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.14.2","axios":"0.27.x","bn.js":"5.2.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.7.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"00bebfcdf50b9f87162077667bdd9c726c4be6fb","_id":"ternoa-js@1.5.0-alpha4","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-rLBqmvQYq9XZCtSRImicZPo9HMa/j1lOTIhy6nhwViq1zvopUtV2rxOk4ppgdUxzNRgzo6yCZEYMY5oomRBBSg==","shasum":"71ac5fdd540741b7fd4e1476e455b087feb5d31b","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0-alpha4.tgz","fileCount":117,"unpackedSize":687951,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICDkgMBd5CDiJNUo59LH7FQXMfH/frS6BjreWTDsner3AiARMJGrzqppyx1nPFiif3x/jJV+NdzD7Xd0IVGN6Ct/ow=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/xrTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrmNw//UFAhbyH8Eij2sVVc0/itSdcHi+woAiK5DYvwH6sBKwV/mKug\r\nVaJiboXCeDZG4nCoozRP4X1fC1cSZ/LPaBma9yS5VlrIV6XHVPpzLwVNWuOB\r\n0gz4oohKsjMWGmP3Ezct+SBGHK2QisI+p+4n3gk4jnorn9F4RnhPfZQY3pvw\r\n/KQQZCgUXec6M6CoEKcOU2AyHKsWmp710/mwtOpNKKSBBVYz5gLeGsucOiGo\r\nqwjDnTkUlrKTN/0icIwCTtzn+aVvc1bCwyUKXad3yhadcGHVW3sNp83IPp8g\r\nwb0BYwY3kc7R8nfWc7udLxGTniPpj29LfVyWYvjR773hXQGwGfUGRkba0qre\r\nwcQqS1qVG6lzu9OJ1FaNtLmv+C6wip9qeTu4nJZAA7T3rO/oVWccDT3/ui6G\r\nVkvinmiDaOVJfuoanKj3WMA1R4kmC9+qfvVKRQtQK7/oHrkpDuxBkwksO8Pk\r\n7vLp65RCldnBBTVTv08fW1cW0tCujE5XHZcVBrMLgeyR/93v5fN3BVhzZx7l\r\nGrtx0kt08eIxTrpb07JhsihbR7wvG3vVVRuWgW4vwIPOWVeG2EwmGOlhppLE\r\nrrnW9ikGIsQZZ2y8g5xV+N054somj9b5dBSW1cJzihZ7eg4F26j6Od0Jg/0Z\r\nay76qcTMkrMtIjTfBCDhZOVzhgp9W3FfFwo=\r\n=enCI\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0-alpha4_1677662930823_0.7026613050968118"},"_hasShrinkwrap":false},"1.5.0-alpha5":{"name":"ternoa-js","version":"1.5.0-alpha5","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.14.2","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.7.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"a3091e542de8f105239b5cddfa110f35fe047ffb","_id":"ternoa-js@1.5.0-alpha5","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-8QpXPGAiNeu8Wz4kPKawRuDloFu/RZFk8XKuSafwIbiQK6tyelv5/f97aCLy+y4FR3EXBH94NL7Q7WCJLzlWPA==","shasum":"2d23492ebc8e813b61b9fec53bd8ed4ec11c03e1","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0-alpha5.tgz","fileCount":117,"unpackedSize":690133,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDwrg0lYh4Bba+r+N9i7WMjwPzNE8x2Z0NKVgV87WXM0AiBwFgg4M+cUxpY1kkxtoc4/+c00A3pEYitdia/TfQpv4w=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/2uDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrmvg//U5gX5trHwnIv+Mh27SOhZfiXVyRJfoHSMDCA5g3A1QOx4DTs\r\n/U5iqXLC0valQy0PKeozX1+qVV+K4oE3o4DX/KuanlWOSQlbGotP8vhxLq+3\r\ngzni8dJvWzDyPi7Zk7YrZ2Mp4ws/nNaczJ2VsPqqWaf+kdXPMzqFm9tPhsX6\r\n0yIUSnyT8z/tRvNOWUCLI1aRFjAecSBo16sZBIHTY74tTugDR/7zis/FQKpY\r\nmypQqvlvCRNCKqTLXQ/iW8ypud1incMC6HhOPmPuUcAFJnWDhrPLkxzyNK6j\r\n3dszBisf4cYIGm8Qn5AN6f3a0sh46y5mpqAbBdhn4bfSZypkD/ilk1PFhbqW\r\n4ZMFqrLja9/e9YMp1gABhahhw8646TW1OpbJsX0YXPJNEzypeXWtai4IqD6k\r\nuZHy1ka9/8Q/bjQkZQa+7pYsa1eEDXVkrvWacpIBcE2PCTDZkrwb+rLu0TOT\r\nbJU78kpdMYIU9WtCkl+D31F6udjyO+1rdFE6gQdIDrcJYaSM93vFQxeUEIN1\r\nAWPpoD0VBWp0oEsVJL6jKhTW7keOandgjUGcGa3YXndMh5g+5nMTBkkemn+/\r\n0zxet+jC9tWJzfU02ZL02VDqSd4fyjblDZu+mTyNK41FDhaKaEix891+hGfH\r\ns6MANaKvLZWfs2nGrzxI+eKDzL/+aI49VWQ=\r\n=6I+J\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0-alpha5_1677683587483_0.684377340015508"},"_hasShrinkwrap":false},"1.5.0-alpha6":{"name":"ternoa-js","version":"1.5.0-alpha6","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.14.2","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.7.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"44e373fad3d4d4510f07261dd6bc26f252c564f6","_id":"ternoa-js@1.5.0-alpha6","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-jm6ZH8hJimYolZJDRNe3IMdz6fB8UZpASRug+9Hlp5QNymxTLFNQHRHbn2q/u+6DY+OfuvD9rJRf+LZOLMxD4A==","shasum":"b7918e8c0364e9ff4b8f0572ececaaa731ca496f","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0-alpha6.tgz","fileCount":117,"unpackedSize":690221,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC159mUh08RVvJaGDmHEP7Dsw8jn5cUMkh8csAMDUQsEwIgGefNJDtCmIHt+qFjg8PSTCwtyX/xIIjfdtKoMd4bsNU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/3naACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmomuQ/8DCe04SIhw8+AmaqhLI0W5HtB1lqV8rYuWt7yZY9rKEVoOBZj\r\nPD/8osakYsXkMsaug9yjpZrcvRuWscPowue46bVtRzYE/dUxibZkIT6KHxLU\r\nBf7E5Q18yh0qR2Tm4gW5//z+tNQCr1B+0z3siQ1WhFiBRstc37r9SkkkMAtD\r\nqQ6QUDTthDDJZE45C8lCh/ITbN0VvvlKwVg8vycDVmb9hvm+momXsvB72DpI\r\nCrEneQNhS3XB8Ccu1bwTk+iE1D+rqspHDJ350Gok0uzFnwoMH8iinL1aMEZw\r\nZ8dURGuOKOHdwlvw6s6+MvI+USaCzx8JmnfpFqTwnJJbRb3TqqVslY1VMzDK\r\nCdVWyfz07tDyAOCQeTTKZMzL8JrLIh27+fH32a78XVPMGmHNWCLZLIVVd8CA\r\nZbrxXojywqrTjociOeg2n5AnbpohUT/ILNEdU3cR+4bLh7DcmZOGtlrlMW5a\r\n9OaZzYdohLNlnAcg2cX/hUoeFjTVBjaSXOOHn0TOdPVT67l4z4Cg8mr4r6nC\r\nblutgVkNbIU0FVo4mp0q/iWVFGMrBokbVbuZTmJq9chqgB6UZWzHwoa9rt1a\r\nW9hfEDiq846U6Mbf8/dty0gzGnxStF9jyoCcqja1msQZqeDOJckfBbAMeLCp\r\nMcfkIyZOcSF//XklOHDg7iXrExEnXSOvaUw=\r\n=BhkY\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0-alpha6_1677687258367_0.9465320622103703"},"_hasShrinkwrap":false},"1.5.0-rc0":{"name":"ternoa-js","version":"1.5.0-rc0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.14.2","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.7.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const account = await generateSeed()\n  const keyring = await getKeyringFromSeed(account.seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"7b53984d8b1eeb7c6df17fe6fbc8acc6225d5646","_id":"ternoa-js@1.5.0-rc0","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-zFimPS2UeSUK9lX9A43gscuIMEy46HIw4zw4kxeYZcKURhlke5G9NOvaeEpFOZHDxWH/aVNrA3nQ0Cjfj+Qqeg==","shasum":"c7a4e4ed14ba0ead2dc5aac24c12fa4ae850cfbd","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0-rc0.tgz","fileCount":117,"unpackedSize":690977,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHLRskyyjW1AiPMl/c4LmaH8v3uhTp/OmpYVVmu4cCmTAiEA3G39yjCwKhTH9tqCYyNuxMl4I/X8NvR5mtKYfA3Rymg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkAdFlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrY+A/6Az0hEFee/6dowTDJ12/ex43ckss5x+Fr9jf9441NmMCOp5js\r\nK0yCuhg2KpjkyUM9QXcHwHlg89iTnlS59O0XGKb/bSErlsmsGTHBYFTpur4P\r\nP63Iad5YeuTu+B8RsHWL3XJ/+Gna/bivjYodvrD+gc/8PqZQ9CU78gHB++o9\r\nVS6KEb+Pz+f6o3eIy8E8Q9ivljDlJkr9uNYTXJl4lx60M6q7iGs4s6+7QwRT\r\nKwbqdr3T4pNrNWxXz2WgbxnZnbX1aurTeXFH/rVSjbP68ojixaJTJK5LBKwY\r\nE0hqrfGDlIhBvIlwLvCz7gsUDGZ4rVto4w8QyDQghghmb3vT/4GoYWVP2zBj\r\nxHE4IbiL5qmzQQwxyw2qXYA4QOLO3sS04e1+10I5a8ajHYZfo3okm+xu8FPG\r\n/2FCFO2UosNwAnB4GrU1pAyUFvzmRnKSLhlp3hlO1t1TtRwFxxEFC75RMOiM\r\ngpL5LrnTrnc6aWEOip8Ht8xVnt/pZynIqo7V1ENpLz5oY/pzqWs9YDOYCNKj\r\npC6Ov/UsxH5OHQPS4TnqKgcCU50cmjM7lBU2Rda/CqLQ/fwlV1LKIWJIF/la\r\n4N/8Y3tEdYJ6FMuwhg07utRlpe5xW8lcvqmzfchZHxN7wyrc3WMcbq2JiJie\r\nSCOQI+R+xLwsLnJPqRNBwFm+HChLmSFQVPE=\r\n=smGh\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0-rc0_1677840740981_0.5713579220062757"},"_hasShrinkwrap":false},"1.5.0-rc1":{"name":"ternoa-js","version":"1.5.0-rc1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.14.2","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.7.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"eb5197c6a905bb90ef80413029409c4a9eab702a","_id":"ternoa-js@1.5.0-rc1","_nodeVersion":"16.19.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-xE3U0GbLo34/vbr/fv2zHEKXxwU1eMulob0CqEXq2eWAJAyHJhQRsEZPJBfcX0Sj9cMFpmJeIyEtd9HJax1BVw==","shasum":"1c83ebe982b58e263c7b81824615672da17091b0","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0-rc1.tgz","fileCount":117,"unpackedSize":691550,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGAa9jufLwhCLhBv6jfTd0H7RhkCGeeoGgF6XbbOJTRTAiBeKR7OTh+lLurJ7DYE9MTHgAhYK4eN6fhenxi3XFgThQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkBwrvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpHaw//dbuXo4uyUvuRXu6fweC660Qv2cJSrg1hUoN0L9C7xfyTCUB+\r\nTYIPcDrKloYc9mNGpMDZNdOVnEkcYPf62yo7G4+iWRsEFXlAzmGlp2mQ0YS1\r\nDVIkSjIpqAHDdFcqWJ3XUu4Koa9BWEKCjpFZuEFKq05yl+CNezR3B2TIzPC4\r\nesuQI9NSCF1I1XQzv1TJdZ3ySuNLB8WNFhj/+KDgjwM5et3XNjGevNiWoPPq\r\noX3Ux6yL2VNwxxsjyWr7eWgs/v7g5hfC39xNCBjySYGpW4IVM3llJCfyTkxZ\r\ncTOUQGB+utrEpLxgaGHMb0/CqN8g+ywt1VoS0mDfr1+f0wiLir2oBMc3UySY\r\nl9kL0I7L5fAlAhcbFRkJF+iAF2mS7IIHb/gHfmOOOjuKCMbn0NtywJ3bbyOA\r\nLtvlheF+pFzH/0p85TpEJKvDRL+A6ewy1iRV4ynYBGyvKpkt6qjv/xM8DDnM\r\n6zYdBZapZ9wTm3tx6Q2bXdz/awZ8WOq5We7w75K2TvPKMGlQ/UVMd6z5TcOb\r\nnFoJs7QcMQOecR2maz+4kw44d6XydabyWYX6ENg3dxxqyPhIfrp0AB+Ic23u\r\n+9y9p6p+bFjhy9f6ASAtewrBJDxAjNWJ510hBLE1hFF8kt7spfQ9A4yHylBX\r\nz24K+BYTsWn6/dD05tdT3k/fp5tHqBLpLcQ=\r\n=nfkB\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0-rc1_1678183150942_0.6118164653160181"},"_hasShrinkwrap":false},"1.5.0-rc2":{"name":"ternoa-js","version":"1.5.0-rc2","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.14.2","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.7.0","shamirs-secret-sharing":"^1.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"76f59157c2517c2a49eaee0c36a682cfa569bb63","_id":"ternoa-js@1.5.0-rc2","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-eSYsXEP2Id4rktiBMvJ6mgPA4K5lBFWmI57jfFguBaJ5NIrbyf9B/TWX82wlxtkwRIBBYVemNiphCZMJCwJDEw==","shasum":"72345e6cee06ee662ff72dee4d3549b4b3a53ed0","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0-rc2.tgz","fileCount":117,"unpackedSize":691673,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBOtdmg8yZbvFXRHVX4bPDVa9QKSdGN352hMLqGXpigyAiBThkn40mBWYbRE9SSh+4MEmkSnaac3qW6H/ljSPw3XPA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkEgl+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrARw//S5JmvJFYgG1vwYgyC5nF1hmyL9fIKNA9kp4bdWcLZkpyunXN\r\neKa+d8tx7wKlCAUSY443+vUX4O4OXnzb/YlbgHLlD5990TdS2Jwxfak3uyci\r\nWcczuadDiX4E4PX9KMxL1o17xm/RwK1OiVduyFOftgMskrdjvyb+X1p10nTn\r\nNaiiOgNaUhOUH0w4H30LBm+ot1dzzZKVahqUS/dbFoc/cJe6qwQ/22oVY8aP\r\nSNzx2bURmau2xkf1UJ0io2PNs2OU12weiotgjJx1cYVHnQy9FohWPc4+Qae8\r\nNMSQ6TqTpRyoa03Hdi38dahcHH9I75xxdVfnsDcxdmiDkfkYX4FYpMjsKrR4\r\nffKcJrG5rqi/5rpYqszhLA+un6PDx2LLFSbdyBgDDYaY9YKmtjALqaXNUbMX\r\n6ck9WoRO8QRDtUlSQ/RsbwtKm9Cl2YrtBStdB3bGWNwlBhWM+NCk5c5fCb7U\r\npqg7n9IetEquBo9m1RY9bEoLM+plurS/C6JnX9IJmVIjqTCPtQwlSBlk3jJv\r\naTAeJEvSBE86Q0lVpQcZFqy/4LOh1b1Rj3/oYQyHWyLFhrFyCJfCrBjBQ1pi\r\nNRZ22xv6CtCo8asZ0JeMv46cLmjaL59daTw0hsEpBDP485drB/s54p11uh+c\r\n0O0BI/3VFmZ2t72EKBJ2ef4JoXGV3xHUmfs=\r\n=q4r6\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0-rc2_1678903677847_0.1741574542961173"},"_hasShrinkwrap":false},"1.5.0-rc3":{"name":"ternoa-js","version":"1.5.0-rc3","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.14.2","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.7.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"14dabdf188308557cf2ff54e8c625be6f7ccb88b","_id":"ternoa-js@1.5.0-rc3","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-U+jk/wGXA6p4l11VPRZHaen8mUoLFKL2YEBwu1F9Bw7po8wZO/dDsXYd1HINeIr7DHyxAIe00vFFRKbKWS9Kjg==","shasum":"e6740d13e8a435435367f7c00716fbe0294ed597","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0-rc3.tgz","fileCount":117,"unpackedSize":718638,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDT8mkWzPlr3G19+HdihN0zDO2O9W6pyu/aa+/LNw0vFwIgd54g+QmV0/iL64XJBHYulaqyG8xjOMwq+6IXqU3hybA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkIw5DACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmryZA//elGaaa8r1J9/mkxbWGEMS+Hlc0ANEvLXwdCwDVfLNNWUhcci\r\n4HLyLX9Dy+VUzMo/fbDEGXmjP0jKtlmRHvGnVj1+B5yufKJKZZNbFvRx3iIJ\r\nLxqcRzPko+2V4nA2tqtICWJtm3lT1cyJNpLbojDw2GQ/enJI22WeopiV9Nme\r\npGTvToAS5oxR/o0g4tMRtKGc0xXe8nkbZUU4RfjoyXHOTZQTK21k0gAQd4+6\r\nCaMC5JthXiDX4UUIapsWSu4vjuK3+TUJFygBkhFRCn9xDk5dCAKPQxOQhtRI\r\n79R/tJ5ughp+fussHr0Ql1HO63oFuQ9kU2gmOfKI6Hok7XUsXqc/WDVgm7ib\r\nX5EJC3AsZX/OiEq4epGtGtzlss8B1hH4MvfjvBbBp5h3QXKnH70lpxCe4YNq\r\nFgtbwR0C8xqe2ZGOmo1050q7ZbbbJJnwhljG1yG8P0IuGQUujwx/4oJD+4B5\r\nwondVjJACpgENghvRTPaYC0S/LajI0lCEbziZzuRWJs1x151oxooKWOGkwUg\r\n7f3/WNN8JO2DBLVcMKZRpOKpjYayheUR7HCmJ6+fypyp42u/13GruRRzgAFb\r\nDdYdu1K5Kh8sQO5GItXeu2BrLTAXY7Z0NbQAVwFV4QuHbmqmeQrROU3ANbbv\r\ngUi1Oe62NeSJEkPOJ04BSMRM2JXNx7UIkNo=\r\n=Y1EG\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0-rc3_1680019011287_0.43766898774175544"},"_hasShrinkwrap":false},"1.5.0":{"name":"ternoa-js","version":"1.5.0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.14.2","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.7.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"gitHead":"16c33e14dc885c299d64a07dadb412317b308782","_id":"ternoa-js@1.5.0","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-LFUKxJwzVBUEqimbt4CVCwK3dNZoE2nop4VxKQ2CzWkSNjmkYkbkRXPav8m+oXOJazbUJ5whguHnwXQrk1IZ6g==","shasum":"ad5a16ac3fb0dce9b1db16fe7fcc45ac4fcf88ec","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.0.tgz","fileCount":117,"unpackedSize":728568,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDbMtfr2qXWtDnYPSIeg+/GSNNq7SfXGZU31gY+OnmhVgIhAKSS/MxzboRkVRSMIIpaIFi9Ol9ogM6LS+p1yFPEMNms"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkPShuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp9og//eZpk/IwlnY2tec+nKEFvPpVsqyMU4yKfOCUYwoSKDPPDwv8l\r\nkA/pAgM6ACsHZTyEWOJjQZNi94t6RSUyYwyDKuDpAqlsfFndDtgCoTAtvnl7\r\n63lI75OoVsTgg8I4Sc/ZCyvRb9zauKvuDXkf+Alhqhiji7kHArG4zN0pND3F\r\nQDrKd3etVYgGzK5Vs95w0jwq7cGAjekwrcqGl7TlQyN/nzAE2Fovr0en06sb\r\nT/BJpC79YRm90SF6qyGvpbOsVYB8YmQDAtrXtM8S8fb/oMnrmtM4bOwbge6H\r\nZtn+Ehfy7lvhewwrBSXzDacgLPlNzdl8LVg3Fj3sUc0xKFw5fV8IhpkRokqo\r\naRWr7j4EV2TJTsIdre83Rzhi+kGUuMeY/3GsFITQbhRvX7rfTCtBSnePruCo\r\ndaRG5tSibDlTwPOTDENCJ/ZqEKmbMksdKOUxv1Zibd3YdkBa39xV90adHiSP\r\nSxrDim0bVdI4z+RUdzotmH8EqogXKOqBHlnPzbZSRJ/Pt3VIouTD7Uef/hUg\r\n3LMC8GkIZef7ZqCK/zJsgBgVmDGdK0dJpx+C/6f72/nwu/wsVKxv8ofhfw3Q\r\nWFy3nlCO/jZ9Z4HTvE9XHiRwVo8w/EkGqKOTqYUma/xv1oHv9FWURd9Je8su\r\nIg94YwXTGfKLCe2Qg4OEc6ZyB3aDqVRHVwU=\r\n=SaMf\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.0_1681729646757_0.10696660989983231"},"_hasShrinkwrap":false},"1.5.1":{"name":"ternoa-js","version":"1.5.1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"9.14.2","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.7.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"gitHead":"3ed613d9c60c54d097f971975ba8cac66cee24ae","_id":"ternoa-js@1.5.1","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-5GMtUiraS0zNNndNM323GnS/LmnESW1IYpLSRnqtfq6yMWar6NEImYNKytCoS1dFHLFHenegecP17MqkZgjz3Q==","shasum":"870d91065876d4c16c90dcfe3356e3f6f50870b4","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.1.tgz","fileCount":117,"unpackedSize":728566,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCkMC6v7VHp9qo1NS6CP9MBU2LqOU+hehRzJEMjDlDpqAIhAOcP7msXtumahnN1N+tVnXeJTYfvWwF9N6E4ZD4gSbgK"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkP9hFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmryLg/9FGgivlDaefrrHqnOPEHuh1pBcSLEyyGhIMY6EiwdSVkhtFTk\r\n/Nidn3nLREHUX5N40mpKxNpM8E1AsO+bIr2ZbURtYlU2WypILzYQUXC3hha3\r\nlEkzoCZDQ3h8IMib40wXFxCVz5lf9SAD0lYToAHfa4M5EL9OQ27WSoDJ5+QF\r\naW3sLq0FuW73QFeNDy1aYZ6+DPLD5udRydlCbThQ2hyGg+q6y98VAeTptTGu\r\n2C0nYTgeTbuHU4yUcZ7a9+WvyFyi38+ExeestW6VjPUNifQvjmvZEHgvSR7Y\r\nFdmxb2bTtAUf811YRIxMEFLmqzW3sAPR4MUXyhu8dUVD+rGJOWo1e2cc+0va\r\nT0p5eODcX+nATeqvugVA9AZ5S0RlmsEUGAR+5qjdhGY/zDaiuhPPUf6j8Lc4\r\ngbgPLWnoUbQ5egpQyPoBHVvclFXxZ1YEq+5KpQjrFGbuR9EgdKMCc25QsyCZ\r\nFw5XZftkQ8CG1ew0OXHmkvombFqdYfdNuWGuZMkU2ICKW4JD9fhhS7nPzeGM\r\nZMZvDIeSJIOo6JnxSJl+XPcP2x0PwSzcMEX1Lh7OcQGuL63rzxCGObq6l+os\r\ni1bcz+uOrnNKKmyKVMR0rP7jM0lKY4v64ptppkx37oOTRBSrmfKtCN3s/XMV\r\nmDAdN01vrIeGNmTW77nli+mV+syy60k3Pes=\r\n=Sjov\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.1_1681905733395_0.7329721956962865"},"_hasShrinkwrap":false},"1.5.2":{"name":"ternoa-js","version":"1.5.2","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"gitHead":"2496e9ae731af74096f2157aaf4ff7c584093f8e","_id":"ternoa-js@1.5.2","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-3xrZffRMAXPWhAVSNfW5lMoQf0b41FelsTcuM1b6CWQvz3XgCsZ2XFOHGYWaf7eOOkYWsoMrNRaTDxmGBI0Bxw==","shasum":"1fd36734d59fb1d19c835e4bf30f525299713f8f","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.2.tgz","fileCount":117,"unpackedSize":729150,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDJ04K2glAG6TCSe2wfH7bLLI05PvhzNnXWHsfSvizFCAiAHOltHUv4B4ByCC8Nyrm8wXqNrJhdr1cCE3rnzsWqQPw=="}]},"_npmUser":{"name":"dontelmo","email":"igor.papandinas@posteo.net"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.2_1684321856164_0.3530731904785538"},"_hasShrinkwrap":false},"1.5.3":{"name":"ternoa-js","version":"1.5.3","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"gitHead":"db1dfde77ca0b1bb3f90cfe466001e662e422e82","_id":"ternoa-js@1.5.3","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-cBv2J6R6kIBWfRmobFe/cmnxBvAxYQffxPIXLW5TeTK0YVqdOZcHGTzeNLclvrshAWAkarz/4XoKuO+ypyDZKQ==","shasum":"f467f2f7afdbf95c961d8bab0c9877101837819e","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.5.3.tgz","fileCount":117,"unpackedSize":728824,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtZQ9faFgNWMybodv3+OMWpd86/T4ihlIN0nvaN7f1QQIgcAA2w3+4b+cmJ/Zx1QQNRUPOA22FPkyW+OcTLFrNuFQ="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.5.3_1686219750673_0.9604184201401571"},"_hasShrinkwrap":false},"1.6.0-alpha0":{"name":"ternoa-js","version":"1.6.0-alpha0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"0c9611d2231f388a474958315d9bebc64411d4b0","_id":"ternoa-js@1.6.0-alpha0","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-EtAiDZ7W4afFBPdkKxD7PdLOPiG+6yh6KpWgaFT1Opf797nv4Cn1TXfyaUtz5GQdReF/usj0kuVnRQ2I9WUXGA==","shasum":"2237a8086602fed5a0c8379701221498e4dbd508","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-alpha0.tgz","fileCount":117,"unpackedSize":736578,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICKmunwkcxf1mgTqMWewpxxjGm7ESm0ip11Y8Zc0whbRAiEA2S8Q4ut/jo2x19kNyiVrC4X12v+lXX7NpKakOPCH0Ug="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-alpha0_1689584209721_0.3102635175602253"},"_hasShrinkwrap":false},"1.6.0-alpha1":{"name":"ternoa-js","version":"1.6.0-alpha1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"6b1e50c0ec0f7389c32c539010883a9d9893fac0","_id":"ternoa-js@1.6.0-alpha1","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-+23UGQyJQhOJxm7sS40e5XN/rQw+qeCBWsaaYjqrnHJx6DNy+ZEvIWTW99rKBGCmNlFo5eZwr/lRGLk9Z4DQIA==","shasum":"2d510ed03fa98824414dd10b7cacc46e7249222d","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-alpha1.tgz","fileCount":117,"unpackedSize":737384,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB09kvbLW18SHEWuTTHp93m7AgBueDwVBQqg4Z00ppT0AiEA09pAla2ycmag95Rzkk6X8lHPXvVdpN5TbtRuNBUsQNw="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-alpha1_1689756860290_0.522447299234992"},"_hasShrinkwrap":false},"1.6.0-alpha2":{"name":"ternoa-js","version":"1.6.0-alpha2","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"dfa8b7ec81d2bdf62c25cac8a28fe038ac17101a","_id":"ternoa-js@1.6.0-alpha2","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-brjTlcZ6pmrvY9xkuyBHlk9vbeuBA92ceIa/0DQKXqbypT3QjPFQ35Te6ki1F7qDrT9Ggo9wYEIDAFxrZPlYrw==","shasum":"aa0c5a1ccde7897011991ed757d42b264ae0456f","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-alpha2.tgz","fileCount":119,"unpackedSize":748739,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG1S3L3R/3HX5dAH/cudZUpmieqJrAvX5Zl7uc0w/yFlAiEAhQLd8506ZDTRfUG1FOyx3Ep7R1Ddyu9boDk6HWmrE2k="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-alpha2_1690298117407_0.8321508733817853"},"_hasShrinkwrap":false},"1.6.0-alpha3":{"name":"ternoa-js","version":"1.6.0-alpha3","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"127cb11a7ef35c56deca72e03ef5fea312d67509","_id":"ternoa-js@1.6.0-alpha3","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-y5LQjTA/qaRRnn7Pikssb78AQUex2UuW9H41nnYbt6q7M9B3S5NO+yf44Aww8yqHP4qslfY8UdL3M2q7NgSxGA==","shasum":"02d6f9b43a7bd26121cd8e20b32cdef4e2a3ade0","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-alpha3.tgz","fileCount":119,"unpackedSize":748771,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHpY0ponXMsoddFCx3n5l12lN1IPy5DV/oBBzvF60tQrAiEAvhOjJqN9z/qAP2KApe+7b0wOSjaIlzz8inziEQXIJVs="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-alpha3_1690549994677_0.18725887868335844"},"_hasShrinkwrap":false},"1.6.0-alpha4":{"name":"ternoa-js","version":"1.6.0-alpha4","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"27e797029ef88a540fc003a25d41a663d4535a83","_id":"ternoa-js@1.6.0-alpha4","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-abervo6MYdn5fwmZen5ENxiJ9BYFiNbfPVSv1dh3JYBxsvvEFUkqa/j6eLZ37HX1OFfPSgT48D0TEHcamHtuCw==","shasum":"1e71540f5fafe26cbe4876bbda8497c4873b2967","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-alpha4.tgz","fileCount":119,"unpackedSize":748849,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCUUkHBreIJvKnKDY92PfszY30CcPn5NYJX6JdmibwZqwIhAJQUARU1hYYK6iSF5mZ5dCfyxGUWiDn5woHgOyBeFfBy"}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-alpha4_1690550396964_0.6318199505169353"},"_hasShrinkwrap":false},"1.6.0-alpha5":{"name":"ternoa-js","version":"1.6.0-alpha5","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"62ca8992789561d56ae2df995392d2abb65c21b5","_id":"ternoa-js@1.6.0-alpha5","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-QVWrOWw9s+AyGEEZL5fDDJXNYOEB1t6HJEhfDdcfXkxHvjT92qCPkTsjBgBgOAWms3vUkawTWbE2+RudfNmeEw==","shasum":"f9d29e3ee0ffedc2a4d93f37225359fcc7745ba4","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-alpha5.tgz","fileCount":119,"unpackedSize":749504,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCFv+57y346xZH6YW8lr2dGuMOKkY7f8I9Q9TaFv14dMAIhAJeNHNqL/mVOp4BB2XH8pumwuV77qcyVw0opg7onmf7G"}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-alpha5_1690905672468_0.7582413255277725"},"_hasShrinkwrap":false},"1.6.0-alpha6":{"name":"ternoa-js","version":"1.6.0-alpha6","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"5ec266354fae813ab41e61df374ae1c041d0e679","_id":"ternoa-js@1.6.0-alpha6","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-hGNnUM+IPvZeX68TxhTJt09xxkJH7R5cOsCVq1V0TOCTO3ZlnkSSA97kdfie+xGmbymZjC02QGJk3G75jKXAFw==","shasum":"64e08fabe612d3787cf903a92dc0260a45140bf9","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-alpha6.tgz","fileCount":119,"unpackedSize":751386,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQXmAJDIePMJByxgAIXQOAkNpxIH+/8qBun5HfbBrd3AIgVuCeLcCbT8BNji8nV4WVB6rybIuwczztPQGxrIjTpfk="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-alpha6_1691502416376_0.5919982892081785"},"_hasShrinkwrap":false},"1.6.0-alpha7":{"name":"ternoa-js","version":"1.6.0-alpha7","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"bcec502e8c215cf8c2ecf3d7e82762261528db5c","_id":"ternoa-js@1.6.0-alpha7","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-s47rIT8y1oLR4f3uYNpj5ftHLpWM5qN6KzlqxHUwBwaS9RGcQ0dnBOWf+2nwV8/UZuO+2mY/Nae8Dy/30C92aA==","shasum":"3ddd4809bb26ecad378e48290cd2a0f354c147c6","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-alpha7.tgz","fileCount":119,"unpackedSize":751799,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDQWFxfvZJRiJdEnU2sRVOipTb+BWTFJibjbuxKb+mThQIgD3iMl/e2pVVWaG0sAg+L+L9Wtj3Y4BM0dCwghOyU204="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-alpha7_1691598130442_0.38425778478331307"},"_hasShrinkwrap":false},"1.6.0-alpha8":{"name":"ternoa-js","version":"1.6.0-alpha8","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"ea5f17e5058f3c4de096e0112be93c977c027046","_id":"ternoa-js@1.6.0-alpha8","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-LpcFzfPr76j93zzZtnJTC4+GkYTs56DFy19ojPA6MDrl1zfZgpW7PAVR3svAEizC4f4uWk3/Hy4KkIbxfoEgXA==","shasum":"3542544f249c6191047e0b6e8be2d33f6a357af1","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-alpha8.tgz","fileCount":119,"unpackedSize":751344,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbPh6tuY4g1u9EdtJIeUdzlmFM/hX1bIejq0BB84CB4QIgN4FE0rMuDWPMLPz1kPoZRldabWDuE/hcWvedtbN4SjY="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-alpha8_1692709949351_0.23116284559707156"},"_hasShrinkwrap":false},"1.6.0-rc0":{"name":"ternoa-js","version":"1.6.0-rc0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n_**⚠️ Important note:** The TEE/SGX pallet and environement are improving! Both the secret NFT & Capsule NFT pallets are impacted. If you intend to create either some Secret NFT or Capsule NFT **on Alphanet**, this release candidate package version **must be installed**. The new TEE/SGX pallet and environement base code is not yet available on the Mainnet. If you do not use any of the Secret NFT or Caspule NFT privacy features, you can still go with the lastest stable package version or start using this one to avoid any changes later. Please keep looking at the [Discussion #175 on the Ternoa SDK repository](https://github.com/capsule-corp-ternoa/ternoa-js/discussions/175), to get the last information about those changes and the mainnet release schedule!_\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"e8d3cbc46d9097d109e09e4fd19e6dc2217d86ab","_id":"ternoa-js@1.6.0-rc0","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-ReNr2b7iGQkup9hoevhaQL/EJypnz+EFH9bHh9EUITKdeb9y3q7m+SX1spiscE3QAc8Wwr1BDQ4ml2AE7lM6Nw==","shasum":"9036ea703dfb2c08e43857d4751fa1928072b0ac","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-rc0.tgz","fileCount":119,"unpackedSize":752000,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBBJNfFSGTHQo3pxqRJpKmRb326GC/3zNbUGfwQhF9KwAiEAlPHcW/4tauzSC/v12123tB1MwxXfrxoLfIHv8c/6JSY="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-rc0_1693572986210_0.2273016259765106"},"_hasShrinkwrap":false},"1.6.0-rc1":{"name":"ternoa-js","version":"1.6.0-rc1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"e0f5da212a96a8122b027a38e7145d1e4aef4cf2","_id":"ternoa-js@1.6.0-rc1","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-T+rypvT7vHEzJSEhybfpHNgSqRqz7UGwzB6aL0MMHhD6D1coEMVXcEgnUhxulMjV5dwOO2B7hHewN5dJMSUTmA==","shasum":"0bd0d2af63ffa2931927ccf03d8740fe03934eef","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-rc1.tgz","fileCount":119,"unpackedSize":757083,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD63TfLh/dCMagjRle/pm8gH99/ntQrfzms8Xnbj5WoWwIgGRj/RtZcR/68jtRubep5q+XnM1oIdZR/Qi/AN5emlkM="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-rc1_1694427742250_0.5927974552351756"},"_hasShrinkwrap":false},"1.6.0-rc2":{"name":"ternoa-js","version":"1.6.0-rc2","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"4988117ec658a56aa3bb714ba53e231ebe3f7fc6","_id":"ternoa-js@1.6.0-rc2","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-XUNyY5tWCzapNkmwGBGq5xpSFTYiZg/oorpcWw40pW94vWAwd3aFelKe4rTMfEhCtsnm3lw25chIGALYaV7SPQ==","shasum":"d0d0ab1ea5e5327e22c37d96503e9b483a3c08a2","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-rc2.tgz","fileCount":119,"unpackedSize":765571,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHH3MbOrNLOErHu6Xk+VOsH0bPHuSuGwoGlAG4VXSeD2AiEA5FCcNdy2vXSSuPJcbKy36bVuduseDPjMYWSPriFJCME="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-rc2_1694611938596_0.3905540894897719"},"_hasShrinkwrap":false},"1.6.0-rc3":{"name":"ternoa-js","version":"1.6.0-rc3","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"98a7457570e0b4b7bd3cf3c96b4f7ae432ea537f","_id":"ternoa-js@1.6.0-rc3","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-g6Y+Vgse+hoYCyT5KPupdKypjfwY47eOsenrTDvkJ/tV4bE2zOBbecIDGhFq+LTxaKnEDYhohcIMOMNSQ89fJQ==","shasum":"7f583580af4c4f0b39186a3a34c291b1c1c61cc2","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-rc3.tgz","fileCount":119,"unpackedSize":757931,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCOb/GSr7+G4qt/LIRC8PDUWRYXO4vxMj9z7CYqpYb8YwIhAID3Bab26AdTqwblN73Mu+cHP5k09BudADaG0zBwcZTb"}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-rc3_1694613252712_0.6980229738748032"},"_hasShrinkwrap":false},"1.6.0-alpha9":{"name":"ternoa-js","version":"1.6.0-alpha9","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"84a48da218321e8df641c4770454a330f4d5d55e","_id":"ternoa-js@1.6.0-alpha9","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-TxlqxBoTuPtM2PPtmqQfFvPg140Uk8vW02r0KUVoerNhLfFFQGnpwVOT6iPFK8LwbbVQbqt+UrWIFDkV96RRmg==","shasum":"5be85a8362eec9c4b47fcc35f20f13845d72d380","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-alpha9.tgz","fileCount":119,"unpackedSize":765868,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAjQURoM9auB6q7dnwLDdBiwjD3L1MGvh9OEbjieyyNeAiEAmiK2+bElXzyAtG31LB2FpmscZl2xxX5EldmSBqJnoHo="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-alpha9_1694680080032_0.8826032276073967"},"_hasShrinkwrap":false},"1.6.0-alpha10":{"name":"ternoa-js","version":"1.6.0-alpha10","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"267312fde76f979a3627da304a7407172d385e6c","_id":"ternoa-js@1.6.0-alpha10","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-Q5wB0g9+aSuAVgkg4ZUL97lbUTREeiAIbhcZQQBl6OuuzGWnlFF4qQV0N7NRzVmLhBOvxDx96V4ABWV1h2HKOg==","shasum":"624570683c0b5c740f29f3db9cdafd2f3beb5581","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0-alpha10.tgz","fileCount":119,"unpackedSize":765854,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCcZQwGOjpL+XaBMIL//1OnmZ27xGCZ0U/jgJXIR1lpPwIhALlPZz9cQ25xulfXayQnMwCL3lTeFMrjR/OrZukLHHOL"}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0-alpha10_1694680531415_0.6060632849142618"},"_hasShrinkwrap":false},"1.6.0":{"name":"ternoa-js","version":"1.6.0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"gitHead":"605abaab3a5c5ce11fac592e586c123ffb918d15","_id":"ternoa-js@1.6.0","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-tBXW/4g+Dd3TJ+rgOtoKti3FYxLSoXkrIgq5Ix9KStvzldrtmAcor4fWpwK+qtPDIVXMkUn3toShcMekOomlag==","shasum":"d67863702e1e762d1f07186a448d807873bf1207","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.0.tgz","fileCount":119,"unpackedSize":758221,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAHMcUymlalYY++wAvkveMKyFIBFwfpvupM6JZtrB3CdAiEAwCJppNO/3UenlFekcUUnhFUg2+UjknUsJz+spBPLDp4="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.0_1696514990802_0.9325510521985181"},"_hasShrinkwrap":false},"1.6.1-alpha1":{"name":"ternoa-js","version":"1.6.1-alpha1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.7.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"5.9.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"49d332c3d5bc2ded6f332945e5cac224a064a827","_id":"ternoa-js@1.6.1-alpha1","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-DXf03You/z1sZU6DbZBVIct47ZkFYTBFYR+FY/QO/0ucDalUQj7PGwgkLZV5qIEVsIk0/Pvs+TuC5aXN+7YD4g==","shasum":"e0d8ebdb667cb475a64493c0dbd5395da5bf316d","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.1-alpha1.tgz","fileCount":119,"unpackedSize":770448,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHR52oJ3lVzuvVGRl5y9Q2hebDjkykMNXVmjnW9o9dJyAiAQQX3Jz2dV4hOTdFjZrNeRgrIpjjDn6wTEJidCycTg2g=="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.1-alpha1_1697123307647_0.34491936925523414"},"_hasShrinkwrap":false},"1.6.1-alpha2":{"name":"ternoa-js","version":"1.6.1-alpha2","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.10.1","axios":"0.27.x","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"^5.11.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"3eaedba442e0542541b48caa2b4bb6328c7708ee","_id":"ternoa-js@1.6.1-alpha2","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-fULYuJyVSDj49mYmwHVBnn6f0krsXgLdoUvfr3ZIeDPVuCBu5msHpQaJr201Rr6dE7urmL/N9g68ai250wjGKg==","shasum":"320ef93eb029ac6a970cbe7368e0ca6893f0da78","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.1-alpha2.tgz","fileCount":119,"unpackedSize":770451,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHwRLsMF1h+kHcOUPy73sN0v3MyVWZS04V8nbdUB1bAwAiBw1LOY4I0aNde44lRaEVYIPYcBGTIGfn/SEdd/+vW64A=="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.1-alpha2_1698919900702_0.7570702178147599"},"_hasShrinkwrap":false},"1.6.1-alpha3":{"name":"ternoa-js","version":"1.6.1-alpha3","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.10.1","axios":"^1.6.2","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"^5.11.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"83b04865ec8a022ea14f4aeb4f11f27b831efb4b","_id":"ternoa-js@1.6.1-alpha3","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-npILPsVNhgeg8UN/ejKpsvOjHsm0E03XEfPvCbVueSjuHODoIJyOlv0iyoPjd0V4BAobiqSgxdqDuD+dV18r7Q==","shasum":"a3079cc2d417e10c2324b81758bfc2cefd1a31cb","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.1-alpha3.tgz","fileCount":119,"unpackedSize":770451,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2WiRzJTHSNOMgEr2YQ/SxTbP0Gkq1zHm12BABMgANSAIgIT9oWL/OzwyCamHqa5h8rZUSMcX/nNbSswFUOW0yLF0="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.1-alpha3_1702465477174_0.14465152662335967"},"_hasShrinkwrap":false},"1.6.1-rc1":{"name":"ternoa-js","version":"1.6.1-rc1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.10.1","axios":"^1.6.2","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"^5.11.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"042c97a1a2dbc42ed59f1cde110443481399512b","_id":"ternoa-js@1.6.1-rc1","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-d+QoYMmhL1zU9Y5RT8bdeFHdKETeez32qkwStKkPnRltlp2lG3hVonz3N6lb6nvalrvxDiXempRQwOInCCPdOQ==","shasum":"58346f816a66cb8a750f883ad5ba0b19b5c1cb51","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.1-rc1.tgz","fileCount":119,"unpackedSize":770141,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFMyNzoEzZIkw1OpEYAgtrq1h1IHhY3P8j0aMXwB6gEKAiEA/JPIbt7NriiMYFXHcgyEplcxlDy/qfqe8prvMM23wzw="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.1-rc1_1702976338992_0.7705445989426591"},"_hasShrinkwrap":false},"1.6.1-alpha4":{"name":"ternoa-js","version":"1.6.1-alpha4","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.10.1","axios":"^1.6.2","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"^5.11.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"a697a674951614258415a9a7b582ee3e900d9dff","_id":"ternoa-js@1.6.1-alpha4","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-9Ib8z6NVeZCfM3WcCwhee7r5s0Rvj/6ijnaKWUQhiV4/UKGY3tLdchBqZmqTLhe0ugyXqB+MHxbgDgV2f1eLmQ==","shasum":"c5a59c7094cdb1b5a3b6e16c247ee7f16858fad5","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.1-alpha4.tgz","fileCount":129,"unpackedSize":623560,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAxhbH2ig8nhXa6/NG1v/jIjEJ1COf3uiRWwo3GPcZr3AiEAj/jJwM3hkbFh/SLRjE6RX99w04v6U+SMzl2QrMwfz7k="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.1-alpha4_1703066268297_0.85473586296773"},"_hasShrinkwrap":false},"1.6.1":{"name":"ternoa-js","version":"1.6.1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.10.1","axios":"^1.6.2","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"^5.11.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"gitHead":"34a1ab4dcad94c8d62d9d42f64657eb1e7f24439","_id":"ternoa-js@1.6.1","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-lT6D8M8x1NvAKVCxlNuNbjEAkO7Ba3DaUC+cFTVfdJ/iX6GiJkkM2ueu56a9KINvn6+DudbndQqUGOkzkwa+RQ==","shasum":"f7f9d459693d1ea401ef44d2b6ee718cdf35349a","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.1.tgz","fileCount":129,"unpackedSize":623553,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBc7s+F3XVPOjeRVheTb+ER5581gGKNVn7J9lnJZX73cAiEA0xKVlfTACGr39fGbWyZV/UtS46DQoLnf5QEBJnCEfxs="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.1_1705934391617_0.667981234121509"},"_hasShrinkwrap":false},"1.6.2-rc0":{"name":"ternoa-js","version":"1.6.2-rc0","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.10.1","axios":"^1.6.2","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"^5.11.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"5ea5bdd49499ac7048cce1b155fbc66a09e241ab","_id":"ternoa-js@1.6.2-rc0","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-dPU6k3YlaMCgpekiiopxYobpYIrBhsx0BTU/vI01uAuE68+urKQWy667GyOpdp9PUu542IJSAA0SGVpOb1gSwQ==","shasum":"3c1faccfbae0b5136a891b567a215cea4cd69f85","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.2-rc0.tgz","fileCount":129,"unpackedSize":623577,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHmx5Dzs7yXA1fW2m0b0VRCrIVVox8eDPyfKxNichk2TAiBvTXSD1wZk5uJlooDbkS3IXxllaMhpm2ZtB3u7FJKCpw=="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.2-rc0_1705937409225_0.45139414577042025"},"_hasShrinkwrap":false},"1.6.2":{"name":"ternoa-js","version":"1.6.2","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.10.1","axios":"^1.6.2","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"^5.11.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"gitHead":"14c3ff2dc710c1572421a06dbba041295adcfc37","_id":"ternoa-js@1.6.2","_nodeVersion":"18.16.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-rD9zp6q9mjBxalUXNzDbYiiRX2JHs/V+NzwO4G+ziz6lDfLl+hH4MfmHzLwhoSbC78pSjcL3biDsx5J5CHLGYg==","shasum":"6ea863067568ae0a1d97e428759856a610a64a50","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.2.tgz","fileCount":129,"unpackedSize":623573,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFq6x+qby5FQno7eFnYjYAzmafW4wV09NBS+ATyKNHDwAiB6a89qZ+rWBkVNAd3skt/mCrl1o9/SR9FcMWMxoOzYig=="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.2_1705938373701_0.5132434719143097"},"_hasShrinkwrap":false},"1.6.3":{"name":"ternoa-js","version":"1.6.3","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.10.1","axios":"^1.6.2","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"^5.11.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"_id":"ternoa-js@1.6.3","gitHead":"3902829a90e9e225f6dafd35a191a1b932a5003c","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-ru6cEfIjq5QLTOMNGgDaSmbQY8djj5ldbOh0fjpEFy5uTWm8A2cY7Jvhd9I3rtg+RmhXSWROiaKw0edWiQh0yQ==","shasum":"5cf183f86e3817f152f0496c96f8162b8fc2b1f7","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.3.tgz","fileCount":131,"unpackedSize":624288,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCeHoZJwNnD33G2iPrBUw7MiSaXiK4jeLgzl4NnOotptgIhAN8HJ//IldnXFqYoFEaTeaB/nT1UIiR43eG6Q2LfnNBb"}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.3_1708007641947_0.01782906237703008"},"_hasShrinkwrap":false},"1.6.4":{"name":"ternoa-js","version":"1.6.4","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.10.1","axios":"^1.6.2","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"^5.11.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"_id":"ternoa-js@1.6.4","gitHead":"6f8f26b60078ecf7841b0577c121066bec2f722f","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-HJDUIqHmLCSAj8Hn/oVA6NrCYWijWA2t71Q/JaqEOrJdceGjd5po6n9tmFH/lY02yueRHaOpE2zuCQvneYuSvg==","shasum":"7e3ae57a35dd3239443aeaa86a070828d47725da","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.4.tgz","fileCount":131,"unpackedSize":624886,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHJHUZ/gsSaD07SVVam0ODdP10+15RE4jHtIHs0DVCvkAiAKmRk/PwcePrRW0hkS9VJ+ocl6VmWvfehPKj63QgxooQ=="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.4_1713964125888_0.48773222845734376"},"_hasShrinkwrap":false},"1.6.5":{"name":"ternoa-js","version":"1.6.5","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.10.1","axios":"^1.6.2","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"^5.11.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"_id":"ternoa-js@1.6.5","gitHead":"7b33e2d4ec54e119e4d56817bd6ee99d404ce3a7","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-r8OS0YDonO9oSnvAReWC5vjX6XRmGg+lp/8hcl8ZFBowYae0en2mAmyR0szzmTHotsv2+dGsq2sMJyeFF7elCQ==","shasum":"e3e1e616eaa74c9dded65bb1ac8742ab979ae5a8","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.5.tgz","fileCount":131,"unpackedSize":625498,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD1CgTDfzMIlikoiF53wtHgNtFqx1LHR9+GQAWhaFXj/wIgPY7fZcZFRe9BQgkCoJ9SDGc8ZHyQiFgh8CZQtpsBBEs="}]},"_npmUser":{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.5_1714985630253_0.30670767492310147"},"_hasShrinkwrap":false},"1.6.6-alpha1":{"name":"ternoa-js","version":"1.6.6-alpha1","description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","engines":{"node":">=14.13.1 || >=16.0.0"},"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"keywords":["ternoa","blockchain","transaction","sdk","substrate"],"author":{"name":"Ghali Leouarz"},"contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","dependencies":{"@polkadot/api":"^10.10.1","axios":"^1.6.2","bn.js":"5.2.x","buffer":"6.0.x","form-data-encoder":"1.7.x","formdata-node":"4.4.x","openpgp":"^5.11.0","sssa-js":"^0.0.1","stream":"0.0.x"},"types":"./index.d.ts","typesVersions":{"*":{"account":["./account/index.d.ts"],"assets":["./assets/index.d.ts"],"auction":["./auction/index.d.ts"],"balance":["./balance/index.d.ts"],"blockchain":["./blockchain/index.d.ts"],"helpers":["./helpers/index.d.ts"],"nft":["./nft/index.d.ts"],"rent":["./rent/index.d.ts"],"tee":["./tee/index.d.ts"],"marketplace":["./marketplace/index.d.ts"],"protocols":["./protocols/index.d.ts"],"events":["./events.d.ts"],"constants":["./constants.d.ts"]}},"_id":"ternoa-js@1.6.6-alpha1","readme":"# ⚙️ Ternoa SDK\n\n[![ternoajs](https://img.shields.io/badge/ternoa-js-yellow?style=flat-square)](https://ternoa-js.ternoa.dev/)\n![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)\n[![npm stable](https://img.shields.io/npm/v/ternoa-js?logo=npm&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n[![beta](https://img.shields.io/npm/v/ternoa-js/next?label=next-rc&logo=npm&&style=flat-square)](https://www.npmjs.com/package/ternoa-js)\n\nIt's the easiest and fastest way to build on top of the Ternoa Chain. Based on Javascript and the Polkadot.js API, it offers developers a seamless experience in the Domain of Web 3.\n\nYou can start by familiarizing yourself with the architecture and playing around with the ternoa.js [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) to get a good grasp of the Ternoa SDK.\n\nLastly, don’t forget to have a good time, that's like the most important thing. Cheers 🍻\n\n**Table of Contents**\n\n- [Introduction](#introduction)\n  - [Contribution Guidelines](#contribution-guidelines)\n  - [Error Reporting](#error-reporting)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [On Chain Events](#on-chain-events)\n  - [SDK Design](#sdk-design)\n    - [Event Design Format](#event-design-format)\n    - [Events Handled](#events-handled)\n- [Code Architecture](#code-architecture)\n  - [Handlers architecture](#handlers-architecture)\n    - [Response format](#response-format)\n    - [Initialize an API Instance](#initialize-an-api-instance)\n  - [Examples](#examples)\n    - [Create an Account](#create-an-account)\n    - [Create an NFT with Keyring](#create-an-nft-with-keyring)\n    - [Create an NFT (full flow)](#create-an-nft-full-flow)\n- [Documentation](#documentation)\n  - [Wiki](#Wiki)\n  - [Typescript documentation](#typescript-documentation)\n  - [End-to-end test dApp](#end-to-end-test-dapp)\n  - [Github repository](#github-repository)\n- [Development](#development)\n  - [Build](#build)\n  - [Generating Documentation](#generating-documentation)\n  - [Testing](#testing)\n  - [Code Style](#code-style)\n  - [Build And Run With Podman](#build-and-run-with-podman)\n    - [Tips to Run with Podman](#tips-to-run-with-podman)\n    - [Remove Container After Exit](#remove-container-after-exit)\n    - [Persistent Storage](#persistent-storage)\n    - [Run The Container And Access Its Shell](#run-the-container-and-access-its-shell)\n    - [Create A Detached Instance And Access Its Shell](#create-a-detached-instance-and-access-its-shell)\n    - [Create A Development Environment](#create-a-development-environment)\n- [License](#license)\n\n## Introduction\n\nTernoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.\n\n#### For Builders By Builders\n\nNFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.\n\n#### Native support for Advanced Features\n\nWith native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.\n\n#### Ecosystem\n\nOur ecosystem of NFT-based dApps keeps growing day after day. Our SDK relies upon the most popular high-level languages, allowing us to tap into the world’s largest pool of existing developers, thereby minimizing the transition period.\n\n### Contribution Guidelines\n\nAs Ternoa-js is an open-source SDK, feel free to interact with the tools and libraries, log issues, create pull requests or leave feedback. We welcome and greatly appreciate your contribution.\n\nIf you’re interested in contributing to the Ternoa SDK, we recommend you inspect our [contribution guidelines](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/CONTRIBUTING.md).\n\nIf you want to learn how to use the Ternoa SDK, the [test-dapp](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp) is the perfect place to familiarize yourself with our architecture and contribute to its development.\n\n### Error Reporting\n\nIf you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly.\nIt'll help us further improve the overall experience for our users.\n\n- Open a discussion of type `General` in the [discussions section](https://github.com/capsule-corp-ternoa/ternoa-js/discussions) if you encounter any unexpected behaviour.\n- Open a Bug report using the [bug template](https://github.com/capsule-corp-ternoa/ternoa-js/issues/new/choose) if the bug persists.\n- If you can, suggest a fix in a pull request to resolve that issue.\n\nMake sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.\n\n## Installation\n\nPre-requisites:\n[Node.js](https://nodejs.org/en/download/)\n\nInstall the latest stable version of the ternoa-js library by running this command:\n\n```bash\nnpm install ternoa-js\n```\n\n> This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.\n\nYou can test out our upcoming features in our **Beta** `@beta` or **Release candidate** `@rc` versions. These versions aren't stable and might contain some technical errors. @beta versions are for internal and public testing only whereas @rc releases tend to be the closest to its production version.\n\nYou can check out our `version list` over @ [npm](https://www.npmjs.com/package/ternoa-js). Installing a specific version is as easy as replacing the 1.2.0-rc0 with your desired version.\n\n```bash\n# for version 1.2.0-rc0\nnpm i ternoa-js@1.2.0-rc0\n```\n\n## Quick Start\n\n### On Chain Events\n\n**What are chain events ?**\nEvents are objects containing decoded values (data) provided by the chain in the result of any transaction executed using the `submitTxBlocking` function. At least one of these two `ExtrinsicSuccessEvent` or `ExtrinsicFailedEvent` events are provided for any transaction depending on its execution. While `submitTxBlocking` provides the SDK handlers with the list of main On Chain events `BlockchainEvents` (alongside the Block information), we also allow you to filter this list to get the ones you need.\n\nAn example to filter only the events list of a balance transfer transaction:\n\n```javascript\nconst balanceTransfertEvents = BlockchainEvents.events.findEvents(BalancesTransferEvent)\n```\n\n**Note**: BlockchainEvents is the result of `submitTxBlocking` function: it now contains both block information (block hash, header (...)) and the events list. It can be stored in a constant for example.\n\n### SDK design\n\nTo get a better understanding of OnChain Events, we already discussed the option to get the extrinsic events list. In case, you don't need to handle manual signing of transactions, each Ternoa extrinsic features comes with two functions to execute a transaction and an easy one to directly get the required events list. See the example below:\n\nThe `balancesTransferTx` function creates an unsigned unsubmitted transaction hash and the `balancesTransfer` function signs and submits the transaction to provide the events list.\n\n**This explains two things:**\n\n1. Each Helper is composed of two functions\n\n- a `xxxxxxxx` version that signs and submits the transaction, then returns the dedicated event.\n- a `xxxxxxxxTx` version to create an unsigned and unsubmitted transaction hash.\n\n2. We already cover the most common Ternoa pallets with ready to use pallets. However, all extrinsics can be triggered using a combination of generic blockchain helpers like `createTxHex`,`signTxHex`,`submitTxHex`, etc (check the Handlers Architecture in the next section for more info)\n\n#### Event Design Format\n\nIn order to make the returned event data useful, we provide both the native and a friendly ready to use format design:\n\n- a string as an AccountId32 correspond to a classic user valid address.\n- a string as u128 is a BN value as string natively used under the hood by the chain.\n- a rounded data (ex: amoutRounded) is the \"human\" version of a data, (usually a BN) that can be directly used.\n- some events from the utility pallet do not return any data.\n\n#### Events handled\n\nThe events below are the Events handled in the Ternoa SDK sorted by categories\n\n- [Assets](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#assets)\n- [Balances](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#balances)\n- [Treasury](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#treasury)\n- [NFT](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#nft)\n- [Collection](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#collection)\n- [Marketplace](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#marketplace)\n- [Utility](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#utility)\n- [System](https://github.com/capsule-corp-ternoa/ternoa-js/wiki/4-Events#system)\n\n## Code Architecture\n\nTernoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallet, make a query like asking for some constant's storage. We also provide a bunch of helpers and utility functions to assist you with development.\n\nThe main handlers are as follows:\n\n- blockchain: Handles the Core blockchain functions and the API brain initializes the API, execute transactions, query datas, batch transactions and much more.\n- account: the functions that allows you to generate a new seed and a keyring.\n- assets: the functions to deal with fungible assets that are meant for use within a dApp.\n- balance: the Balance pallet with its extrinsics, query and storage.\n- nft: the NFT pallet with its extrinsics, query and storage.\n- marketplace: the Marketplace pallet with its extrinsics, query and storage.\n- events: the events list returned, alongside of block information, when `submitTxBlocking` function is triggered.\n\n### Handlers architecture\n\nFor those who are familiar with Polkadot, you will quickly recognize the design structure of our features. If you aren't aware, no worries, the basic principles are easy enough to grasp. Depending on the pallet or handler category, you'll retrive:\n\n- **Constants**: to request the chain runtime constants.\n- **Storage**: to query the chain state.\n- **Extrinsics**: to execute transactions.\n- _Utilities_: to provide some additional useful functions you can directly import in your project.\n\n#### Response format\n\nAs it makes sense for us to provide you the easiest tools to build on the Ternoa chain, we also try to simplify the response format of our functions as much as we can.\n\nDepending on if you go with the easy way or choose the complex route (for added customization), we suggest you to choose the right function: Events and features data will be provided directly on some functions while only transaction hash hex will be returned on others.\n\n#### Initialize an API Instance\n\nBefore you can start calling any functions, you'll need to initialize an API Instance using the _`initializeApi`_ function located in **ternoa-js/src/blockchain**.\n\n```javascript\nimport { initializeApi } from \"ternoa-js\"\n\nasync function main() {\n  // Construct\n  await initializeApi()\n  // Do something\n  console.log(\"Api Connected\")\n}\n```\n\nYou can set the chain endpoint by passing an endpoint parameter to the _`initializeApi`_ function whereas the default chain endpoint is: `DEFAULT_CHAIN_ENDPOINT` = `\"wss://alphanet.ternoa.com\"`.\n\n```javascript\n{\n  // Customizing API Endpoint\n  await initializeApi(\"wss://mainnet.ternoa.io\")\n\n  // Do something\n  console.log(\"Api Connected to mainnet\")\n}\n```\n\nPro Tip: Ternoa SDK provides a very useful `getRawApi()` function to interact with the API. If the API is connected, it'll be returned instantaneously.\n\n```javascript\n{\n  // Assuming that API has been initialized before\n  const api = await getRawApi()\n\n  // example: get last block\n  const signedBlock = await api.rpc.chain.getBlock()\n}\n```\n\n### Examples\n\n#### Create an Account\n\nYou can create an account using the API itself. You'll need to call the `generateSeed` and `getKeyringFromSeed` functions.\n\nAll functions are organized by a specific theme, for example, the function _generateSeed_ which allows us to create a new account and _getKeyringFromSeed_ which allows us to retrieve its address, can conveniently be found in **ternoa-js/src/account**.\n\n```javascript\nimport { generateSeed, getKeyringFromSeed } from \"ternoa-js/account\"\n;(async () => {\n  const seed = await generateSeed()\n  const keyring = await getKeyringFromSeed(seed)\n  const address = keyring.address\n  console.log(\"Your fresh public address is: \", address)\n})().catch((e) => {\n  console.log(e)\n})\n```\n\n#### Create an NFT with Keyring\n\nCreating a basic NFT using the features provided by the SDK is easy enough. This short snippet of code allows you to Create, Submit and Sign an NFT. Essentially minting your NFT with the click of a button.\n\nThe function `createNft` requires a few parameters like: `offchainData` aka metadata, the `royalty` percentage, its `collectionId` if you want it to belong to an existing collection, a Boolean value `isSoulBound` to determine its status, `keyring` parameter to sign and submit the transaction and a callback parameter `waitUntill`, to define when we get the results of that transaction execution.\n\n```javascript\n// The easiest way to Create your first NFT\nimport { initializeApi } from \"ternoa-js\"\nimport { createNft } from \"ternoa-js/nft\"\n\nconst createMyFirstNFT = async () => {\n  try {\n    // We initialize the API instance\n    await initializeApi()\n\n    ... //we asume your keyring is already created and provided with CAPS to support transactions fees.\n\n    // Here we create, sign and submit the NFT transaction with your keyring\n    const newNFTEvent = await createNft(\"My first NFT\", 10, undefined, false, keyring, WaitUntil.BlockInclusion)\n\n    // Do something with the NFTCreatedEvent response\n    console.log(newNFTEvent);\n    ...\n\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n#### Create an NFT (full flow)\n\n**That being said, You can opt for the manual route which although being complex, offers more versatility.**\n\nThe Simple way automated the 3 steps (Create -> Sign => Send) associated with creating an NFT making it much easier to use while not allowing any room for customisation and optimisation.\n\nThe manual way provides much more versatility but is significantly more complex. Let's say for example you want to batch transactions together instead of executing them one by one (covered in example section). It'll be useful if you want to simplify the process of creating a large amount of NFTs and minimize repetitive tasks like sending and signing each transaction.\n\n##### STEP 1 - Create an NFT transaction\n\nFirst of all, instead of using the `createNft()` function, you will use `createNftTx()`. And instead of creating, signing and submiting the transaction and getting the returned events, it will just create an unsigned and unsubmitted Create-NFT Transaction Hash which will be _valid for the next 5 minutes_.\n\n```javascript\n// Imports\nimport { initializeApi } from \"ternoa-js\"\nimport { createNftTx } from \"ternoa-js/nft\"\n\nconst create createNFTManually = async () => {\n  try {\n    // STEP 1: Here we create the transaction and get the transaction hash\n    const nftTxHash = await createNftTx(\"My first NFT\", 10, undefined, false)\n\n    // Do something with the transaction hash\n    console.log(nftTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 2 - Sign a transaction hash\n\nNow we have the `txHash`, we can move to the signing step. But before going into detail, it's good to know that \"signing\" can be directly embed in the submit function. It means that depending on the submit function you are using (see the last step below), signing your tx hash before submit might not be necessary. In case you sign manually the tx hash, you will receive a hex value of the signed transaction ready to be sent. The `signTxHex()` function expect **a keyring** that will sign the transaction and the **transaction hash** to be signed.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n  // STEP 2: Here we sign the transaction hash. nftTxHash is the name of the tx hash from the function we created before.\n    const signTxHash = await signTxHex(keyring, nftTxHash)\n    // Do something with the hex value.\n    console.log(signTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n##### STEP 3 - Submit a transaction\n\nSubmiting a transaction is generally the last step of the transaction execussion process. Ternoa-js provides up to 3 ways to submit a transaction. From the raw and native way to the fully handled and easiest way. Depending on the response format you are expecting and the specific case you want to handle (simple submit, batching some transaction (...)) you will need to go with one of the following functions:\n\n- `submitTxHex()` - The most versatile and customizable way to submit your `txHash`. You can manage the callback function yourself. It requires the hex value to be submited but also an optional callback. This function requires the transaction hash to be signed beforehand.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    // STEP 3.1: Here we submit the transaction hex value.\n    // Here no callback function is used but the second parameter can be a callback function that help you to handle the result.\n    // Once again, we use here the tx hex signedTxHash, from the previous step.\n    const submitTxHash = await submitTxHex(signTxHash)\n    // Do something with the final tx hash.\n    console.log(submitTxHash);\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxBlocking()` - The most most convenient way to get Events and Data: This function will sign the transaction for you if you pass a keyring (one less thing to worry about) and it's blocking the execution flow until the transaction is either in a block or in a finalized block. Since submitting needs to work will all kinds of transactions, the result is an object that contains the block information (the block hash, the block header and block extrinsics) and all the events that have happened (instead of only specific ones).\n\nNote: Here you do not need to necessarily pass a signed txHash. If you pass the Keyring as a parameter and an unsigned tx hash the signing process will be done here for you.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.2: Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step.\n    const submitTxHash = await submitTxBlocking(signTxHash, WaitUntil.BlockInclusion)\n    // We destructure the result of submitTxHash:\n    const { events, blockInfo } = submitTxHash\n    // Do something with the events recieved. Example: find the NFTCreatedEvent to access the NFT datas.\n    console.log(events.findEvents(NFTCreatedEvent));\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n- `submitTxNonBlocking()`: This one works as the `submitTxBlocking` but in a non blocking way. Returns a group objects that are used to track the progress of the transaction execution: The first returned object is a conditional variable which can yield the information if the operation is finished. The second returned object is an array of events which gets populated automatically once the operation is finished. The third returned object contains the block information as the block hash, the block header and block extrinsics.\n\n```javascript\nconst create createNFTManually = async () => {\n  try {\n    ...\n\n    // STEP 3.3: It get the same parameters as the submitTxBlocking\n    // Here we submit the transaction hex value signed before.\n    // We could have used the unsigned tx Hash and pass a keyring as a third parameter instead.\n    // Once again, we use here the tx hex signTxHash, from the previous step 2.\n    const submitTxHash = await submitTxNonBlocking(signTxHash, WaitUntil.BlockInclusion)\n\n    // Do something with the events recieved.\n    console.log(submitTxHash);\n    ...\n  } catch (e) {\n    console.log(e)\n  }\n}\n```\n\n## Documentation\n\n### Wiki\n\nCheck out our [Wiki](https://github.com/capsule-corp-ternoa/chain/wiki) page. We are constantly adding new pages and guides there.\n\n### Typescript documentation\n\nThe auto generated typescript documentation is available @[Dev.Ternoa](https://ternoa-js.ternoa.dev/) and any additional resources can be found over @[Docs.Ternoa](https://docs.ternoa.network/),\n\n### End-to-end test dApp\n\nDiscover our end-to-end test Dapp [here](https://e2e.ternoa.network/) to test out the Ternoa SDK.\nHere's the E2E-test-dapp repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js-test-dapp)\n\n### Github repository\n\nHere's the Ternoa.js SDK Github repository -> [repo](https://github.com/capsule-corp-ternoa/ternoa-js)\n\n## Development\n\n### Build\n\nTo build a new version of the library, run:\n\n```bash\nnpm run build\n```\n\n### Generating Documentation\n\nTo generate the documentation website, run:\n\n```bash\nnpm run docs\n```\n\nYou can locate the static website in the [/docs](https://github.com/capsule-corp-ternoa/ternoa-js/tree/main/docs) directory.\n\n### Testing\n\nThe test suites rely upon testing pairs in the [testing pairs file](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/testingPairs.ts). In order to prepare these pairs, [test-setup.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-setup.ts) and [test-teardown.ts](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/src/_misc/scripts/test-teardown.ts) are supplied and drained of `$CAPS` respectively. Environmental variables `BLOCKCHAIN_ENDPOINT` (e.g. `BLOCKCHAIN_ENDPOINT=wss://alphanet.ternoa.com`), `SEED_TEST_FUNDS` and `SEED_TEST_FUNDS_PUBLIC_KEY` have to be defined in order to run these test suites.\n\nTo initiate the test suites, run:\n\n```bash\nnpm run test\n```\n\n### Code Style\n\nThis project uses Industry standard ESLint and Typescript rules to ensure good coding practices and readability.\n\nWe’ve set up linters and formatters to help catch errors and enhance the overall experience:\n\n- [Prettier](https://prettier.io/) – ensures that code is formatted in a readable way.\n- [ESLint](https://eslint.org/) — checks code for antipatterns as well as formatting.\n\n> If you use Visual Studio Code editor, we suggest you to install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions.\n\n### Build And Run With Podman\n\n```bash\n  # Downloads the package lists and \"updates\" them.S\n  sudo apt update -y\n  # Installing podman.\n  sudo apt install podman\n  # Building the image using podman and Docker file.\n  podman build -t tsdk .\n  # Checking if everything is OK.\n  podman images | grep tsdk\n  # Run the tsk image.\n  podman run tsdk\n```\n\n#### Tips to Run with Podman\n\nWe’ll illustrate some useful podman commands and their use cases next. It’s important to note that we’ve omitted most of the flags to make them concise. Make sure to build the image as per the steps defined in the \"Build and Run with Podman\" section.\n\nIn case no command arguments are specified, It’ll try to build the `starter-project` by default. To override this, simply add `bash` at the end of the command. It'll look something like: `podman run tsdk bash`.\n\n#### Remove Container After Exit\n\nA container which completed its execution or is no longer in use due to the user disconnecting will not be removed by default, it’ll switch to the exit state.\n\nUse the flag `--rm` to make sure it’s deleted and later removed.\n\n```bash\n  # The --rm flag removes the container after usage.\n  podman run --rm tsdk\n  # Check if any container is running or stopped.\n  podman ps -a\n```\n\n#### Persistent Storage\n\nThe container uses a local copy of the repo in order to compile and run examples. This means that if changes are made inside the container, they’ll fail to propagate and will be lost. To mitigate this issue, the virtual container volume `/workdir` needs to be mapped to a directory on the host machine that contains the Ternoa.js repo. After the mapping is done, any changes made in the mapped directory will be reflected in the container.\n\nThis way, you can develop dApps without having to install all the required dependencies. For the workflow check out the \"Create A Development Environment\" section.\n\n```bash\n  # Flag -v tells the host machine to map the physical \"./.\" path with the virtual container one \"/workdir\". If no command arguments are given this will try to compile and run the starter-project project.\n  podman run -v ./.:/workdir tsdk\n```\n\n#### Run The Container And Access Its Shell\n\nThe pre defined operation of the container when executed is to compile and and initiate the `starter-project`. To execute a different operation, additional commands can be passed at the end. For example: padding `bash` will run the bash shell session instead of the default operation.\n\n```bash\n  # If no command arguments are given this will try to compile and run the starter-project. By passing \"bash\" we make sure that we run a bash shell session once the container starts.\n  podman run -it tsdk bash\n```\n\n#### Create A Detached Instance And Access Its Shell\n\n```bash\n  # Flag \"-d\" runs the container in detached mode.\n  podman run -d tsdk bash\n  # Access its shell.\n  podman exec -itl bash\n```\n\n#### Create A Development Environment\n\nThe dockerfile is made in a way that it can be used to develop new applications with it.\n\nExample of a typical workflow:\n\n- The host installs git, clones the repo and install a code editor like VS Code.\n- runs the container in interactive mode with `/workdir` pointing to a work directory on the host machine (can be your own project or ternoa-js).\n- writes code via a code editor and uses the terminal to run the `tsc` and `node` commands.\n- With that setup all the changes are done locally on the host machine while the container is only used to compile and run the app.\n\n```bash\n  # Flag \"--name\" is used to name the container.\n  podman run -it --name my_sdk_env -v ./.:/workdir tsdk bash\n  # Do some activity and the exit the container\n  [root@d4ad8ec11655:/workdir] nano -V\n  [root@d4ad8ec11655:/workdir] apt install nano\n  [root@d4ad8ec11655:/workdir] exit\n\n  # Return to the same container\n  podman start my_sdk_env\n  podman exec -it my_sdk_env /bin/bash\n  [root@d4ad8ec11655:/workdir] nano -V\n```\n\n## License\n\nTernoa.js uses the [Apache 2.0](https://github.com/capsule-corp-ternoa/ternoa-js/blob/main/LICENSE) License.\n","readmeFilename":"README.md","gitHead":"b72b96c30bb91474c30c4d456ad341b78fd694b4","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-8GUdvz0d7OB8wC7OA1ANKujjiWHYLymH/ZN6MRbIpMI0uA1hWbY8oHd3SVN2f7U5T5kOYK3SinldtVaTgdR6uA==","shasum":"0246bb8aa3dbf7354a83d1a1ad184e109aa2bc88","tarball":"https://registry.npmjs.org/ternoa-js/-/ternoa-js-1.6.6-alpha1.tgz","fileCount":131,"unpackedSize":640895,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFMtgHYP+AoqPbSEdAuvBMWu5UhNxF5T0qt7o2RvYx14AiBYiBbId90mWfq5KedeBicaPYdlP8IYqguoeKTQjrD7lQ=="}]},"_npmUser":{"name":"mohsanriaz","email":"bahrianboy@gmail.com"},"directories":{},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"},{"name":"mohsanriaz","email":"bahrianboy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ternoa-js_1.6.6-alpha1_1715344745802_0.9258463952536005"},"_hasShrinkwrap":false}},"time":{"created":"2022-03-08T13:39:58.375Z","0.0.0":"2022-03-08T13:39:58.523Z","modified":"2024-05-10T12:39:06.127Z","0.0.1":"2022-03-08T14:14:15.952Z","0.0.2":"2022-03-08T14:17:49.036Z","0.0.3":"2022-03-14T09:36:40.940Z","0.0.4":"2022-03-14T09:48:04.952Z","0.0.5":"2022-03-14T09:56:54.984Z","0.0.6":"2022-03-14T10:06:27.663Z","0.0.7":"2022-03-17T13:01:17.288Z","0.0.8":"2022-03-17T13:17:40.440Z","0.0.9":"2022-03-17T16:34:43.070Z","0.0.10":"2022-03-17T16:41:57.890Z","0.0.12":"2022-03-17T21:30:32.722Z","0.0.13":"2022-03-17T21:39:50.732Z","0.0.14":"2022-03-17T21:47:34.619Z","0.0.15":"2022-03-18T07:55:47.935Z","0.0.16":"2022-03-18T08:37:39.384Z","0.0.17":"2022-04-08T10:41:33.654Z","0.0.18":"2022-04-08T13:27:24.383Z","0.0.19":"2022-04-08T13:43:37.412Z","0.0.20":"2022-04-11T11:57:45.841Z","0.0.21":"2022-04-11T13:35:35.552Z","0.0.22":"2022-04-11T13:53:01.331Z","0.0.23":"2022-04-11T13:58:38.405Z","0.0.24":"2022-04-12T07:10:22.631Z","0.0.25":"2022-04-12T09:13:38.336Z","0.0.26":"2022-04-12T09:31:47.990Z","0.0.27":"2022-04-12T09:38:49.038Z","0.0.28":"2022-04-12T10:12:07.900Z","0.0.29":"2022-04-12T10:18:49.244Z","0.0.30":"2022-04-12T10:45:46.291Z","0.0.31":"2022-04-12T12:59:32.963Z","0.0.32":"2022-04-12T13:08:08.726Z","0.0.33":"2022-04-12T13:28:53.255Z","0.0.34":"2022-04-12T13:37:33.385Z","0.0.35":"2022-04-12T13:45:39.961Z","0.0.36":"2022-05-06T15:33:03.163Z","0.0.38":"2022-05-13T16:18:26.831Z","1.0.0":"2022-05-13T16:27:41.116Z","1.0.1":"2022-05-18T14:46:58.976Z","1.0.2":"2022-05-18T22:00:43.662Z","1.0.3":"2022-05-19T14:05:47.941Z","1.0.4":"2022-06-09T17:11:53.509Z","1.1.0-alpha.0":"2022-06-21T15:42:16.123Z","1.1.0-alpha1":"2022-06-22T14:12:18.143Z","1.1.0-alpha2":"2022-06-28T13:55:11.501Z","1.1.0-alpha3":"2022-07-01T11:50:48.931Z","1.1.0-alpha4":"2022-07-06T13:35:46.689Z","1.1.0-rc0":"2022-07-15T16:15:04.133Z","1.1.0":"2022-07-27T16:52:03.659Z","1.2.0-rc0":"2022-07-27T16:53:58.955Z","1.2.0":"2022-08-25T16:12:23.966Z","1.3.0-alpha0":"2022-09-06T10:36:22.959Z","1.3.0-alpha1":"2022-09-23T10:31:14.589Z","1.3.0-rc0":"2022-09-23T10:54:14.405Z","1.3.0":"2022-10-25T15:22:30.377Z","1.3.1-rc0":"2022-10-25T15:29:16.187Z","1.4.0-alpha0":"2022-11-04T10:24:52.657Z","1.4.0-alpha1":"2022-11-14T17:51:42.403Z","1.4.0-alpha2":"2022-11-16T18:57:37.555Z","1.4.0-alpha3":"2022-11-17T16:33:25.171Z","1.3.1":"2022-11-24T11:42:09.338Z","1.4.0-rc0":"2022-11-24T11:51:23.919Z","1.4.0":"2022-12-09T16:16:35.979Z","1.4.1":"2022-12-22T12:01:46.688Z","1.4.1-alpha0":"2023-01-05T16:26:23.701Z","1.4.2-alpha0":"2023-01-09T12:09:42.838Z","1.4.2-alpha1":"2023-01-09T12:25:06.411Z","1.5.0-alpha0":"2023-02-06T07:47:35.197Z","1.5.0-alpha1":"2023-02-10T14:21:29.443Z","1.5.0-alpha2":"2023-02-17T08:44:45.419Z","1.5.0-alpha3":"2023-02-21T13:17:36.187Z","1.5.0-alpha4":"2023-03-01T09:28:50.976Z","1.5.0-alpha5":"2023-03-01T15:13:07.594Z","1.5.0-alpha6":"2023-03-01T16:14:18.577Z","1.5.0-rc0":"2023-03-03T10:52:21.153Z","1.5.0-rc1":"2023-03-07T09:59:11.139Z","1.5.0-rc2":"2023-03-15T18:07:58.088Z","1.5.0-rc3":"2023-03-28T15:56:51.456Z","1.5.0":"2023-04-17T11:07:26.928Z","1.5.1":"2023-04-19T12:02:13.557Z","1.5.2":"2023-05-17T11:10:56.314Z","1.5.3":"2023-06-08T10:22:30.893Z","1.6.0-alpha0":"2023-07-17T08:56:49.915Z","1.6.0-alpha1":"2023-07-19T08:54:20.524Z","1.6.0-alpha2":"2023-07-25T15:15:17.611Z","1.6.0-alpha3":"2023-07-28T13:13:14.879Z","1.6.0-alpha4":"2023-07-28T13:19:57.186Z","1.6.0-alpha5":"2023-08-01T16:01:12.642Z","1.6.0-alpha6":"2023-08-08T13:46:56.563Z","1.6.0-alpha7":"2023-08-09T16:22:10.696Z","1.6.0-alpha8":"2023-08-22T13:12:29.709Z","1.6.0-rc0":"2023-09-01T12:56:26.356Z","1.6.0-rc1":"2023-09-11T10:22:22.602Z","1.6.0-rc2":"2023-09-13T13:32:18.862Z","1.6.0-rc3":"2023-09-13T13:54:13.041Z","1.6.0-alpha9":"2023-09-14T08:28:00.229Z","1.6.0-alpha10":"2023-09-14T08:35:31.648Z","1.6.0":"2023-10-05T14:09:50.993Z","1.6.1-alpha1":"2023-10-12T15:08:27.954Z","1.6.1-alpha2":"2023-11-02T10:11:41.004Z","1.6.1-alpha3":"2023-12-13T11:04:37.382Z","1.6.1-rc1":"2023-12-19T08:58:59.165Z","1.6.1-alpha4":"2023-12-20T09:57:48.573Z","1.6.1":"2024-01-22T14:39:51.754Z","1.6.2-rc0":"2024-01-22T15:30:09.464Z","1.6.2":"2024-01-22T15:46:13.874Z","1.6.3":"2024-02-15T14:34:02.178Z","1.6.4":"2024-04-24T13:08:46.044Z","1.6.5":"2024-05-06T08:53:50.406Z","1.6.6-alpha1":"2024-05-10T12:39:05.956Z"},"maintainers":[{"name":"leouarz","email":"leouarzv2@gmail.com"},{"name":"victorsalomon","email":"victor-salomon@hotmail.fr"},{"name":"dontelmo","email":"igor.papandinas@posteo.net"},{"name":"mohsanriaz","email":"bahrianboy@gmail.com"}],"description":"Ternoa library of functions to interact with the blockchain and manipulate transactions","homepage":"https://github.com/capsule-corp-ternoa/ternoa-js#readme","keywords":["ternoa","blockchain","transaction","sdk","substrate"],"repository":{"type":"git","url":"git+https://github.com/capsule-corp-ternoa/ternoa-js.git"},"author":{"name":"Ghali Leouarz"},"bugs":{"url":"https://github.com/capsule-corp-ternoa/ternoa-js/issues"},"license":"Apache-2.0","readme":"","readmeFilename":"","contributors":[{"name":"Igor Papandinas"},{"name":"Victor Salomon"},{"name":"Marko Petrlic"}]}