Skip to content

Commit

Permalink
Merge pull request #10 from xmtp/upgrade-xmtp-js
Browse files Browse the repository at this point in the history
Upgrade xmtp-js
  • Loading branch information
neekolas authored Sep 4, 2023
2 parents 20185c8 + b48be59 commit 6fa7a57
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
},
"dependencies": {
"@metamask/providers": "^9.0.0",
"@xmtp/proto": "^3.26.0",
"@xmtp/xmtp-js": "9.3.0-snap.1",
"@xmtp/proto": "^3.28.0-beta.1",
"@xmtp/xmtp-js": "^11.0.0-beta.7",
"buffer": "^6.0.3",
"ethers": "^6.6.2",
"react": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
]
},
"dependencies": {
"@xmtp/proto": "^3.26.0",
"@xmtp/xmtp-js": "9.3.0-snap.1",
"@xmtp/proto": "^3.28.0-beta.1",
"@xmtp/xmtp-js": "^11.0.0-beta.7",
"async-mutex": "^0.4.0",
"buffer": "^6.0.3",
"protobufjs": "^7.2.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/xmtp/snap.git"
},
"source": {
"shasum": "b5JxstM+SUDmu8WPTXRfDaXA5QZx9BNW2fQX/GC17/g=",
"shasum": "mBnXwLylK6madz+uBk4DIMjHM8Yg1ygRNcz6PMyzLMc=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
10 changes: 7 additions & 3 deletions packages/snap/src/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable jsdoc/require-jsdoc */
import {
InMemoryKeystore,
Keystore,
PrivateKeyBundleV1,
keystoreApiDefs,
} from '@xmtp/xmtp-js';
Expand Down Expand Up @@ -161,13 +162,16 @@ export function KeystoreHandler(backingKeystore: InMemoryKeystore) {
throw new Error('no method found in keystore');
}

// eslint-disable-next-line no-loop-func
out[method] = async (req: SnapRequest): Promise<SnapResponse> => {
const backingMethod = backingKeystore[method as keyof Keystore];
if (typeof backingMethod !== 'function') {
throw new Error('not a function');
}
return processProtoRequest(
apiDef,
req,
backingKeystore[method as keyof InMemoryKeystore].bind(
backingKeystore,
) as any,
backingMethod.bind(backingKeystore) as any,
);
};
}
Expand Down

0 comments on commit 6fa7a57

Please sign in to comment.