Communication with the blockchain is typically done through a provider and local models of smart contracts and their ABIs.To achieve this, our examples use the fuels.ts library. To instantiate a provider you will need a data source. There are two options:JSON RPC URL: If you are working with Ethereum mainnet or a local fork, you can access the blockchain through a JSON RPC URL.
An example of this can be found in the Sail Rust Integration Guide.Wallet Browser Extension: If you are connecting to a wallet browser extension, these wallets embed a source directly into the Javascript window object as window.fuel.
This object surfaces information about the user’s wallets and provides the ability to communicate with the connected chain. It can be used with fuels.js to construct a provider.
To test your code, we recommend utilizing a local fork of Fuel. To help facilitate easy testing,
here is more information for running a local node.
We recommend testing locally as opposed to on the testnet as it can sometimes be congested and running locally makes for the best developer experience.
This is the base struct to interact with the Rust and Typescript client it gives you access to all the functionality of the exchange.
Once initiallized with a Provider and a Wallet it can be used to call any function in the client.
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Sail","colors":{"primary":"#808080","light":"#D3D3D3","dark":"#5A5A5A"},"favicon":"/favicon.svg","logo":{"light":"https://mintcdn.com/sail/Tb7rHnWS9CvtdMGN/logo/sail_logo_no_bg_dark_text.png?fit=max\u0026auto=format\u0026n=Tb7rHnWS9CvtdMGN\u0026q=85\u0026s=f9134f6479ca3657184c53c3f2de2f99","dark":"https://mintcdn.com/sail/Tb7rHnWS9CvtdMGN/logo/sail_logo_no_bg_light_text.png?fit=max\u0026auto=format\u0026n=Tb7rHnWS9CvtdMGN\u0026q=85\u0026s=f043f20661b65b24a3f2ad8915b5ac22","href":"https://sail.exchange"},"appearance":{"default":"dark","strict":null},"background":{"decoration":null,"color":{"light":"#f0f0f0","dark":"#121212"}},"navbar":{"links":[{"label":"Support","href":"mailto:support@sail.exchange"}],"primary":{"type":"button","label":"App","href":"https://sail.exchange"}},"footer":{"socials":{"twitter":"https://twitter.com/_sailexchange","github":"https://github.com/Sail-Exchange","website":"https://mirror.xyz/sailexchange.eth"}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"sail","hasAudioNarration":false,"actualSubdomain":"sail","customDomains":["docs.sail.exchange"],"gitSource":{"type":"github","owner":"sail-exchange","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a20c3aa0e965794a0a73b93","collectionId":"03b5c860-a1c0-4d9d-9dbe-80f1417a76a0","schemaVersion":"v2"},"entitlements":{},"buildId":"6a20c3aa0e965794a0a73b93:success","clientVersion":"0.0.4044","searchFilterCounts":[{"language":"default","tag":"Documentation","count":24},{"language":"default","tag":"Contracts","count":4},{"language":"default","tag":"Guides","count":4},{"language":"default","tag":"Get Started","count":3},{"language":"default","tag":"API Reference","count":1},{"language":"default","tag":"API Documentation","count":1},{"language":"default","tag":"Security","count":1}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"guides/background","slug":"/guides/background","pageMetadata":{"title":"Background","description":null,"href":"/guides/background"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,p:`p`,..._provideComponents(),...props.components},{Heading}=_components;if(!Heading)_missingMdxReference(`Heading`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`providers`,children:`Providers`}),`\n`,_jsx(_components.p,{children:`Communication with the blockchain is typically done through a provider and local models of smart contracts and their ABIs.`}),`\n`,_jsx(_components.p,{children:`To achieve this, our examples use the fuels.ts library. To instantiate a provider you will need a data source. There are two options:`}),`\n`,_jsxs(_components.p,{children:[`JSON RPC URL: If you are working with Ethereum mainnet or a local fork, you can access the blockchain through a JSON RPC URL.\nAn example of this can be found in the `,_jsx(_components.a,{href:`/guides/sail_integration_rust#3-create-sail-instance`,children:`Sail Rust Integration Guide`}),`.`]}),`\n`,_jsx(_components.p,{children:`Wallet Browser Extension: If you are connecting to a wallet browser extension, these wallets embed a source directly into the Javascript window object as window.fuel.\nThis object surfaces information about the user’s wallets and provides the ability to communicate with the connected chain. It can be used with fuels.js to construct a provider.`}),`\n`,_jsx(Heading,{level:`4`,id:`developing-and-testing`,children:`Developing and Testing`}),`\n`,_jsxs(_components.p,{children:[`To test your code, we recommend utilizing a local fork of Fuel. To help facilitate easy testing,\nhere is more information for `,_jsx(_components.a,{href:`https://fuelbook.fuel.network/master/for-developers/running-a-local-node.html`,children:`running a local node`}),`.\nWe recommend testing locally as opposed to on the testnet as it can sometimes be congested and running locally makes for the best developer experience.`]}),`\n`,_jsx(Heading,{level:`2`,id:`notable-sdk-structures`,children:`Notable SDK Structures`}),`\n`,_jsx(Heading,{level:`4`,id:`sail`,children:`Sail`}),`\n`,_jsx(_components.p,{children:`This is the base struct to interact with the Rust and Typescript client it gives you access to all the functionality of the exchange.\nOnce initiallized with a Provider and a Wallet it can be used to call any function in the client.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Background","description":null,"href":"/guides/background"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Providers","slug":"providers","depth":2,"children":[{"title":"Developing and Testing","slug":"developing-and-testing","depth":4,"children":[]}]},{"title":"Notable SDK Structures","slug":"notable-sdk-structures","depth":2,"children":[{"title":"Sail","slug":"sail","depth":4,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"sail","siteName":"Sail","title":"Background - Sail","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-06T23:41:15.598Z","originalFileLocation":"guides/background.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Sail\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/sail/2oc8wbB9719j1vPk/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/sail/2oc8wbB9719j1vPk/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/sail/2oc8wbB9719j1vPk/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/sail/2oc8wbB9719j1vPk/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/sail/2oc8wbB9719j1vPk/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/sail/2oc8wbB9719j1vPk/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/sail/2oc8wbB9719j1vPk/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/sail/2oc8wbB9719j1vPk/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/sail/2oc8wbB9719j1vPk/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Background - Sail\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Sail\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.sail.exchange/guides/background\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://sail.mintlify.app/_mintlify/api/og/v2?division=Guides\u0026amp;title=Background\u0026amp;theme=0c92e035c6d6e243fda08607\u0026amp;signature=4ad8bc3bbe80c95a297a5d4dcf4d2924f28d095737e4ca91afee28643ab9cd06\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Background - Sail\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://sail.mintlify.app/_mintlify/api/og/v2?division=Guides\u0026amp;title=Background\u0026amp;theme=0c92e035c6d6e243fda08607\u0026amp;signature=4ad8bc3bbe80c95a297a5d4dcf4d2924f28d095737e4ca91afee28643ab9cd06\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/sail/2oc8wbB9719j1vPk/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Sail\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#808080\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.sail.exchange/guides/background\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/guides/background.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.sail.exchange/#organization\",\"name\":\"Sail\",\"url\":\"https://docs.sail.exchange\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/sail/Tb7rHnWS9CvtdMGN/logo/sail_logo_no_bg_dark_text.png?fit=max\u0026auto=format\u0026n=Tb7rHnWS9CvtdMGN\u0026q=85\u0026s=f9134f6479ca3657184c53c3f2de2f99\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.sail.exchange#website\",\"name\":\"Sail\",\"url\":\"https://docs.sail.exchange\",\"publisher\":{\"@id\":\"https://docs.sail.exchange/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.sail.exchange/guides/background#webpage\",\"url\":\"https://docs.sail.exchange/guides/background\",\"name\":\"Background\",\"dateModified\":\"2026-01-06T23:41:15.598Z\",\"isPartOf\":{\"@id\":\"https://docs.sail.exchange#website\"},\"breadcrumb\":{\"@id\":\"https://docs.sail.exchange/guides/background#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.sail.exchange/guides/background#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Sail\",\"item\":\"https://docs.sail.exchange\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Background\",\"item\":\"https://docs.sail.exchange/guides/background\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.sail.exchange/guides/background#article\",\"headline\":\"Background\",\"name\":\"Background\",\"url\":\"https://docs.sail.exchange/guides/background\",\"mainEntityOfPage\":{\"@id\":\"https://docs.sail.exchange/guides/background#webpage\"},\"dateModified\":\"2026-01-06T23:41:15.598Z\",\"publisher\":{\"@id\":\"https://docs.sail.exchange/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.sail.exchange#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Sail\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Sail","nav":{"global":null,"tabs":[{"tab":"Documentation","anchors":[{"anchor":"Documentation","icon":"book-open-cover","groups":[{"group":"Get Started","pages":[{"title":"Overview","href":"/overview"},{"title":"Quickstart","href":"/quickstart"},{"title":"Concepts","description":null,"href":"/concepts"}]},{"group":"Guides","pages":[{"title":"Background","href":"/guides/background"},{"title":"Sail Rust Integration Guide","description":"Walkthrough for integrating Sail Exchange Rust Client","href":"/guides/sail_integration_rust"},{"title":"Sail Typescript Integration Guide","href":"/guides/sail_integration_ts"},{"title":"Sail API Integration Guide","href":"/guides/sail_integration_api"}]},{"group":"Contracts","pages":[{"title":"Order","href":"/contracts/order"},{"title":"Order Settler","href":"/contracts/order_settler"},{"title":"Order Predicates","href":"/contracts/order_predicate"},{"title":"Order Script","href":"/contracts/order_script"}]},{"group":"Security","pages":[{"title":"Audits","href":"/security/audits"},{"title":"Vulnerability Disclosure","href":"/security/vulnerability_disclosure"}]}]},{"anchor":"Community","href":"https://discord.gg/462H69D6","icon":"discord"},{"anchor":"Github","href":"https://github.com/Sail-Exchange","icon":"github"},{"anchor":"Blog","href":"https://mirror.xyz/sailexchange.eth","icon":"newspaper"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/coming_soon"}]}]},"basePath":"","title":"Background - Sail","buildId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","deploymentId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","dynamics":[],"chunks":[]}