Skip to content

Commit

Permalink
fix: nft url slash
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlacci committed Jan 27, 2023
1 parent 961b1c5 commit 2d49ae3
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 85 deletions.
70 changes: 35 additions & 35 deletions docs/classes/Pod.html

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions docs/classes/Proposal.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ <h1>orca-sdk</h1>
<h2>Getting Started</h2>
</a>
<p>Initialize the SDK with the init function on startup:</p>
<pre><code class="language-js"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-4">init</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&quot;@orcaprotocol/orca-sdk&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// Any ethers provider works.</span><br/><span class="hl-6">// 1 for mainnet, 5 for goerli.</span><br/><span class="hl-6">// Make sure that the provider is instantiated before the SDK</span><br/><span class="hl-2">init</span><span class="hl-1">({ </span><span class="hl-4">provider:</span><span class="hl-1"> </span><span class="hl-4">ethers</span><span class="hl-1">.</span><span class="hl-2">getDefaultProvider</span><span class="hl-1">(), </span><span class="hl-4">network:</span><span class="hl-1"> </span><span class="hl-7">1</span><span class="hl-1"> });</span>
<pre><code class="language-js"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-4">init</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&#39;@orcaprotocol/orca-sdk&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// Any ethers provider works.</span><br/><span class="hl-6">// 1 for mainnet, 5 for goerli.</span><br/><span class="hl-6">// Make sure that the provider is instantiated before the SDK</span><br/><span class="hl-2">init</span><span class="hl-1">({ </span><span class="hl-4">provider:</span><span class="hl-1"> </span><span class="hl-4">ethers</span><span class="hl-1">.</span><span class="hl-2">getDefaultProvider</span><span class="hl-1">(), </span><span class="hl-4">network:</span><span class="hl-1"> </span><span class="hl-7">1</span><span class="hl-1"> });</span>
</code></pre>
<p>Once you init the SDK, you can call <code>getPod()</code>, <code>getUserPods()</code>, or <code>getAdminPods()</code> anywhere to
fetch Pod objects.</p>
<pre><code class="language-js"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-4">getPod</span><span class="hl-1">, </span><span class="hl-4">getUserPods</span><span class="hl-1">, </span><span class="hl-4">getAdminPods</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&quot;@orcaprotocol/orca-sdk&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">podFromEnsName</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getPod</span><span class="hl-1">(</span><span class="hl-3">&quot;mypod.pod.xyz&quot;</span><span class="hl-1">);</span><br/><span class="hl-6">// ENS names also work for the below.</span><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">podFromAddress</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getPod</span><span class="hl-1">(</span><span class="hl-3">&quot;0x123...456&quot;</span><span class="hl-1">);</span><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">podFromId</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getPod</span><span class="hl-1">(</span><span class="hl-7">1</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Returns null</span><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">notAPod</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getPod</span><span class="hl-1">(</span><span class="hl-3">&quot;not a pod&quot;</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Fetches all Pods that a user is a member of</span><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">userPods</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getUserPods</span><span class="hl-1">(</span><span class="hl-4">userAddress</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Fetches all Pods that a user is an admin of</span><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">adminPods</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getAdminPods</span><span class="hl-1">(</span><span class="hl-4">adminAddress</span><span class="hl-1">);</span>
<pre><code class="language-js"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-4">getPod</span><span class="hl-1">, </span><span class="hl-4">getUserPods</span><span class="hl-1">, </span><span class="hl-4">getAdminPods</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&#39;@orcaprotocol/orca-sdk&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">podFromEnsName</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getPod</span><span class="hl-1">(</span><span class="hl-3">&#39;mypod.pod.xyz&#39;</span><span class="hl-1">);</span><br/><span class="hl-6">// ENS names also work for the below.</span><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">podFromAddress</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getPod</span><span class="hl-1">(</span><span class="hl-3">&#39;0x123...456&#39;</span><span class="hl-1">);</span><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">podFromId</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getPod</span><span class="hl-1">(</span><span class="hl-7">1</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Returns null</span><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">notAPod</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getPod</span><span class="hl-1">(</span><span class="hl-3">&#39;not a pod&#39;</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Fetches all Pods that a user is a member of</span><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">userPods</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getUserPods</span><span class="hl-1">(</span><span class="hl-4">userAddress</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Fetches all Pods that a user is an admin of</span><br/><span class="hl-8">const</span><span class="hl-1"> </span><span class="hl-9">adminPods</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">getAdminPods</span><span class="hl-1">(</span><span class="hl-4">adminAddress</span><span class="hl-1">);</span>
</code></pre>

<a href="#types" id="types" style="color: inherit; text-decoration: none;">
<h3>Types</h3>
</a>
<p>Types can be imported as such:</p>
<pre><code class="language-js"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-4">Pod</span><span class="hl-1">, </span><span class="hl-4">Proposal</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&quot;@orcaprotocol/orca-sdk&quot;</span><span class="hl-1">;</span>
<pre><code class="language-js"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-4">Pod</span><span class="hl-1">, </span><span class="hl-4">Proposal</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&#39;@orcaprotocol/orca-sdk&#39;</span><span class="hl-1">;</span>
</code></pre>

<a href="#additional-documentation" id="additional-documentation" style="color: inherit; text-decoration: none;">
Expand Down
30 changes: 15 additions & 15 deletions docs/modules.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Pod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ export default class Pod {
} catch {
this.description = null;
}
const imageUrl = `${baseUrl}${paddedId}-image`;
const imageNoTextUrl = `${baseUrl}${paddedId}-image-no-text`;
const imageUrl = `${baseUrl}${paddedId}/image`;
const imageNoTextUrl = `${baseUrl}${paddedId}/image-no-text`;

this.imageUrl = imageUrl;
this.imageNoTextUrl = imageNoTextUrl;
Expand Down
2 changes: 1 addition & 1 deletion src/pod-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function createAddressPointer(number) {

function getImageUrl(nextPodId: number) {
const baseUrl = `https://metropolis-nft.herokuapp.com/assets/${config.network}/`;
return `${baseUrl}${nextPodId.toString(16).padStart(64, '0')}-image`;
return `${baseUrl}${nextPodId.toString(16).padStart(64, '0')}/image`;
}

/**
Expand Down
16 changes: 8 additions & 8 deletions test/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export const orcaCorePod = {
id: 0,
safe: '0x7bf660f3e287d2a05F46b72Ae69a048f3781Db90',
imageUrl:
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000000-image',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000000/image',
imageNoTextUrl:
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000000-image-no-text',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000000/image-no-text',
admin: '0x4B4C43F66ec007D1dBE28f03dAC975AAB5fbb888',
ensName: 'orca-core.pod.xyz',
};
Expand All @@ -23,9 +23,9 @@ export const orcanautPod = {
id: 1,
safe: orcanautAddress,
imageUrl:
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000001-image',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000001/image',
imageNoTextUrl:
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000001-image-no-text',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000001/image-no-text',
admin: '0x094A473985464098b59660B37162a284b5132753',
ensName: 'orcanauts.pod.xyz',
members: [
Expand All @@ -49,9 +49,9 @@ export const artNautPod = {
safe: '0x25F55d2e577a937433686A01439E5fFdffe62218',
ensName: 'art-naut.pod.xyz',
imageUrl:
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000006-image',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000006/image',
imageNoTextUrl:
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000006-image-no-text',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000006/image-no-text',
members: [
'0x094A473985464098b59660B37162a284b5132753',
'0x29864e4d1588C4164DEe7cc495147Ec141f9c9d5',
Expand All @@ -68,9 +68,9 @@ export const metropolis1WithAdminPod = {
safe: '0x17CAc2cEe6dBC775aeD64A5E30d5B6CA9c200BaB',
ensName: '1-with-admin.pod.eth',
imageUrl:
'https://metropolis-nft.herokuapp.com/assets/5/000000000000000000000000000000000000000000000000000000000000000a-image',
'https://metropolis-nft.herokuapp.com/assets/5/000000000000000000000000000000000000000000000000000000000000000a/image',
imageNoTextUrl:
'https://metropolis-nft.herokuapp.com/assets/5/000000000000000000000000000000000000000000000000000000000000000a-image-no-text',
'https://metropolis-nft.herokuapp.com/assets/5/000000000000000000000000000000000000000000000000000000000000000a/image-no-text',
members: [
'0x094A473985464098b59660B37162a284b5132753',
'0x4B4C43F66ec007D1dBE28f03dAC975AAB5fbb888',
Expand Down
12 changes: 6 additions & 6 deletions test/pod.create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('pod create', () => {
'0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
'test.pod.eth',
100,
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000064-image',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000064/image',
);
});

Expand Down Expand Up @@ -185,7 +185,7 @@ describe('podifySafe', () => {
'0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
'test.pod.eth',
100,
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000064-image',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000064/image',
);
});

Expand All @@ -205,7 +205,7 @@ describe('podifySafe', () => {
safe: orcanautAddress,
});
expect(unsignedTx).toEqual({
data: '0x3ef3a75c0000000000000000000000004b4c43f66ec007d1dbe28f03dac975aab5fbb88800000000000000000000000097f7dcdf56934cf87a2d5df860fd881fa84ad1429c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb65800000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000c746573742e706f642e6574680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007468747470733a2f2f6d6574726f706f6c69732d6e66742e6865726f6b756170702e636f6d2f6173736574732f352f303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303036342d696d616765000000000000000000000000',
data: '0x3ef3a75c0000000000000000000000004b4c43f66ec007d1dbe28f03dac975aab5fbb88800000000000000000000000097f7dcdf56934cf87a2d5df860fd881fa84ad1429c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb65800000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000c746573742e706f642e6574680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007468747470733a2f2f6d6574726f706f6c69732d6e66742e6865726f6b756170702e636f6d2f6173736574732f352f303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303036342f696d616765000000000000000000000000',
to: '0xE64E35db269ee0846a5BF14d7EB9a2Af4C1ed185',
});
});
Expand Down Expand Up @@ -267,9 +267,9 @@ describe('multi pod create', () => {
],
['gov-nauts.pod.eth', 'art-nauts.pod.eth', 'orcanauts.pod.eth'],
[
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000066-image',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000065-image',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000064-image',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000066/image',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000065/image',
'https://metropolis-nft.herokuapp.com/assets/5/0000000000000000000000000000000000000000000000000000000000000064/image',
],
);
});
Expand Down

0 comments on commit 2d49ae3

Please sign in to comment.