PageSourceSearch

https://docs.ignite.com/assets/js/78aefe33.f9db7713.js

js ignite.com collected 2026-10-03 23:17:41 UTC 5,503 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkmy_website=globalThis.webpackChunkmy_website||[]).push([[1485],{15680(e,n,t){t.d(n,{xA:()=>p,yg:()=>m});var r=t(96540);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function d(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),l=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=d(e,["components","mdxType","originalType","parentName"]),u=l(t),m=o,g=u["".concat(s,".").concat(m)]||u[m]||c[m]||a;return t?r.createElement(g,i(i({ref:n},p),{},{components:t})):r.createElement(g,i({ref:n},p))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var d={};for(var s in n)hasOwnProperty.call(n,s)&&(d[s]=n[s]);d.originalType=e,d.mdxType="string"==typeof e?e:o,i[1]=d;for(var l=2;l<a;l++)i[l]=t[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,t)}u.displayName="MDXCreateElement"},64176(e,n,t){t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>a,metadata:()=>d,toc:()=>l});var r=t(58168),o=(t(96540),t(15680));const a={},i="Importing methods from the Bank keeper",d={unversionedId:"guide/loan/bank",id:"version-v0.26/guide/loan/bank",title:"Importing methods from the Bank keeper",description:"In the previous step you have created the loan module with `ignite scaffold",source:"@site/versioned_docs/version-v0.26/02-guide/05-loan/02-bank.md",sourceDirName:"02-guide/05-loan",slug:"/guide/loan/bank",permalink:"/v0.26/guide/loan/bank",draft:!1,tags:[],version:"v0.26",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Creating a structure of the application",permalink:"/v0.26/guide/loan/init"},next:{title:"Request a loan",permalink:"/v0.26/guide/loan/request"}},s={},l=[],p={toc:l};function c(e){let{components:n,...t}=e;return(0,o.yg)("wrapper",(0,r.A)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.yg)("h1",{id:"importing-methods-from-the-bank-keeper"},"Importing methods from the Bank keeper"),(0,o.yg)("p",null,"In the previous step you have created the ",(0,o.yg)("inlineCode",{parentName:"p"},"loan")," module with ",(0,o.yg)("inlineCode",{parentName:"p"},"ignite scaffold\nmodule")," using ",(0,o.yg)("inlineCode",{parentName:"p"},"--dep bank"),". This command created a new module and added the\n",(0,o.yg)("inlineCode",{parentName:"p"},"bank")," keeper to the ",(0,o.yg)("inlineCode",{parentName:"p"},"loan")," module, which allows you to add and use bank's\nkeeper methods in loan's keeper methods."),(0,o.yg)("p",null,"To see the changes made by ",(0,o.yg)("inlineCode",{parentName:"p"},"--dep bank"),", review the following files:\n",(0,o.yg)("inlineCode",{parentName:"p"},"x/loan/keeper/keeper.go")," and ",(0,o.yg)("inlineCode",{parentName:"p"},"x/loan/module.go"),"."),(0,o.yg)("p",null,"Ignite takes care of adding the ",(0,o.yg)("inlineCode",{parentName:"p"},"bank")," keeper, but you still need to tell the\n",(0,o.yg)("inlineCode",{parentName:"p"},"loan")," module which ",(0,o.yg)("inlineCode",{parentName:"p"},"bank")," methods you will be using. You will be using three\nmethods: ",(0,o.yg)("inlineCode",{parentName:"p"},"SendCoins"),", ",(0,o.yg)("inlineCode",{parentName:"p"},"SendCoinsFromAccountToModule"),", and\n",(0,o.yg)("inlineCode",{parentName:"p"},"SendCoinsFromModuleToAccount"),". You can do that by adding method signatures to\nthe ",(0,o.yg)("inlineCode",{parentName:"p"},"BankKeeper")," interface:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-go",metastring:'title="x/loan/types/expected_keepers.go"',title:'"x/loan/types/expected_keepers.go"'},'package types\n\nimport (\n    sdk "github.com/cosmos/cosmos-sdk/types"\n)\n\ntype BankKeeper interface {\n    SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins\n    // highlight-start\n    SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error\n    SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error\n    SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error\n    // highlight-end\n}\n')))}c.isMDXComponent=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.